我在settings.xml中有3个存储库,因为我需要来自所有存储库的工件.每当找不到依赖项时,Maven就会尝试
Downloading: http://some.server/mvn2repo/releases/org/apache/lucene/lucene-core/2.9.1/...
[INFO] Unable to find resource 'org.apache.lucene:lucene-core:pom:2.9.1' in repository
Downloading: http://some.server/mvn2repo/3rdParty/org/apache/lucene/lucene-core/2.9.1/...
[INFO] Unable to find resource 'org.apache.lucene:lucene-core:pom:2.9.1' in repository
Downloading: http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.9.1/lucene-core-2.9.1.pom
<success>
Run Code Online (Sandbox Code Playgroud)
所有存储库,但大多数时候在中心(repo1)找到工件.我希望Maven先检查这个回购.我在settings.xml中尝试了声明顺序,但是没有用.根据fgysin,我也尝试了相反的顺序,它没有改变任何东西.
我的Maven版本:
C:\>mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.6.0_15
Java home: C:\Program Files\Java\jdk1.6.0_15\jre
Default locale: de_AT, platform encoding: Cp1252
OS name: "windows vista" version: "6.0" arch: "amd64" Family: "windows"
Run Code Online (Sandbox Code Playgroud)
我的 settings.xml
<profiles>
<profile>
<id>space</id>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>s1-releases</id>
<name>System One Releases</name>
<url>http://some.server/mvn2repo/releases</url>
</repository>
<repository>
<releases> …Run Code Online (Sandbox Code Playgroud) 抱歉,描述太长:
背景:我有 2 个项目,假设 A 和 B。在项目 A 中构建,部署到 Nexus Repository Manager OSS 2.12.0 存储库 A,在项目 B 中构建,部署到 Nexus 存储库 B。我的 maven 项目需要使用两个项目中的 .jar回购 A 和回购 B。
因此,我将 maven.settings 文件配置为使用 2 个不同的 Nexus 存储库(有 2 个镜像)。
现在,我看到当我编译我的maven项目时,它将通过repo A,搜索jar,然后通过repo B,搜索jar。当它找到 jar 时,它将下载它。
问题:我曾经将 Repo B 用于项目 A 和项目 B 的 jar(repo 的所有者将我踢出了)。因此,我现在在存储库 A 和存储库 B 中都拥有相同的组件 0.0.1-SNAPSHOT。
Maven 现在会在编译期间下载这两个快照。
问题:如果两个 .jar 具有相同的名称(例如:componentName-0.0.1-SNAPSHOT),maven 如何解析要使用哪个 .jar?我看到在我的本地 ./m2 存储库中,有一个解析器状态文件,但我不确定它如何在两个 jar 之间解析。理想情况下,我希望 Maven 使用最近更新的(基于时间戳)jar。