Maven 从 Nexus 下载后找不到工件

Maven Could not find artifact after downloading from Nexus

我们遇到了问题。我在 jenkins 上设置了工作,并在构建项目时从 nexus 获取工件。但即使它下载了它们,作业也因找不到工件而失败。它只发生在我们手动导入到 nexus 的工件上。

有什么提示吗?

 [INFO] Downloading: http://xxx/nexus/content/groups/public/com/oracle/aqapi          /12.1.0.2/aqapi-12.1.0.2.pom
 [WARNING] The POM for com.oracle:aqapi:jar:12.1.0.2 is missing, no dependency information available
 [INFO] Downloading: http://xxx/nexus/content/groups/public/com/ibm/com.ibm.mq/7.1/com.ibm.mq-7.1.pom
 [WARNING] The POM for com.ibm:com.ibm.mq:jar:7.1 is missing, no dependency information available
 [INFO] Downloading: http://xxx/nexus/content/groups/public/com/ibm/com.ibm.dhbcore/7.1/com.ibm.dhbcore-7.1.pom
 [WARNING] The POM for com.ibm:com.ibm.dhbcore:jar:7.1 is missing, no dependency information available
 [INFO] Downloading: http://xxx/nexus/content/groups/public/com/oracle/aqapi/12.1.0.2/aqapi-12.1.0.2.jar
 [INFO] Downloading: http://xxx/nexus/content/groups/public/com/ibm/com.ibm.mq/7.1/com.ibm.mq-7.1.jar
 [INFO] Downloading: http://xxx/nexus/content/groups/public/com/ibm/com.ibm.dhbcore/7.1/com.ibm.dhbcore-7.1.jar
 Started calculate disk usage of build
 Finished Calculation of disk usage of build in 0 seconds
 Started calculate disk usage of workspace
 Finished Calculation of disk usage of workspace in 0 seconds
 ....
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.091s
[INFO] Finished at: Fri Dec 22 14:09:58 CET 2017
[INFO] Final Memory: 16M/491M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project XXX: Could not resolve dependencies for project YYY:jar:2.14.11: The following artifacts could not be resolved: com.oracle:aqapi:jar:12.1.0.2, com.ibm:com.ibm.mq:jar:7.1, com.ibm:com.ibm.dhbcore:jar:7.1: Could not find artifact com.oracle:aqapi:jar:12.1.0.2 in nexus (http://xxx/nexus/content/groups/public) -> [Help 1]
[ERROR]`

好像还没有下载完整,可以去~/.m2/repository查看依赖。 因为在实际情况下只显示"downloading"所以会出现downloaded message.

  1. 首先检查 n/w 设置和互联网。

  2. 如果 n/w 不是问题,请删除 ~/.m2 文件夹并重试一次

您看到 Nexus 中的依赖项了吗? nexus中的pom文件中的信息是否对应你的pom?

http://nexusUrl/nexus/content/repositories/central/checkstyle/checkstyle/4.1/checkstyle-4.1.pom

<?xml version="1.0"?>
<project>
                <modelVersion>4.0.0</modelVersion>
                <groupId>checkstyle</groupId>
                <artifactId>checkstyle</artifactId>
                <version>4.1</version>
                <dependencies>
                               ...
                </dependencies>
</project>

在你的 pom 中:

<dependency>
                <groupId>checkstyle</groupId>
                <artifactId>checkstyle</artifactId>
                <version>4.1</version>
</dependency>

并检查您的 Nexus 访问权限设置 (settings.xml)。