当我开始验证时出现 Maven 依赖错误

maven dependency error when i start verify

我是 Maven 的新手,正在尝试在 IntelliJ IDEA 上使用 jbehave、maven 和 thucydides 创建我的第一个 bdd 测试。当我尝试在 Maven 面板上单击“验证”时,我收到错误消息。

我该如何解决这个问题?提前致谢!

Apache Maven 3.3.9

错误信息

C:\Program Files\Java\jdk1.8.0_101\bin\java""-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition2016.2.4\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2016.2.4\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7537 " - Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2016.2.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2016.2.4\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2016.2.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher  -Didea.version=2016.2.4 verify

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ---------------------------------------------------------------------
[INFO] Building Sample Thucydides project 1.0-SNAPSHOT
[INFO] ---------------------------------------------------------------------
[INFO] ---------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
[INFO] Total time: 1.600s
[INFO] Finished at: Fri Sep 23 10:36:29 AST 2016
[INFO] Final Memory: 6M/16M
[INFO] ---------------------------------------------------------------------
[ERROR] Failed to execute goal on project bddtest: Could not resolve dependencies for project com.rostislavberezhnoy.bddtest:bddtest:jar:1.0- SNAPSHOT: Could not find artifact com.rostislavberezhnoy.bddtest:bddtest:jar:1.0-SNAPSHOT -> [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

Process finished with exit code 1

我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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.rostislavberezhnoy.bddtest</groupId>
<artifactId>bddtest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Sample Thucydides project</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <thucydides.version>0.9.268</thucydides.version>
    <thucydides.jbehave.version>0.9.268</thucydides.jbehave.version>
    <webdriver.driver>firefox</webdriver.driver>
</properties>

<dependencies>
    <dependency>
        <groupId>net.thucydides</groupId>
        <artifactId>thucydides-core</artifactId>
        <version>${thucydides.version}</version>
    </dependency>
    <dependency>
        <groupId>net.thucydides</groupId>
        <artifactId>thucydides-junit</artifactId>
        <version>${thucydides.version}</version>
    </dependency>
    <dependency>
        <groupId>net.thucydides</groupId>
        <artifactId>thucydides-jbehave-plugin</artifactId>
        <version>${thucydides.jbehave.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.googlecode.lambdaj</groupId>
        <artifactId>lambdaj</artifactId>
        <version>2.3.3</version>
    </dependency>
    <dependency>
        <groupId>com.rostislavberezhnoy.bddtest</groupId>
        <artifactId>bddtest</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.11</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.11</version>
            <configuration>
                <includes>
                    <include>**/*Test.java</include>
                    <include>**/Test*.java</include>
                    <include>**/When*.java</include>
                    <include>**/*TestSuite.java</include>
                </includes>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9</version>
        </plugin>
        <plugin>
            <groupId>net.thucydides.maven.plugins</groupId>
            <artifactId>maven-thucydides-plugin</artifactId>
            <version>${thucydides.version}</version>
            <executions>
                <execution>
                    <id>thucydides-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<profiles>
    <profile>
        <id>maven2</id>
        <activation>
            <file>
                <missing>${basedir}</missing>
            </file>
        </activation>
        <reporting>
            <plugins>
                <plugin>
                    <groupId>net.thucydides.maven.plugins</groupId>
                    <artifactId>maven-thucydides-plugin</artifactId>
                    <version>${thucydides.version}</version>
                </plugin>
            </plugins>
        </reporting>
    </profile>
    <profile>
        <id>maven3</id>
        <activation>
            <file>
                <exists>${basedir}</exists>
            </file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <reportPlugins>
                            <plugin>
                                <groupId>net.thucydides.maven.plugins</groupId>
                                <artifactId>maven-thucydides-plugin</artifactId>
                                <version>${thucydides.version}</version>
                            </plugin>
                        </reportPlugins>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

Could not find artifact com.rostislavberezhnoy.bddtest:bddtest:jar:1.0-SNAPSHOT -> [Help 1]

如果你使用私有mvn repo,你需要先安装到你的本地或者部署到你的maven repo。

可以参考this安装jar文件

你的问题是你指的是

<dependency>
    <groupId>com.rostislavberezhnoy.bddtest</groupId>
    <artifactId>bddtest</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

没有找到。

它似乎与您的 Maven 构建将要创建的工件同名。

也就是说,你是从你的 pom.xml 中引用你自己。我会考虑重新建立这种依赖关系并再次 运行 。很可能有人引入了这种依赖关系。