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?

有帮助吗?

解决方案

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.

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top