java.io.FileNotFoundException为jbehave / storyDurat

2019-10-21 11:14发布

我试图让jBehave上模仿我的2模块谷歌App Engine的项目工作https://github.com/ctesniere/appengine-modules-sample-java 。 我生成的jBehave原型( jbehave-simple-archetype使用Maven)。 我能得到这个成功运行。

然而,当我手动应用上我的目标项目更改到我的pom.xml和复制由jBehave原型生成的两个java文件,我不能让一个成功的mvn clean install

我得到以下错误:

[INFO] --- jbehave-maven-plugin:3.9.5:run-stories-as-embeddables (embeddable-stories) @ followerdownloader-frontend ---
[INFO] Running stories as embeddables using embedder Embedder[storyMapper=StoryMapper,storyRunner=StoryRunner,embedderMonitor=MavenEmbedderMonitor,classLoader=EmbedderClassLoader[urls=[/Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/target/classes/, appengine-api-1.0-sdk-1.9.17.jar, servlet-api-2.5.jar, jstl-1.2.jar, jbehave-core-3.9.5.jar, hamcrest-integration-1.3.jar, commons-collections-3.2.1.jar, commons-io-2.4.jar, commons-lang-2.6.jar, plexus-utils-3.0.10.jar, freemarker-2.3.19.jar, paranamer-2.4.jar, xstream-1.4.5.jar, xmlpull-1.1.3.1.jar, xpp3_min-1.1.4c.jar],parent=ClassRealm[plugin>org.jbehave:jbehave-maven-plugin:3.9.5, parent: sun.misc.Launcher$AppClassLoader@6da21389]],embedderControls=UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]],embedderFailureStrategy=<null>,configuration=org.jbehave.core.configuration.MostUsefulConfiguration@3ba4236f,candidateSteps=<null>,stepsFactory=<null>,metaFilters=[],systemProperties=<null>,executorService=<null>,executorServiceCreated=false,storyManager=<null>]
[INFO] Found class names: [com.netbase.jbehaveexample.MyStories]
[INFO] Using controls UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]]
[INFO] Running embeddable com.netbase.jbehaveexample.MyStories
[INFO] Processing system properties {}
[INFO] Using controls UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]]

(BeforeStories)


(AfterStories)

[INFO] Generating reports view to '/Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/target/jbehave' using formats '[stats, console, txt, html, xml]' and view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports-with-totals.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
java.io.FileNotFoundException: /Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/target/jbehave/storyDurations.props (No such file or directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at java.io.FileReader.<init>(FileReader.java:72)
    at org.jbehave.core.reporters.TemplateableViewGenerator.storyDurations(TemplateableViewGenerator.java:123)
    at org.jbehave.core.reporters.TemplateableViewGenerator.generateReportsView(TemplateableViewGenerator.java:115)
    at org.jbehave.core.embedder.Embedder.generateReportsView(Embedder.java:249)
    at org.jbehave.core.embedder.Embedder.generateReportsView(Embedder.java:237)
    at org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:213)
    at org.jbehave.core.junit.JUnitStories.run(JUnitStories.java:20)
    at org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:121)
    at org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:18)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] Reports view generated with 0 stories (of which 0 pending) containing 0 scenarios (of which 0 pending)
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ followerdownloader-frontend ---
[INFO] Installing /Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/target/followerdownloader-frontend-1.0.war to /Users/mosofsky/.m2/repository/com/netbase/followerdownloader/followerdownloader-frontend/1.0/followerdownloader-frontend-1.0.war
[INFO] Installing /Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/pom.xml to /Users/mosofsky/.m2/repository/com/netbase/followerdownloader/followerdownloader-frontend/1.0/followerdownloader-frontend-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.363 s
[INFO] Finished at: 2014-12-22T14:53:51-08:00
[INFO] Final Memory: 22M/222M
[INFO] ------------------------------------------------------------------------

我无法找到一个文件名为behave/storyDurations.props从原型构建复制到我自己的项目。 我在想什么?

Answer 1:

从原型复制了失踪的文件转移到新的项目是stories/my.story 。 虽然错误是别的事情,我能够得到这个错误时,我复制了my.story文件消失:

[INFO] --- jbehave-maven-plugin:3.9.5:run-stories-as-embeddables (embeddable-stories) @ followerdownloader-frontend ---
[INFO] Running stories as embeddables using embedder Embedder[storyMapper=StoryMapper,storyRunner=StoryRunner,embedderMonitor=MavenEmbedderMonitor,classLoader=EmbedderClassLoader[urls=[/Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/target/classes/, appengine-api-1.0-sdk-1.9.17.jar, servlet-api-2.5.jar, jstl-1.2.jar, jbehave-core-3.9.5.jar, hamcrest-integration-1.3.jar, commons-collections-3.2.1.jar, commons-io-2.4.jar, commons-lang-2.6.jar, plexus-utils-3.0.10.jar, freemarker-2.3.19.jar, paranamer-2.4.jar, xstream-1.4.5.jar, xmlpull-1.1.3.1.jar, xpp3_min-1.1.4c.jar],parent=ClassRealm[plugin>org.jbehave:jbehave-maven-plugin:3.9.5, parent: sun.misc.Launcher$AppClassLoader@6da21389]],embedderControls=UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]],embedderFailureStrategy=<null>,configuration=org.jbehave.core.configuration.MostUsefulConfiguration@2b37d486,candidateSteps=<null>,stepsFactory=<null>,metaFilters=[],systemProperties=<null>,executorService=<null>,executorServiceCreated=false,storyManager=<null>]
[INFO] Found class names: [com.netbase.jbehaveexample.MyStories]
[INFO] Using controls UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]]
[INFO] Running embeddable com.netbase.jbehaveexample.MyStories
[INFO] Processing system properties {}
[INFO] Using controls UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]]

(BeforeStories)

[INFO] Running story com/netbase/jbehaveexample/stories/my.story

(com/netbase/jbehaveexample/stories/my.story)
Scenario: A scenario with some pending steps
Given I am a pending step (PENDING)
And I am still pending step (PENDING)
When a good soul will implement me (PENDING)
Then I shall be happy (PENDING)
@Given("I am a pending step")
@Pending
public void givenIAmAPendingStep() {
  // PENDING
}

@Given("I am still pending step")
@Pending
public void givenIAmStillPendingStep() {
  // PENDING
}

@When("a good soul will implement me")
@Pending
public void whenAGoodSoulWillImplementMe() {
  // PENDING
}

@Then("I shall be happy")
@Pending
public void thenIShallBeHappy() {
  // PENDING
}




(AfterStories)

[INFO] Generating reports view to '/Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/target/jbehave' using formats '[stats, console, txt, html, xml]' and view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports-with-totals.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
[INFO] Reports view generated with 1 stories (of which 1 pending) containing 1 scenarios (of which 1 pending)
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ followerdownloader-frontend ---
[INFO] Installing /Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/target/followerdownloader-frontend-1.0.war to /Users/mosofsky/.m2/repository/com/netbase/followerdownloader/followerdownloader-frontend/1.0/followerdownloader-frontend-1.0.war
[INFO] Installing /Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/pom.xml to /Users/mosofsky/.m2/repository/com/netbase/followerdownloader/followerdownloader-frontend/1.0/followerdownloader-frontend-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.486 s
[INFO] Finished at: 2014-12-22T15:08:01-08:00
[INFO] Final Memory: 22M/229M
[INFO] ------------------------------------------------------------------------

复制过.story文件所做的java.io.FileNotFoundException为jbehave / storyDurations.props错误消失。

=================

更新:另一个解决方案是创建一个符号链接到包含故事文件的目录。 如果你有多个谷歌应用程序引擎模块,但要跨模块共享的故事文件,这非常有用。 有关如何设置符号链接(“符号链接”)的说明,请参阅本其他的解决办法: https://stackoverflow.com/a/28137844/2848676



Answer 2:

我试了很多方法,但还是没有解决我的问题。 最后,我去掉空格和通配符从我的路径(包括文件夹名称),那么它允许我执行测试运行



Answer 3:

我固定它通过 -

  1. 列表项添加类似步骤类的实例new ClassnameSteps()StoryRunner.java
  2. 我用<story>Classname</story>代替<Story>Classname</Story> 。 不要介意小S和大写字母S的故事。


文章来源: java.io.FileNotFoundException for jbehave/storyDurations.props