Зависимости JBehave недоступны в центральном репозитории maven?

У меня больше трудностей, чем я ожидал, с доступом к зависимостям jbehave из центрального репозитория maven (search.maven.org).

я пытаюсь схватить

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

используя метод, который я обычно использую, который заключается в том, чтобы вставить код зависимости в раздел зависимостей моего файла 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, но безрезультатно.

И по многочисленным просьбам (вероятно, нуждается в некоторой уборке), но вот моя помпа:

<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>

person John Deverall    schedule 06.06.2015    source источник
comment
Вам нужно опубликовать свой файл pom   -  person K Erlandsson    schedule 06.06.2015


Ответы (3)


Вместо:

<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 вашу проблему.

person Paweł Głowacz    schedule 06.06.2015
comment
Спасибо. Я пробовал уже. Результат: [ОШИБКА] Не удалось выполнить цель проекта XXXXX: не удалось разрешить зависимости для проекта com.myproject:0.0.1- SNAPSHOT: не удалось разрешить следующие артефакты: org.jbehave:jbehave-distribution:jar:4.0 , com.google.gdata:gdata-java-client:jar:1.40.0.atlassian-2: не удалось найти org.jbehave:jbehave-distribution:jar:4.0 в repo.maven.apac he.org/maven2 был кэширован в локальном репозитории, повторная попытка разрешения не будет предприниматься до тех пор, пока не истечет интервал обновления центрального хранилища или не будут принудительно обновлены -› [Справка 1] [ОШИБКА]. Работает ли это для вас? - person John Deverall; 06.06.2015
comment
Есть 2 возможности. Во-первых, очистить каталоги jbehave в локальном репозитории и использовать mvn clean install. Второе: используйте mvn clean install -U. Попробуйте, какой из них поможет вам. - person Paweł Głowacz; 06.06.2015

Вы установили зависимость jar (это тип по умолчанию) на org.jbehave:jbehave, но у этого артефакта опубликован только артефакт типа pom.

Зависимость должна выглядеть так:

    <dependency>
        <groupId>org.jbehave</groupId>
        <artifactId>jbehave</artifactId>
        <version>4.0</version>
        <type>pom</type>
    </dependency>
person K Erlandsson    schedule 06.06.2015
comment
Это правильный ответ, так как у меня работает зависимость. Спасибо :) С точки зрения самого JBehave, похоже, он не содержит того, что мне нужно, поэтому мне интересно, пытался ли я загрузить неправильную зависимость! Я еще раз взгляну на него в ближайшие несколько дней и посмотрю, куда я доберусь. - person John Deverall; 07.06.2015

Я чувствовал, что должен повторно ответить на этот вопрос, потому что следующее достигает цели, тогда как ни один из других ответов не делает этого. Ниже приведен пример pom, который работает для JBehave. jbehave-core кажется важным. Я дополнительно использую 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>
person John Deverall    schedule 02.09.2015