2

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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the solution. But it will skip the whole installation.
I have some other files like zip to be installed and I really want zip to be installed along with pom.xml.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.