gpt4 book ai didi

java - Maven 找不到本地 Artifact

转载 作者:行者123 更新时间:2023-12-02 13:00:52 25 4
gpt4 key购买 nike

我安装了一个无法通过 Maven Central 使用的本地 Artifact :

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 文件),但似乎都不起作用。

有什么想法吗?

最佳答案

当查看我的 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

关于java - Maven 找不到本地 Artifact ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43074097/

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