gpt4 book ai didi

java - 如何设置Maven依赖的URL

转载 作者:太空宇宙 更新时间:2023-11-04 14:09:01 24 4
gpt4 key购买 nike

启动后出现以下错误mvn clean install vagrant:up:

Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/avalon/framework/avalon-framework-api/4.2.0/avalon-framework-api-4.2.0.pom
[INFO] Unable to find resource 'org.apache.avalon.framework:avalon-framework-api:pom:4.2.0' in repository snapshot-repository (https://oss.sonatype.org/content/repositories/snapshots)
Downloading: http://central.maven.org/maven2/org/apache/avalon/framework/avalon-framework-api/4.2.0/avalon-framework-api-4.2.0.pom
[INFO] Unable to find resource 'org.apache.avalon.framework:avalon-framework-api:pom:4.2.0' in repository Avalon-repo (http://central.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/apache/avalon/framework/avalon-framework-api/4.2.0/avalon-framework-api-4.2.0.pom
[INFO] Unable to find resource 'org.apache.avalon.framework:avalon-framework-api:pom:4.2.0' in repository central (http://repo1.maven.org/maven2)
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/apache/avalon/framework/avalon-framework-impl/4.2.0/avalon-framework-impl-4.2.0.pom
[INFO] Unable to find resource 'org.apache.avalon.framework:avalon-framework-impl:pom:4.2.0' in repository snapshot-repository (https://oss.sonatype.org/content/repositories/snapshots)
Downloading: http://central.maven.org/maven2/org/apache/avalon/framework/avalon-framework-impl/4.2.0/avalon-framework-impl-4.2.0.pom
[INFO] Unable to find resource 'org.apache.avalon.framework:avalon-framework-impl:pom:4.2.0' in repository Avalon-repo (http://central.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/apache/avalon/framework/avalon-framework-impl/4.2.0/avalon-framework-impl-4.2.0.pom
[INFO] Unable to find resource 'org.apache.avalon.framework:avalon-framework-impl:pom:4.2.0' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Unable to get dependency information: Error in metadata for artifact 'rubygems:vagrant:gem': Unable to parse version '[0.5.2,0.5.2.0.0.0.0.1)' for dependency 'rubygems:archive-tar-minitar:gem': Range defies version ordering: [0.5.2,0.5.2.0.0.0.0.1)
rubygems:vagrant:gem:1.0.7

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
rubygems (http://rubygems-proxy.torquebox.org/releases),
snapshot-repository (https://oss.sonatype.org/content/repositories/snapshots),
Avalon-repo (http://central.maven.org/maven2)

Path to dependency:
1) downloader:downloader:jar:0.0.1-SNAPSHOT
2) net.ju-n.maven.plugins:vagrant-maven-plugin:maven-plugin:1.0.1

我搜索了这个依赖项,并在另一个 URL 中找到了它,但我不知道如何设置它。我不想手动下载 jar,因为我们使用的是 Jenkins,而我无权访问该存储库。

有谁知道怎么解决吗?

谢谢!!

附注我的 pom.xml 是(部分):

<dependency>
<groupId>net.ju-n.maven.plugins</groupId>
<artifactId>vagrant-maven-plugin</artifactId>
<version>1.0.1</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>de.saumya.mojo</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>1.0.7</version>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
<version>4.2.0</version>
<optional>true</optional>
</dependency>

更新1:我的 pom.xml 中有以下存储库:

<repositories>      
<repository>
<id>snapshot-repository</id>
<name>Maven2 Snapshot Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>

<repository>
<id>Avalon-repo</id>
<url>http://central.maven.org/maven2</url>
</repository>
</repositories>

Update2:Maven在http://repo1.maven.org/maven2/org/apache/avalon/framework/avalon-framework-impl/4.2.0/avalon-framework-impl-4.2.0.pom中寻找依赖的问题,但正确的 URL 是:https://repo1.maven.org/maven2/avalon-framework/avalon-framework-api/4.2.0/avalon-framework-api-4.2.0.pom

最佳答案

您的 .m2 文件夹下有一个 settings.xml。您必须在此处添加存储库,如下所示:

</repository>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>

关于java - 如何设置Maven依赖的URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28562684/

24 4 0
文章推荐: javascript - JQuery IE
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com