gpt4 book ai didi

java - Maven 无法从源位置解析项目的依赖关系

转载 作者:行者123 更新时间:2023-11-29 08:44:39 25 4
gpt4 key购买 nike

我是 Maven 的新手,所以我不确定如何解决这个问题。

我正在尝试打包我的 maven 项目 (mvn clean package) 但我收到此错误:

Failed to execute goal on project TestSDK: Could not resolve dependencies for project com.company.idea.qe:qeTestSDK:jar:1.0-SNAPSHOT: Failure to find org.slf4j:slf4j-parent:jar:1.7.21 in http://nexus-proxy/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of Company-nexus has elapsed or updates are forced -> [Help 1]

我相信这是由 Maven 使用存储库值作为下载依赖项的唯一来源造成的。我需要它来下载 WebDriverBuilder Artifact 。作为 Maven 的新手,我不知道该怎么做。

我的 pom.xml 目前看起来像这样:

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<groupId>com.company.idea.qe</groupId>
<artifactId>qeTestSDK</artifactId>
<version>1.0-SNAPSHOT</version>

<repositories>
<repository>
<id>company-nexus</id>
<name>Compnay Nexus</name>
<url>http://nexus-proxy/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.company.tools</groupId>
<artifactId>WebDriverBuilder</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<!-- Gson: Java to Json conversion -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
<version>1.7.21</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
</build>

最佳答案

你的依赖应该是 sl4j-api 而不是 sl4j-parent

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>

关于java - Maven 无法从源位置解析项目的依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37259548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com