我需要自定义工件安装,并且无法弄清楚如何覆盖默认工件(来自默认的 Maven 生命周期)。所以我的问题是:
如何在我的 pom.xml 中配置 Maven 安装插件,以便它不执行默认安装并仅执行我的自定义安装文件目标?
我试过没有 id 和默认安装 http://maven.apache.org/guides/mini/guide-default-execution-ids.htmlid 并没有帮助。
Update:从提供的答案来看 - 这对我不起作用(我在日志中看到两次安装尝试)。
<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>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>install-jar-lib</id>
<goals>
<goal>install-file</goal>
</goals>
<phase>install</phase>
<configuration>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
<generatePom>false</generatePom>
<pomFile>pom.xml</pomFile>
<packaging>jar</packaging>
<version>${unicorn.version}</version>
</configuration>
</execution>
</executions>
</plugin>
禁用maven-install-plugin
:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>default-install</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
以及执行您的自定义安装目标:
<build>
<plugins>
<plugin>
<groupId>yourGroupId</groupId>
<artifactId>yourArtifactId</artifactId>
<executions>
<execution>
<id>custom-install</id>
<phase>install</phase>
<goals>
<goal>yourGoal</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)