0

A 有一个任务“从 serenity-jbehave-archetype 生成自动化框架”,我是从命令行完成的。当我执行mvn verify命令时,构建失败并显示下一个日志:

>     Results :
>     
>     Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
>     
>     [INFO] ------------------------------------------------------------------------
>     [INFO] BUILD FAILURE
>     [INFO] ------------------------------------------------------------------------
>     [INFO] Total time: 7.140 s
>     [INFO] Finished at: 2016-09-25T01:19:05+03:00
>     [INFO] Final Memory: 10M/25M
>     [INFO] ------------------------------------------------------------------------
>     [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test
> (default) on project Final: Execution default of goal
> org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test
> failed: There was an error in the forked process
>     [ERROR] java.lang.RuntimeException: failed to find all classes in package [com]
>     [ERROR] at net.serenitybdd.jbehave.ClassFinder.allClassesInPackage(ClassFinder.java:78)
>     [ERROR] at net.serenitybdd.jbehave.ClassFinder.fromPackage(ClassFinder.java:57)
>     [ERROR] at net.serenitybdd.jbehave.SerenityStepFactory.getCandidateClasses(SerenityStepFactory.java:61)
>     [ERROR] at net.serenitybdd.jbehave.SerenityStepFactory.stepsTypes(SerenityStepFactory.java:51)
>     [ERROR] at org.jbehave.core.steps.AbstractStepsFactory.createCandidateSteps(AbstractStepsFactory.java:34)
>     [ERROR] at net.serenitybdd.jbehave.SerenityStepFactory.createCandidateSteps(SerenityStepFactory.java:44)
>     [ERROR] at net.serenitybdd.jbehave.runners.SerenityReportingRunner.buildCandidateSteps(SerenityReportingRunner.java:253)
>     [ERROR] at net.serenitybdd.jbehave.runners.SerenityReportingRunner.createCandidateStepsWith(SerenityReportingRunner.java:208)
>     [ERROR] at net.serenitybdd.jbehave.runners.SerenityReportingRunner.createCandidateStepsWithNoMonitor(SerenityReportingRunner.java:216)
>     [ERROR] at net.serenitybdd.jbehave.runners.SerenityReportingRunner.getCandidateSteps(SerenityReportingRunner.java:199)
>     [ERROR] at net.serenitybdd.jbehave.runners.SerenityReportingRunner.buildDescriptionFromStories(SerenityReportingRunner.java:272)
>     [ERROR] at net.serenitybdd.jbehave.runners.SerenityReportingRunner.getDescriptions(SerenityReportingRunner.java:90)
>     [ERROR] at net.serenitybdd.jbehave.runners.SerenityReportingRunner.getDescription(SerenityReportingRunner.java:137)
>     [ERROR] at org.junit.runners.Suite.describeChild(Suite.java:123)
>     [ERROR] at org.junit.runners.Suite.describeChild(Suite.java:27)
>     [ERROR] at org.junit.runners.ParentRunner.getDescription(ParentRunner.java:352)
>     [ERROR] at org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil.createSuiteDescription(JUnit4ProviderUtil.java:113)
>     [ERROR] at org.apache.maven.surefire.junit4.JUnit4Provider.createTestsDescription(JUnit4Provider.java:257)
>     [ERROR] at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
>     [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
>     [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
>     [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
>     [ERROR] Caused by: java.lang.RuntimeException: failed to find classesin
> directory=[jar:file:/C:/Users/Olya/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar!/com],
> with packageName=[com]
>     [ERROR] at net.serenitybdd.jbehave.ClassFinder.findClasses(ClassFinder.java:148)
>     [ERROR] at net.serenitybdd.jbehave.ClassFinder.allClassesInPackage(ClassFinder.java:74)
>     [ERROR] ... 21 more
>     [ERROR] Caused by: java.lang.IllegalArgumentException: Could not find or access class for com.google.inject.internal.asm.
>     [ERROR] at net.serenitybdd.jbehave.ClassFinder.loadClassWithName(ClassFinder.java:208)
>     [ERROR] at net.serenitybdd.jbehave.ClassFinder.findClassesInJar(ClassFinder.java:169)
>     [ERROR] at net.serenitybdd.jbehave.ClassFinder.findClasses(ClassFinder.java:141)
>     [ERROR] ... 22 more
>     [ERROR] Caused by: java.lang.ClassNotFoundException: com.google.inject.internal.asm.
>     [ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>     [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>     [ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>     [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>     [ERROR] at net.serenitybdd.jbehave.ClassFinder.loadClassWithName(ClassFinder.java:206)
>     [ERROR] ... 24 more
>     [ERROR] -> [Help 1]
>     [ERROR]
>     [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
>     [ERROR] Re-run Maven using the -X switch to enable full debug logging.
>     [ERROR]
>     [ERROR] For more information about the errors and possible solutions, please read the following articles:
>     [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

这是我的 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>
    <groupId>com.cherniienko</groupId>
    <artifactId>Final</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Sample Serenity project using JBehave and WebDriver</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <serenity.version>1.1.38</serenity.version>
        <serenity.jbehave.version>1.13.0</serenity.jbehave.version>
        <webdriver.driver>firefox</webdriver.driver>
    </properties>

    <repositories>
      <repository>
        <snapshots>
        <enabled>false</enabled>
        </snapshots>
        <id>central</id>
        <name>bintray</name>
        <url>http://jcenter.bintray.com</url>
      </repository>
    </repositories>
    <pluginRepositories>
      <pluginRepository>
        <snapshots>
        <enabled>false</enabled>
        </snapshots>
        <id>central</id>
        <name>bintray-plugins</name>
        <url>http://jcenter.bintray.com</url>
      </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-core</artifactId>
            <version>${serenity.version}</version>
        </dependency>
        <dependency>
            <groupId>net.serenity-bdd</groupId>
            <artifactId>serenity-jbehave</artifactId>
            <version>${serenity.jbehave.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.7</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>1.7.0</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.lambdaj</groupId>
            <artifactId>lambdaj</artifactId>
            <version>2.3.3</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                        <include>**/*TestSuite.java</include>
                        <include>**/Test*.java</include>
                        <include>**/When*.java</include>
                    </includes>
                    <argLine>-Xmx512m</argLine>
                    <systemPropertyVariables>
                        <webdriver.driver>${webdriver.driver}</webdriver.driver>
                    </systemPropertyVariables>
                </configuration>
               <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.serenity-bdd.maven.plugins</groupId>
                <artifactId>serenity-maven-plugin</artifactId>
                <version>${serenity.version}</version>
                <executions>
                    <execution>
                        <id>serenity-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

我看到了,failed to find all classes in package [com]但不明白 pom 文件或导入到 Idea 有什么问题。请你帮助我好吗?

4

1 回答 1

0

bdd serenity-jbehave 1.8.0 及更高版本出现了一个问题(包括快速修复):

问题 #109

于 2016-10-20T12:43:46.483 回答