Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 629
jbeck Avatar asked Oct 05 '12 18:10

jbeck


People also ask

What is maven deploy phase?

The deploy plugin is primarily used during the deploy phase, to add your artifact(s) to a remote repository for sharing with other developers and projects. This is usually done in an integration or release environment.

What is the purpose of the deploy plugin for Apache Maven?

The only reason to use the maven-deploy-plugin is to keep open the option of using an alternative to Nexus in the future – for example, an Artifactory repository.

What is the difference between mvn install and mvn deploy?

mvn:install copies your packaged Maven module to your local repository (by default, in ~/. m2/repository ), to be accessed by other local Maven builds. mvn:deploy uploads your packaged Maven module to another (usually remote) repository, to be accessed by other, not necessarily local, Maven builds.


1 Answers

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>
like image 194
yegor256 Avatar answered Sep 22 '22 12:09

yegor256