我安装了一个通过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文件),但似乎都没有。
有什么想法吗?
答案 0 :(得分:0)
查看我的Jenkins .m2回购时,它包含以下内容:
user@server:/var/lib/jenkins/.m2/repository/org/x/elektron/3.0.4# ll
total 596
drwxr-xr-x 2 jenkins jenkins 4096 Mar 28 12:03 ./
drwxr-xr-x 3 jenkins jenkins 4096 Mar 24 15:23 ../
-rw-r--r-- 1 jenkins jenkins 244 Mar 28 11:23 elektron-3.0.4.jar.lastUpdated
-rw-r--r-- 1 jenkins jenkins 244 Mar 28 11:23 elektron-3.0.4.pom.lastUpdated
我手动添加了以下两个文件,它起作用了:
-rw-r--r-- 1 root root 588185 Mar 28 12:03 elektron-3.0.4.jar
-rw-r--r-- 1 root root 463 Mar 28 12:03 elektron-3.0.4.pom
答案 1 :(得分:0)
您还可以尝试命令mvn clean install -U
,这将允许您下载或强制更新本地存储库,该存储库将从远程存储库下载并复制到您的本地存储库。