Can I modify the Maven deploy phase to replace the maven-deploy-plugin with my own plugin?

jbeck picture jbeck · Oct 5, 2012 · Viewed 8.5k times · Source

I'm pretty new to Maven...

What I'm trying to do is skip the maven-deploy-plugin during the deploy phase, while replacing it with my own plugin (i.e. I'm deploying to a non-repository location).

I realize I could do this in multiple other ways, but the boss wants to be able to run:

mvn deploy

To get the results of my current workaround, which is disabling the maven-deploy-plugin (which seems to be disabling the entire deploy phase), and manually specifying the custom upload goal from the command line.

I'm currently failing to succeed in my mission with:

<executions>
    <execution>
        <phase>deploy</phase>
    </execution>
</executions>

in the build/plugins/plugin section containing my plugin specification, since the deploy phase is skipped by:

        <plugin>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>

Thanks!

Answer

yegor256 picture yegor256 · Oct 8, 2012

disabling the maven-deploy-plugin (which seems to be disabling the entire deploy phase)

This is not correct. Disabling maven-deploy-plugin doesn't disable the entire deploy phase. This is how it should be done (looks like you're doing it already):

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
            <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </pluginManagement>
</build>