Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JBehave依赖项在central maven repo中不可用?_Java_Maven_Jbehave - Fatal编程技术网

Java JBehave依赖项在central maven repo中不可用?

Java JBehave依赖项在central maven repo中不可用?,java,maven,jbehave,Java,Maven,Jbehave,从maven central repo search.maven.org访问jbehave Dependences比我预期的要困难得多 我想抓住你 使用我通常使用的方法,即将依赖项代码粘贴到pom的依赖项部分。还有其他人有这个问题吗 当然。。错误消息 [ERROR] Failed to execute goal on project XXXXX: Could not resolve dependencies for project XXXXX: Failure to find org.jbeha

从maven central repo search.maven.org访问jbehave Dependences比我预期的要困难得多

我想抓住你

使用我通常使用的方法,即将依赖项代码粘贴到pom的依赖项部分。还有其他人有这个问题吗

当然。。错误消息

[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
我已经尝试使用mvn clean install-U强制依赖项,但没有效果

根据大众的要求,它可能需要一些整理,但这是我的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>

您已经设置了一个jar依赖项,它是org.jbehave:jbehave的默认类型,但是该工件只发布了一个pom类型的工件

依赖项应如下所示:

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

<dependency>
    <groupId>org.jbehave</groupId>
    <artifactId>jbehave</artifactId>
    <version>4.0</version>
</dependency>
包括:

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

检查maven现在是否解决了您的问题。

我觉得我必须重新回答这个问题,因为下面的答案实现了目标,而其他答案都没有。下面是一个适用于JBehave的pom示例。jbehave核心似乎至关重要。我可以选择使用jbehave-gherkin,它允许我用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>

你需要发布你的pom文件谢谢。我已经试过了。结果是:[错误]未能在项目XXXXX上执行目标:无法解析项目com的eDependencies。myproject:0.0.1-快照:无法解析以下工件:org.jbehave:jbehave Distribution:jar:4.0,com.google.gdata:gdata java client:jar:1.40.0.atlassian-2:Fa ilure要查找org.jbehave:jbehave分发:jar:4.0(在he.org/maven2中)已缓存在本地存储库中,在经过central的更新间隔或强制更新之前,不会重新设置解析->[Help 1][错误]。这对你有用吗?有两种可能。首先是清除本地repo中的jbehave目录,并使用mvn clean install。第二:使用mvn clean install-U。试一试哪一个对你有帮助。这是正确的答案,因为它让依赖关系为我工作。谢谢:就JBehave本身而言,它似乎没有提供我所需要的,所以我想知道我是否试图下载错误的依赖项!在接下来的几天里,我会再看一次,看看我能做到什么。