最佳答案
我在 setings.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>
所有的存储库,但是大多数时候在中心(repo1)中找到工件。我想让玛文先检查一下这个回购协议。我尝试了 setings.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"
我的 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>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>s1-3rdParty</id>
<name>System One 3rd Party Releases</name>
<url>http://some.server/mvn2repo/3rdParty</url>
</repository>
<repository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>space</activeProfile>
</activeProfiles>