【发布时间】:2017-08-21 19:05:03
【问题描述】:
我安装了一个无法通过 maven Central 获得的本地工件:
mvn install:install-file -Dfile=/app/x/ema.jar -DgroupId=org.x -DartifactId=elektron -Dversion=3.0.4 -Dpackaging=jar
本地存储库现在具有以下结构:
user@server:~/.m2/repository/org/x/elektron/3.0.4# ll
total 592
drwxr-xr-x 2 root root 4096 Mar 28 11:43 ./
drwxr-xr-x 3 root root 4096 Mar 28 11:43 ../
-rw-r--r-- 1 root root 588185 Dec 9 20:12 elektron-3.0.4.jar
-rw-r--r-- 1 root root 463 Mar 28 11:43 elektron-3.0.4.pom
-rw-r--r-- 1 root root 175 Mar 28 11:43 _remote.repositories
elektron-3.0.4.pom的内容是:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.x</groupId>
<artifactId>elektron</artifactId>
<version>3.0.4</version>
<description>POM was created from install:install-file</description>
</project>
我的 pom 有以下依赖:
<dependency>
<groupId>org.x</groupId>
<artifactId>elektron</artifactId>
<version>3.0.4</version>
</dependency>
当我通过 Jenkins 构建时,我收到以下错误:
[WARNING] The POM for org.x:elektron:jar:3.0.4 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.253 s
[INFO] Finished at: 2017-03-28T11:35:27-04:00
[INFO] Final Memory: 17M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ampere: Could not resolve dependencies for project y:ampere:jar:0.1.8-SNAPSHOT: Failure to find org.x:elektron:jar:3.0.4 in https://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
我已经尝试过推荐的解决方案(删除/重新安装、删除 *.repositories 文件),但似乎都不起作用。
有什么想法吗?
【问题讨论】:
-
你试过 mvn clean install 吗?你的jar文件也有用户root,你所有的其他jar都有相同的用户吗?可能是用户角色访问问题
-
嗯.. mvn clean install 从命令行工作。看起来这是一个詹金斯问题?
-
您将其安装为“用户”而不是“jenkins”,因此 Jenkins 无法找到它。