我有 Maven2 项目。除了一个之外的所有依赖项都是从公共存储库http://repo.maven.apache.org/maven2/下载的。
但我有 1 个依赖项,需要从内部公司的存储库下载(我们使用 Sonatype Nexus 来存储此依赖项)。
另外,我不想在我的内部存储库上创建公共存储库的完整副本。
此时我在 pom.xml 中有:
<url>http://maven.apache.org</url>
Run Code Online (Sandbox Code Playgroud)
和
<repositories>
<repository>
<id>thirdparty</id>
<url>http://<my_nexus_server_ip>:8081/nexus/content/repositories/thirdparty</url>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
因此,在构建过程中,我看到很多垃圾消息(在这种情况下,第一行是垃圾):
Downloading: http://<my_nexus_server_ip>:8081/nexus/content/repositories/thirdparty/ant/ant/1.6.5/ant-1.6.5.pom
Downloading: http://repo.maven.apache.org/maven2/ant/ant/1.6.5/ant-1.6.5.pom
Downloaded: http://repo.maven.apache.org/maven2/ant/ant/1.6.5/ant-1.6.5.pom (861 B at 3.2 KB/sec)
Run Code Online (Sandbox Code Playgroud)
我想清楚地指出 Maven 对于哪些依赖项必须使用内部存储库,而对于其他依赖项则忽略它(并指出对于其他依赖项,Maven2 必须使用公共存储库)。
你能帮忙在 Maven 中实现这样的行为吗?
提前致谢!
我有几个repos和很多依赖项.它在build.gradle中看起来像这样:
repositories {
maven {url "A"}
maven {url "B"}
}
dependencies {
compile 'libA'
compile 'libB'
compile 'libC'
}
Run Code Online (Sandbox Code Playgroud)
有没有办法如何指定我将从一个repo(A)下载libA,从另一个repo(B)下载libB和libC?