Dar*_*añé 63 dependencies maven-2
在具有多个依赖项和存储库的项目中,Maven用于下载依赖项的try-and-error方法有点麻烦且速度慢,所以我想知道是否有任何方法可以为某些声明的依赖项设置特定的repo.
例如,我想让bouncycastle直接在http://repo2.maven.org/maven2/org/bouncycastle/上检查BouncyCastle的Maven回购,而不是官方的Maven.
我已将库从第3方存储库移至其自己的项目,并将此项目作为基础模块的第一个模块包括在内:
base / pom.xml
...
<modules>
<module>thirdparty</module>
<module>mymodule</module>
...
</modules>
Run Code Online (Sandbox Code Playgroud)
base / thirdparty / pom.xml:
...
<artifactId>thirdparty</artifactId>
<packaging>pom</packaging>
<repositories>
<repository>
<id>First thirdparty repository</id>
<url>https://...</url>
</repository>
...
</repositories>
<dependencies>
<dependency>
<!-- Dependency from the third party repository -->
</dependency>
....
</dependencies>
Run Code Online (Sandbox Code Playgroud)
base / mymodule / pom.xml:
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>thirdparty</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
...
</dependencies>
Run Code Online (Sandbox Code Playgroud)
这将确保在根项目建立后立即将第三方存储库中的库下载到本地存储库中。对于所有其他依赖性,存储库不可见,因此在下载时不包括在内。