Re: Hooking custom plugin into deploy phase

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Hooking custom plugin into deploy phase

Maarten Mulders
Hi Petr,

As far as I know, when two plugins are bound to the same phase, the
order of execution is the same as the order in which you define them in
So if you want your plugin to be executed before the
maven-deploy-plugin, I guess you'll need to explicitly list the
maven-deploy-plugin in your pom.xml, straight after your custom plugin.
(Besides, it would be a good idea to do that anyway since it allows you
to specify which version of the maven-deploy-plugin your project uses.)

Hope this helps!


On May 19, 2020 at 14:24, Petr FiĊĦer wrote:

> Hello,
> I am trying to create custom maven plugin. Problem is I need to hook it
> up into the "deploy" phase before the default maven-deploy-plugin gets
> executed.
> The plugin itself seems to be ok - I hooked it up to "package" phase to
> verify its working. But when trying to get it into "deploy" phase, the
> maven-deploy-plugin executes first (and of course complains that I do
> not have the distributionManagement section in the pom.xml but I guess
> that is not the root of my problem).
> Could somebody point me in the right direction please?
> Base class of the plugin:
> @Mojo( name ="askpass", defaultPhase = LifecyclePhase.DEPLOY )
> public class AskpassDeployPluginMojoextends AbstractMojo {
> public void execute()throws MojoExecutionException,
> MojoFailureException {
> //do something here }
> }
> Reference from pom.xml of sample project where I am testing this:
> <project xmlns=""
> xmlns:xsi=""
> xsi:schemaLocation=" 
> <modelVersion>4.0.0</modelVersion>
> <groupId></groupId>
> <artifactId>my-app</artifactId>
> <packaging>jar</packaging>
> <version>1.0-SNAPSHOT</version>
> <name>my-app</name>
> <url></url>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>3.8.1</version>
> <scope>test</scope>
> </dependency>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <groupId>cz.fiisch.maven.plugin.deploy.askpass</groupId>
> <artifactId>askpass-deploy-plugin</artifactId>
> <version>1.0-SNAPSHOT</version>
> <executions>
> <execution>
> <phase>deploy</phase>
> <goals>
> <goal>askpass</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> </project>
> Cheers,

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]