我试图在Maven中执行一个JBehave故事,它完全忽略了JBehave插件。我花了几个小时使用不同的配置,但看起来插件根本没有被执行。如有任何建议或建议,将不胜感激!
我所有的JBehave类都位于:
src/at/java
我的pom.xml的相关部分:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/at/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<executions>
<execution>
<id>run-stories-as-embeddables</id>
<phase>integration-test</phase>
<configuration>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>发布于 2012-09-20 12:06:57
最好是将测试类的位置更改为src/ test /java,并根据JBehave文档更改故事的名称。
发布于 2013-06-07 11:56:23
与maven一起运行的JBehave遵循Maven规则来定位代码和文本工件。对于测试范围,必须将它们放在src/ test /java和src/test/resources中。对于编译作用域,src/main/java和src/main/resources。
使用带有maven的JBehave,您可以使用两个作用域(测试或编译),只需在插件配置中设置所需的作用域,就可以选择放置工件的位置。它默认编译。
在您的示例中,您要添加一个新的测试源,因此必须设置测试范围:
请看这里的细节。
发布于 2014-05-11 20:57:58
也许jbehave插件找不到编译过的测试类(场景),因为它在错误的类路径中。
请查看您的目标目录,并搜索嵌入类->目标/类或目标/测试类?
为了解决这个问题,我必须在我的项目pom.xml的配置中设置jbehave plugin的范围来测试。
下面是一个例子
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<executions>
<execution>
<id>run-stories-as-embeddables</id>
<phase>integration-test</phase>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
<configuration>
<scope>test</scope>
<includes>
<include>**/*Scenarios.java</include>
</includes>
<ignoreFailureInStories>true</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
</configuration>
</execution>https://stackoverflow.com/questions/12512059
复制相似问题