如何使用maven-install-plugin排除jar文件的安装?

时间:2015-10-06 06:29:27

标签: maven jar maven-jar-plugin maven-install-plugin

我有一个使用maven-jar-plugin创建的jar文件。

有没有办法跳过这个jar文件安装在存储库中?

提前致谢。

1 个答案:

答案 0 :(得分:1)

Try this:

<build>
  <plugins>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-install-plugin</artifactId>
       <version>2.5.2</version>
       <configuration>
         <skip>true</skip>
       </configuration>
     </plugin>
  </plugins>
</build>

The reason this works is that the install plugin's only job is to take your artifact(s) and install them in your local repo.

In Maven, there are main artifacts and attached artifacts. I am not sure if you can suppress installation of the main artifact and only install the attached artifact, since assemblies are not required to provide a POM.

If this is what you really want to achieve, I would suggest breaking out the assembly to a separate artifact (with <packaging>pom</packaging>), have it depend on the jar-artifact you are trying to exclude and simply install that.