2

I'm using maven-shade-plugin to create an additional jar with all my dependencies. The shade phase is linked to the package phase, so my jar-with-dependencies is created everytime I do a mvn package.

However, I do not want this jar-with-dependencies to be deployed to Nexus during mvn deploy. How can I avoid this?

sam33r
  • 25
  • 6
  • Why are you creating a supplemental artifact via maven-shade but don't like to get it deployed ? – khmarbaise Jun 11 '13 at 10:52
  • We need it during runtime. Like you suggested, a _runtime_ profile might be the right thing to do. Let me try it out. – sam33r Jun 11 '13 at 17:08

2 Answers2

3

The best solution for such purpose is to put the maven-shade-plugin configuration into a profile which is not activated during the deploy phase.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
1

Driven by the same necessity I've forked the maven-deploy-plugin plugin from GitHub doing changes in order to exclude a specific attached artifact from deploy as follow:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-deploy-plugin</artifactId>
  <version>3.0.0-SNAPSHOT</version>
  <configuration>
    <skipAttachedArtifacts>
      <artifact>
        <groupId>com.sample</groupId>
        <artifactId>something</artifactId>
        <version>${project.version}</version>
        <packaging>jar</packaging>
        <classifier>shaded</classifier>
      </artifact>
    </skipAttachedArtifacts>
  </configuration>
</plugin>

Currently using the maven-deploy-plugin plugin with skip parameter set to true all artifacts are excluded from deploy while target here is to exclude only a specific one from the attached ones. On my fork I've introduced the skipAttachedArtifacts configuration parameter in order to specify attached artifacts to exclude from deploy.

Here is the link on my forked project on GitHub: https://github.com/gregorycallea/maven-deploy-plugin

Here the link instead to the pull request I've submitted on apache plugin project: https://github.com/apache/maven-deploy-plugin/pull/3

gregorycallea
  • 1,218
  • 1
  • 9
  • 28