Sanchit Nagpal
Sanchit Nagpal

Reputation: 151

how to exclude jar file from getting installed using maven-install-plugin?

I have a jar file created using maven-jar-plugin.

Is there a way to skip this jar file from getting installed in repository?

Thanks in advance.

Upvotes: 2

Views: 2425

Answers (1)

Daniel
Daniel

Reputation: 4211

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.

Upvotes: 1

Related Questions