我已经使用maven一段时间以常见的方式开箱即用,所以我明白它是什么,但我是maven设置中的新手.
我需要组织这样的工作流程:
我知道如何做到这一点:
我的问题是:如何在文件系统上使用简单目录作为某些项目的代理存储库?请告诉我如何实现这个想法或给我另一个想法来实现这样的工作流程.
我可以提交本地存储库,但有一些限制:
我通过在repo url中编写"file:// testRespoDir"来测试本地目录以部署项目,但是我无法理解如何使这个目录代理项目的所有远程工件(项目必须不使用本地存储并且只使用公共目录.
I found simple and perfect solution: POM include 2 repositories:
<repositories>
<repository>
<id>commonDep</id>
<name>common dependency</name>
<url>file://../common/repository</url>
</repository>
<!-- it used when collect dependencies before commit. If developer already download dependency, get it from local repo, save traffik and time -->
<repository>
<id>localPlugins</id>
<name>local plugins</name>
<url>file://${user.home}/.m2/repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>commonDep</id>
<name>common dependency</name>
<url>file://../common/repository</url>
</pluginRepository>
<!-- it used when collect dependencies before commit. If developer already download dependency, get it from local repo, save traffik and time -->
<pluginRepository>
<id>localPlugins</id>
<name>local plugins</name>
<url>file://${user.home}/.m2/repository</url>
</pluginRepository>
</pluginRepositories>
Run Code Online (Sandbox Code Playgroud)
when developer opens project, he use local, common and central repositories in such order. It saves his traffic. When he finished work, he call script:
mvn dependency:go-offline -Dmaven.repo.local=../common/repository
Run Code Online (Sandbox Code Playgroud)
all current dependencies of project copyed from his default local repository to common repository. Then developer commit common.
When we run build on teamcity, we checkout project and common and run it. There is no internet connection, but all dependencies exist in common repository.
归档时间: |
|
查看次数: |
7528 次 |
最近记录: |