如果我已经在 repo 中安装了这个版本,如何在 Maven 构建中跳过安装阶段 [英] How to skip install phase in Maven build if I already have this version installed in repo
问题描述
我有一个包含 3 个不同库的项目.当我运行安装脚本时,它会从 repo 中获取所有库并在它们上运行 mvn clean install.但是这个版本的库已经安装在 repo 中.如果 pom.xml 中的版本与我本地存储库中的版本相同,有没有办法跳过安装阶段.
I have a project that consist of 3 different libraries. When I run install script it takes all libraries from repo and run mvn clean install on them. But this version of library already installed in repo. Is there a way to skip install phase if version in pom.xml equal version in my local repo.
我知道我可以使用本地存储库并设置依赖项.但是我的老板希望我们的项目只能使用公共存储库构建,而没有任何我们的存储库.
I know that I can use local repo and just set dependencies. But my boss want that our project can build only with public repos and without any our repos.
推荐答案
可以这样绕过
-Dmaven.install.skip=true
<小时>
<profiles>
<profile>
<id>skipInstall</id>
<activation>
<property>
<name>maven.install.skip</name>
<value>true</value>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
上周 Olivier Lamy 修补了这个 jira.
Last week Olivier Lamy patched this jira.
这篇关于如果我已经在 repo 中安装了这个版本,如何在 Maven 构建中跳过安装阶段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!