0

使用 Allure Jenkins 插件(插件版本 2.6)生成报告时出现以下错误:建议进行更正。

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running my.company.SimpleTest
Configuring TestNG with: TestNG652Configurator
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.673 sec - in my.company.SimpleTest

Results :

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

[JENKINS] Recording test results
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.818 s
[INFO] Finished at: 2015-07-31T16:47:01+03:00
[INFO] Final Memory: 25M/343M
[INFO] ------------------------------------------------------------------------
Ожидаю пока Jenkins закончит сбор данных
[JENKINS] Archiving C:\Jenkins\workspace\allure\pom.xml to ru.yandex.qatools.allure/allure-testng-example/1.0-SNAPSHOT/allure-testng-example-1.0-SNAPSHOT.pom
channel stopped
Allure Report Generation: started
Allure Report Generation: find directories by mask [**/allure-results]
Allure Report Generation: found allure result directories [C:\Jenkins\workspace\allure\target\allure-results]
Allure Report Generation: copy founded directories in directory [C:\Jenkins\workspace\allure\allure8063768305174617023.tmp\results]
Allure Report Generation: generate report from directory [C:\Jenkins\workspace\allure\allure8063768305174617023.tmp]
Allure Report Generation: proxy settings [active:'false', host:'null', port:'0', username:'null', password: '']
ERROR: Publisher 'Allure Report Generation' aborted due to exception: 
java.io.IOException: ru.yandex.qatools.allure.report.AllureReportBuilderException: java.lang.ClassNotFoundException: ru.yandex.qatools.allure.data.AllureReportGenerator
    at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:50)
    at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:25)
    at hudson.FilePath.act(FilePath.java:989)
    at hudson.FilePath.act(FilePath.java:967)
    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:267)
    at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:146)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:776)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1037)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
    at hudson.model.Run.execute(Run.java:1763)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:381)
Caused by: ru.yandex.qatools.allure.report.AllureReportBuilderException: java.lang.ClassNotFoundException: ru.yandex.qatools.allure.data.AllureReportGenerator
    at ru.yandex.qatools.allure.report.AllureReportBuilder.processResults(AllureReportBuilder.java:133)
    at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:47)
    ... 14 more
Caused by: java.lang.ClassNotFoundException: ru.yandex.qatools.allure.data.AllureReportGenerator
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at ru.yandex.qatools.allure.report.AllureReportBuilder.processResults(AllureReportBuilder.java:129)
    ... 15 more
Finished: FAILURE

pom.xml:

<?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>

     <parent>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-examples-parent</artifactId>
        <version>1.0</version>
    </parent> 

    <artifactId>allure-testng-example</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <allure.version>1.4.15</allure.version>
        <aspectj.version>1.8.5</aspectj.version>
    </properties>

    <name>Allure TestNG Example</name>
    <description>Allure TestNG and WebDriver Usage Example</description>

    <dependencies>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-testng-adaptor</artifactId>
            <version>${allure.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.github.detro.ghostdriver</groupId>
            <artifactId>phantomjsdriver</artifactId>
            <version>1.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                    </argLine>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!--Needed only to show reports locally. Run jetty:run and
            open localhost:8080 to show the report-->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.2.10.v20150310</version>
                <configuration>
                    <webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
                    <stopKey>stop</stopKey>
                    <stopPort>1234</stopPort>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <plugins>
            <plugin>
                <groupId>ru.yandex.qatools.allure</groupId>
                <artifactId>allure-maven-plugin</artifactId>
                <version>2.2</version>
            </plugin>
        </plugins>
    </reporting>

</project>

当我运行时mvn clean test site,从项目文件夹中运行正常。有人收到这个错误吗?

4

1 回答 1

0

请使用下面的 pom.xml 并尝试,

<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.123</groupId>
  <artifactId>testThisAllure</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>SampleTRForAllure</name>

  <properties>      
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <compiler.version>1.7</compiler.version>
        <!-- <allure.version>1.4.0.RC3</allure.version> -->
        <allure.version>1.4.13</allure.version>
        <aspectj.version>1.8.5</aspectj.version>            
            <aetherVersion>0.9.0.M2</aetherVersion>
            <mavenVersion>3.1.0</mavenVersion>
            <wagonVersion>2.6</wagonVersion>
    </properties>


  <build>

        <plugins>
            <!-- Compiler plug-in -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>${jdk.level}</source>
                    <target>${jdk.level}</target>
                </configuration>
            </plugin>
            <!-- Below plug-in is used to execute tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <suiteXmlFiles>
                        <!-- TestNG suite XML files -->
                        <suiteXmlFile>testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <testFailureIgnore>true</testFailureIgnore>
                    <argLine>
                    -javaagent:"${settings.localRepository}\org\aspectj\aspectjweaver\${aspectj.version}\aspectjweaver-${aspectj.version}.jar"
                </argLine>
                <forkCount>3</forkCount>
    <reuseForks>true</reuseForks>
    <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
                    </property>
                </properties>
            </configuration>   

            <dependencies>
            <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
                </dependencies>         

            </plugin>
        </plugins>
    </build>

    <reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-maven-plugin</artifactId>
            <version>2.0</version>
        </plugin>
    </plugins>
</reporting>

    <!-- Include the following dependencies -->
    <dependencies>

    <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-testng-adaptor</artifactId>
            <version>${allure.version}</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-java-annotations</artifactId>
            <version>${allure.version}</version>
        </dependency>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-java-aspects</artifactId>
            <version>${allure.version}</version>
        </dependency>

        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-report-data</artifactId>
            <version>${allure.version}</version>

        </dependency>
        <dependency>
    <groupId>ru.yandex.qatools.allure</groupId>
    <artifactId>allure-java-commons</artifactId>
    <version>1.4.0.RC9</version>
</dependency>

            <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-commons</artifactId>
            <version>1.4.0.RC4</version>
        </dependency>



        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.53.0</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>2.53.0</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.10-FINAL</version>
        </dependency>

    </dependencies>

</project>
于 2016-06-14T10:46:51.220 回答