Is there a way to make a mojo run after "deploy" completion?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a way to make a mojo run after "deploy" completion?

Steinar Bang
I would like to run a mojo to run after deploy has completed
successfully, to notify some OSGi bundles running in karaf, that they
should update themselves with new deployed snapshots in a maven
repository.

The problem is that the deploy lifecycle phase is the last lifecycle
phase of the default lifecycle
 http://maven.apache.org/ref/3.5.0/maven-core/lifecycles.html

Ie. there is no "post-deploy" lifecycle phase to run my mojo in.

Is there a way to order mojos bound to the same lifecycle, so that my
mojo will only run after maven-deploy-plugin has done its thing?
(Preferrably only run my mojo if deployment has been successful, though
I could live with running it every time)


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

Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to make a mojo run after "deploy" completion?

Karl Heinz Marbaise-3
Hi,

On 03/09/17 18:21, Steinar Bang wrote:

> I would like to run a mojo to run after deploy has completed
> successfully, to notify some OSGi bundles running in karaf, that they
> should update themselves with new deployed snapshots in a maven
> repository.
>
> The problem is that the deploy lifecycle phase is the last lifecycle
> phase of the default lifecycle
>   http://maven.apache.org/ref/3.5.0/maven-core/lifecycles.html
>
> Ie. there is no "post-deploy" lifecycle phase to run my mojo in.

We are thinking already of such things and which might be part of Maven
4+...[1]


[1]:https://issues.apache.org/jira/browse/MNG-5666

>
> Is there a way to order mojos bound to the same lifecycle, so that my
> mojo will only run after maven-deploy-plugin has done its thing?

Usually if you bind a another plugin to the life cycle all plugins from
the default life cycle will run first....if your plugin is bound to an
life cycle like "deploy"....


> (Preferrably only run my mojo if deployment has been successful, though
> I could live with running it every time)

Kind regards
Karl Heinz Marbaise

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

Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to make a mojo run after "deploy" completion?

Steinar Bang
>>>>> Karl Heinz Marbaise <[hidden email]>:

>> Ie. there is no "post-deploy" lifecycle phase to run my mojo in.

> We are thinking already of such things and which might be part of
> Maven 4+...[1]

> [1]:https://issues.apache.org/jira/browse/MNG-5666

Great news! :-)

>> Is there a way to order mojos bound to the same lifecycle, so that my
>> mojo will only run after maven-deploy-plugin has done its thing?

> Usually if you bind a another plugin to the life cycle all plugins
> from the default life cycle will run first....if your plugin is bound
> to an life cycle like "deploy"....

Right.  I think I will try, and see what happens.

Thanks for the info!


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

Reply | Threaded
Open this post in threaded view
|

Re: Is there a way to make a mojo run after "deploy" completion?

Chas Honton
In reply to this post by Steinar Bang
According to https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Plugins <https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Plugins>:
"If more than one goal is bound to a particular phase, the order used is that those from the packaging are executed first, followed by those configured in the POM”
"When multiple executions are given that match a particular phase, they are executed in the order specified in the POM, with inherited executions running first."

As long as the deploy mojo is specified in the packaging, it will always run before your additional mojo specified in your pom. If you specify the deploy mojo in your pom, try placing the deploy mojo in your parent pom and your notification mojo in your subordinate pom.  Or, order the execution declarations in your single pom.

chas


> On Sep 3, 2017, at 9:21 AM, Steinar Bang <[hidden email]> wrote:
>
> I would like to run a mojo to run after deploy has completed
> successfully, to notify some OSGi bundles running in karaf, that they
> should update themselves with new deployed snapshots in a maven
> repository.
>
> The problem is that the deploy lifecycle phase is the last lifecycle
> phase of the default lifecycle
> http://maven.apache.org/ref/3.5.0/maven-core/lifecycles.html
>
> Ie. there is no "post-deploy" lifecycle phase to run my mojo in.
>
> Is there a way to order mojos bound to the same lifecycle, so that my
> mojo will only run after maven-deploy-plugin has done its thing?
> (Preferrably only run my mojo if deployment has been successful, though
> I could live with running it every time)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>