从命令提示符或jenkins运行TestNG测试套件时出现Maven异常

时间:2017-11-27 13:38:27

标签: java maven jenkins log4j

操作系统:Ubuntu 16.04 这是我更新的pom.xml

现在我正在运行以下命令 mvn install -Pbizom - DsuiteXmlFile = src / test / java / suite / testng_OrderSanity.xml

我尝试过不同的log4j版本但没有工作。

这是我更新的pom.xml文件:

onClose()

但是当我通过以下命令通过命令提示符运行它时:

<?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
            http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

    <groupId>com.mobisy.bizom</groupId>
    <artifactId>bizom</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>

            </plugins>
    </build>
    <properties>          
         <extentreports.version>2.40.2</extentreports.version>
    <project.build.sourceEncoding>
              UTF-8 
    </project.build.sourceEncoding>
    <project.reporting.outputEncoding>
            UTF-8 
    </project.reporting.outputEncoding>

</properties>
        <profiles>
            <profile>
                <id>bizom</id>             
 <properties>

       <maven.test.failure.ignore>true</maven.test.failure.ignore>
                <suiteXmlFile>src/test/java/suite/testng_OrderSanity.xml</suiteXmlFile>
            </properties>
            <build>
                    <plugins>
                        <plugin>

                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                            <version>2.19.1</version>
                            <configuration>
                                <properties>
                                    <property>
                                        <name>listener</name>            
                          <value>bizom.listener.CustomListener</value>
                                    </property>
                                </properties>
                 <suiteXmlFiles>
                            <suiteXmlFile>${suiteXmlFile}
                 </suiteXmlFile>
                                </suiteXmlFiles>
                   <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                                <threadCount>1</threadCount>
                                <classpathDependencyScopeExclude>runtime</classpathDependencyScopeExclude>
                                <useSystemClassLoader>false</useSystemClassLoader>
                                <printSummary>true</printSummary>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-shade-plugin</artifactId>
                            <version>3.1.0</version>
                        </plugin>
                         <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                             <version>2.19.1</version>
                             <executions>
                                 <execution>
                                     <goals>
                                         <goal>integration-test</goal>
                                         <goal>verify</goal>
                                     </goals>
                                 </execution>
                             </executions>
                         </plugin>
                    </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.0.1</version>
        </dependency>

        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.6</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.8-beta4</version>
        </dependency>


        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.14</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-testng</artifactId>
            <version>2.19.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <artifactId>guava</artifactId>
            <groupId>com.google.guava</groupId>
            <type>jar</type>
            <version>15.0</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.11</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom2</artifactId>
            <version>2.0.5</version>
        </dependency>

        <dependency>
            <groupId>com.relevantcodes</groupId>
            <artifactId>extentreports</artifactId>
            <version>${extentreports.version}</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.39</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.19.1</version>
            <type>maven-plugin</type>
        </dependency>

        <dependency>
            <groupId>com.jayway.restassured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>2.4.1</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.github.fge</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>2.2.6</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-api</artifactId>
            <version>2.19.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>maven-surefire-common</artifactId>
            <version>2.19.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.9.1</version>

        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.9.1</version>      
        </dependency>
    </dependencies>
</project>

现在面临新的错误:

**mvn install -Pbizom -DsuiteXmlFile=src/test/java/suite/testng_OrderSanity.xml**

0 个答案:

没有答案