简体   繁体   English

JBehave依赖项在中央Maven存储库中不可用?

[英]JBehave dependencies not available in central maven repo?

I'm having more difficulty than I expected accessing jbehave dependecies from the maven central repo (search.maven.org). 我要比从Maven中央存储库(search.maven.org)访问jbehave有更多的困难。

I'm trying to grab 我想抢

http://search.maven.org/#artifactdetails%7Corg.jbehave%7Cjbehave-distribution%7C4.0%7Cpom http://search.maven.org/#artifactdetails%7Corg.jbehave%7Cjbehave-distribution%7C4.0%7Cpom

using the method I normally use, which is to paste the dependency code into the dependencies section of my pom. 使用我通常使用的方法,即将依赖项代码粘贴到pom的依赖项部分中。 Is anyone else having this trouble? 还有其他人遇到麻烦吗?

And of course.. the error message 当然,..错误消息

[ERROR] Failed to execute goal on project XXXXX: Could not resolve dependencies for project XXXXX: Failure to find org.jbehave:jbehave:jar:4.0 in http://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]
[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/DependencyResolutionException

I have tried forcing dependencies already using mvn clean install -U but to no avail. 我已经尝试使用mvn clean install -U来强制依赖,但无济于事。

And by popular request (it probably needs some tidying up) but here is my pom: 并应大众的要求(可能需要整理一下),但这是我的pom:

<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.myproject</groupId>
    <artifactId>XXXXX</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>XXXXX</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>neo4j</artifactId>
            <version>2.2.0</version>
        </dependency>

        <!-- Neo4j Test Scoped Dependencies -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>neo4j-kernel</artifactId>
            <version>2.2.0</version>
            <type>test-jar</type>
        </dependency>
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>neo4j-io</artifactId>
            <version>2.2.0</version>
            <type>test-jar</type>
        </dependency>
        <dependency>
            <groupId>org.jbehave</groupId>
            <artifactId>jbehave</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>

        <!-- Apache Commons -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <!-- The part of spring social that provides serialised data for persisting 
            to a database. To quote from http://docs.spring.io/spring-social/docs/1.0.x/reference/html/serviceprovider.html 
            "Finally, the internal state of a connection can be captured for transfer 
            between layers of your application by calling createData(). This could be 
            used to persist the connection in a database, or serialize it over the network." 
            In reality, we transfer more than the connection. Because of how dependant 
            the Connection object api is on the rest of spring social, we must bring 
            in the whole dependency. -->
        <dependency>
            <groupId>org.springframework.social</groupId>
            <artifactId>spring-social-core</artifactId>
            <version>1.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-crypto</artifactId>
            <version>3.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.jasypt</groupId>
            <artifactId>jasypt</artifactId>
            <version>1.9.2</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-json-org</artifactId>
            <version>2.5.0</version>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.4.7</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security.oauth</groupId>
            <artifactId>spring-security-oauth2</artifactId>
            <version>2.0.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.1.3.Final</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>3.0.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Code coverage mojo for EmmaEcl -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.5.201505241946</version>
                <executions>
                    <!-- Prepares the property pointing to the JaCoCo runtime agent which 
                        is passed as VM argument when Maven the Surefire plugin is executed. -->
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                            <!-- Sets the name of the property containing the settings for JaCoCo 
                                runtime agent. -->
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <!-- Ensures that the code coverage report for unit tests is created 
                        after unit tests have been run. -->
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the path to the file which contains the execution data. -->
                            <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                            <!-- Sets the output directory for the code coverage report. -->
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.15</version>
                <configuration>
                    <!-- Sets the VM argument line used when unit tests are run. -->
                    <argLine>${surefireArgLine}</argLine>
                    <!-- Skips unit tests if the value of skip.unit.tests property is true -->
                    <skipTests>${skip.unit.tests}</skipTests>
                    <!-- Excludes integration tests when unit tests are run. -->
                    <excludes>
                        <exclude>**/IT*.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.myproject.Main</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

You have set up a jar dependency (that is the default type) to org.jbehave:jbehave but that artifact does only have an artifact of type pom published. 您已经为org.jbehave:jbehave设置了jar依赖项(这是默认类型),但是该工件只发布了pom类型的工件。

The dependency should look like this: 依赖关系应如下所示:

    <dependency>
        <groupId>org.jbehave</groupId>
        <artifactId>jbehave</artifactId>
        <version>4.0</version>
        <type>pom</type>
    </dependency>

Instead: 代替:

<dependency>
    <groupId>org.jbehave</groupId>
    <artifactId>jbehave</artifactId>
    <version>4.0</version>
</dependency>

include this: 包括以下内容:

<dependency>
    <groupId>org.jbehave</groupId>
    <artifactId>jbehave-distribution</artifactId>
    <version>4.0</version>
</dependency>

and check if maven now resolves yours problem. 并检查maven现在是否可以解决您的问题。

I felt I had to re-answer this because the following achieves the goal whereas neither of the other answers do. 我觉得我必须重新回答这个问题,因为以下内容可以达到目标,而其他答案都没有。 Below is an example pom that works for JBehave. 以下是适用于JBehave的示例pom。 jbehave-core seems essential. jbehave-core似乎很重要。 I am optionally using jbehave-gherkin which allows me to write my user scenarios in gherkin (seems like a cross framework language) rather than JBehave's own user scenario language. 我可以选择使用jbehave-gherkin,它允许我用小黄瓜(似乎是跨框架语言)而不是JBehave自己的用户场景语言编写用户场景。

<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.myapp.bdd</groupId>
    <artifactId>myapp-bdd</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>BDD Test POM Example</name>
    <description>BDD Tests</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>org.jbehave</groupId>
            <artifactId>jbehave-core</artifactId>
            <version>4.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.jbehave</groupId>
            <artifactId>jbehave-gherkin</artifactId>
            <version>4.0.3</version>
        </dependency>
    </dependencies>

</project>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM