Java Maven can';我看不见杰伯哈夫

Java Maven can';我看不见杰伯哈夫,java,eclipse,maven,jbehave,Java,Eclipse,Maven,Jbehave,我刚刚开始学习jBehave和Maven(在Eclipse中)。我已经安装了JBehave Eclipse 1.0.0.20140605-071,并将其添加到我的Maven依赖项中-pom.xml的相关部分如下(回复后编辑): 如果我尝试构建,则会出现以下错误: Failure to find org.wmaop:wm-jbehave:jar:1.0.0 in https://repo.maven.apache.org/maven2 was cached in the local reposit

我刚刚开始学习jBehave和Maven(在Eclipse中)。我已经安装了JBehave Eclipse 1.0.0.20140605-071,并将其添加到我的Maven依赖项中-pom.xml的相关部分如下(回复后编辑):

如果我尝试构建,则会出现以下错误:

Failure to find org.wmaop:wm-jbehave:jar:1.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
“使用Maven创建测试项目”说明“如果项目中存在错误,请打开pom.xml文件以检查是否未找到wm jbehave依赖项。请验证您的设计器是否可以访问internet以检索jar依赖项”,但我不知道这意味着什么——电脑当然可以接入互联网——我在上面输入这个


如何解决此错误?

据我所知,它不在Maven central repo上,因此没有任何消息,但它在GitHub上可用,因此让我们使用

将此添加到您的POM中

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

jitpack.io
https://jitpack.io
尝试此回购:

或在本地建立项目:

git clone https://github.com/wmaop/wm-jbehave.git --branch  wm-jbehave-1.0.0
cd wm-jbehave
mvn clean install
我甚至不确定WM-AOP是否适合,除了在 我收到的错误消息

似乎你甚至不知道WM-AOP是什么:)
这(来自您的问题)展示了如何启用和运行JBehave以及它们的应用程序
换句话说,这是一个使用另一个独立项目的独立产品(集成服务器)
为了运行本教程,您需要先创建一个项目,然后使用此服务器和JBehave在此服务器上运行测试


但是你不需要这些东西来学习JBehave。JBehave是一个独立的产品,可以在许多环境中运行,甚至在纯Java(JDK)环境中也可以运行 只需按照以下步骤操作即可


1。在Eclipse中,单击新建/Maven项目


2。在以下对话框中,单击下一步


3。在下一页输入“jbehave simple archetype”,选择版本4.1并单击下一步 注意-不要使用最新版本4.1.1,因为它不工作(有一个bug将在即将发布的版本4.1.2中在1-2周内解决)


4.输入项目的组id和工件id,然后单击“完成”


仅此而已-您的JBehave项目已准备就绪。


src/main/resources/org/example/myJbehave/stories/
中,您可以找到带有示例故事的
my.story

Scenario: A scenario with some pending steps

Given I am a pending step
And I am still pending step
When a good soul will implement me
Then I shall be happy

src/main/java/org/example/myJbehave/steps/
中,您将找到
MySteps.java
类。用以下方式修改它:

import org.jbehave.core.annotations.Alias;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;

public class MySteps {

    @Given("I am a pending step")
    @Alias("I am still pending step")
    public void given_i_am_pending_step() {

        System.out.println("Tihis is implementation of GIVEN");
    }

    @When("a good soul will implement me")
    public void when_a_good_soul_will_implement_me() {
        System.out.println("Tihis is implementation of WHEN");
    }

    @Then("I shall be happy")
    public void then_i_shall_be_happy() {
        System.out.println("Tihis is implementation of THEN");
    }
}

/src/main/java/org/example/myJbehave/
中,您将找到
MyStories.java

此类包含配置和引导代码
使用鼠标右键单击它,然后选择“runas/junittest”,故事将被执行


您将在console选项卡中看到如下结果:

Processing system properties {}
Using controls EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=true,verboseFailures=false,verboseFiltering=false,storyTimeouts=60,threads=2,failOnStoryTimeout=false]

(BeforeStories)
Running story org/example/myJbehave/stories/my.story
Tihis is implementation of GIVEN
Tihis is implementation of GIVEN
Tihis is implementation of WHEN
Tihis is implementation of THEN

(org/example/myJbehave/stories/my.story)
Scenario: A scenario with some pending steps
Given I am a pending step
And I am still pending step
When a good soul will implement me
Then I shall be happy



(AfterStories)
Generating reports view to 'C:\Users\irko\eclipse-workspace1\myJbehave\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.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
Reports view generated with 2 stories (of which 0 pending) containing 1 scenarios (of which 0 pending)


注意:按照以下步骤安装JBehave Eclipse插件,该插件包含有用的
*。story
编辑器。

根据发布的错误:

“在本地存储库中缓存的中找不到org.wmaop:wm jbehave:jar:1.0.0,在经过central的更新间隔或强制更新之前,将不会重新尝试解析->[Help 1]。”


project似乎需要强制maven更新来解决丢失的工件。只需右键单击您的项目-->maven-->更新项目。确保选中“快照/发布的强制更新”。

下面的maven依赖项和存储库条目用于编译基于的示例maven项目


朱尼特
朱尼特
4.12
测试
org.wmaop
wm jbehave
1.1.1
测试
委托
工具箱
com.softwareag.webmethods
wm isserver
com.softwareag.webmethods
wm isclient
bintray.io
https://dl.bintray.com/wmaop/maven
请注意,本教程还需要额外的设置来运行HelloWorld story


使用简单的jbehave maven原型来遵循@krokodilko提供的答案可能会更容易。

只是添加它不起作用,添加后更新项目也不起作用,也不进行构建。我需要做些什么来强制获取吗?看起来你必须自己构建它。记住也要包含父pom。我如何包含父pom?这是我使用Maven的第一天…你只需要在Eclipse中学习吗?还是需要使用来运行JBehave故事?你所有的问题都来自缺少WM-AOP库,也许最好是在不增加WM-AOM框架复杂性的情况下单独开始学习JBehave?JBehave不需要WM-AOP库_AOM,它可以在许多框架上运行,即使没有任何框架,也可以通过命令行运行。我习惯于使用Cucumber和Ruby进行BDD。基本上,我想要一个类似的Java环境,JBehave似乎是最有可能的候选(Eclipse是我首选的IDE)。我的问题很简单,就是我无法让安装说明正常工作-我甚至不确定WM-AOP适用于何处,只是我收到的错误消息中提到了它。添加repo没有任何区别。遵循本地构建说明给了我一个熟悉的错误:[错误]项目org.wmaop:WM jbehave:1.0.0(C:\Users\digit\Desktop\jbehave\wm jbehave\pom.xml)有1个错误[错误]org.wmaop:wm jbehave:1.0.0:无法在本地存储库中缓存org.wmaop:wm parent:POM:1.0.5中找到不可解析的父POM,在经过中心更新间隔或强制更新且“parent.relativePath”指向错误的本地POM@第8行第10列之前,将不会重新尝试解析vm jbehaven的1.0.0版本,或者您可以尝试其他版本吗?如果
import org.jbehave.core.annotations.Alias;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;

public class MySteps {

    @Given("I am a pending step")
    @Alias("I am still pending step")
    public void given_i_am_pending_step() {

        System.out.println("Tihis is implementation of GIVEN");
    }

    @When("a good soul will implement me")
    public void when_a_good_soul_will_implement_me() {
        System.out.println("Tihis is implementation of WHEN");
    }

    @Then("I shall be happy")
    public void then_i_shall_be_happy() {
        System.out.println("Tihis is implementation of THEN");
    }
}
Processing system properties {}
Using controls EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=true,verboseFailures=false,verboseFiltering=false,storyTimeouts=60,threads=2,failOnStoryTimeout=false]

(BeforeStories)
Running story org/example/myJbehave/stories/my.story
Tihis is implementation of GIVEN
Tihis is implementation of GIVEN
Tihis is implementation of WHEN
Tihis is implementation of THEN

(org/example/myJbehave/stories/my.story)
Scenario: A scenario with some pending steps
Given I am a pending step
And I am still pending step
When a good soul will implement me
Then I shall be happy



(AfterStories)
Generating reports view to 'C:\Users\irko\eclipse-workspace1\myJbehave\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.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
Reports view generated with 2 stories (of which 0 pending) containing 1 scenarios (of which 0 pending)
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.wmaop</groupId>
        <artifactId>wm-jbehave</artifactId>
        <version>1.1.1</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>com.entrust</groupId>
                <artifactId>toolkit</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.softwareag.webmethods</groupId>
                <artifactId>wm-isserver</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.softwareag.webmethods</groupId>
                <artifactId>wm-isclient</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>bintray.io</id>
        <url>https://dl.bintray.com/wmaop/maven</url>
    </repository>
</repositories>