Configure default execution phase

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Configure default execution phase

Stanimir Stamenkov-2
I'm having a POM like:

     <build>
         <pluginManagement>
             <plugins>
                 <plugin>
                     <groupId>org.liquibase</groupId>
                     <artifactId>liquibase-maven-plugin</artifactId>
                     <version>3.8.3</version>
                     <configuration>
                         <changeLogFile>...</changeLogFile>
                     </configuration>
                 </plugin>
             </plugins>
         </pluginManagement>
     </build>

I don't want the plugin executed as part of the build but I want to be
able to execute its goals [1] explicitly.  The goals get executed
directly (no build phases get triggered), f.e.:

     mvn liquibase:update

but then it usually (while not necessarily, depending on project
configuration) require "process-resources" to be completed, so I have to:

     mvn process-resources liquibase:update

Is it possible to trigger "process-resources" automatically via plugin
configuration in POM (a`la Gradle's dependsOn [2]), or this is just
hard-coded in the plugin itself?

[1] https://www.liquibase.org/documentation/maven/index.html
[2] https://docs.gradle.org/current/userguide/more_about_tasks.html

--
Stanimir

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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Thomas Broyer-2
It's hardcoded in the plugin (and this is why you have things like
sources:jar and sources:jar-no-fork depending on how you need/want to
invoke it)

Le dim. 22 déc. 2019 à 18:04, Stanimir Stamenkov
<[hidden email]> a écrit :

> I'm having a POM like:
>
>      <build>
>          <pluginManagement>
>              <plugins>
>                  <plugin>
>                      <groupId>org.liquibase</groupId>
>                      <artifactId>liquibase-maven-plugin</artifactId>
>                      <version>3.8.3</version>
>                      <configuration>
>                          <changeLogFile>...</changeLogFile>
>                      </configuration>
>                  </plugin>
>              </plugins>
>          </pluginManagement>
>      </build>
>
> I don't want the plugin executed as part of the build but I want to be
> able to execute its goals [1] explicitly.  The goals get executed
> directly (no build phases get triggered), f.e.:
>
>      mvn liquibase:update
>
> but then it usually (while not necessarily, depending on project
> configuration) require "process-resources" to be completed, so I have to:
>
>      mvn process-resources liquibase:update
>
> Is it possible to trigger "process-resources" automatically via plugin
> configuration in POM (a`la Gradle's dependsOn [2]), or this is just
> hard-coded in the plugin itself?
>
> [1] https://www.liquibase.org/documentation/maven/index.html
> [2] https://docs.gradle.org/current/userguide/more_about_tasks.html
>
> --
> Stanimir
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Mark Prins
In reply to this post by Stanimir Stamenkov-2
You should be able to change the default execution phase of a plugin (as
well as bind a goal to any other phase) by configuring explicit
executions bound to a phase

see: https://maven.apache.org/guides/mini/guide-default-execution-ids.html

You would need to use an id of "default-update" to override the update goal.

-M


On 22-12-19 18:04, Stanimir Stamenkov wrote:

> I'm having a POM like:
>
>      <build>
>          <pluginManagement>
>              <plugins>
>                  <plugin>
>                      <groupId>org.liquibase</groupId>
>                      <artifactId>liquibase-maven-plugin</artifactId>
>                      <version>3.8.3</version>
>                      <configuration>
>                          <changeLogFile>...</changeLogFile>
>                      </configuration>
>                  </plugin>
>              </plugins>
>          </pluginManagement>
>      </build>
>
> I don't want the plugin executed as part of the build but I want to be
> able to execute its goals [1] explicitly.  The goals get executed
> directly (no build phases get triggered), f.e.:
>
>      mvn liquibase:update
>
> but then it usually (while not necessarily, depending on project
> configuration) require "process-resources" to be completed, so I have to:
>
>      mvn process-resources liquibase:update
>
> Is it possible to trigger "process-resources" automatically via plugin
> configuration in POM (a`la Gradle's dependsOn [2]), or this is just
> hard-coded in the plugin itself?
>
> [1] https://www.liquibase.org/documentation/maven/index.html
> [2] https://docs.gradle.org/current/userguide/more_about_tasks.html
>


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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Thomas Broyer-2
That would reconfigure which phase the mojo is bound to (if any, which is
not the case if the Liquibase plugin) when executed as part of the build
lifecycle; it won't allow you to fork a lifecycle when calling the goal
directly.

Le lun. 23 déc. 2019 à 15:02, Mark Prins <[hidden email]> a écrit :

> You should be able to change the default execution phase of a plugin (as
> well as bind a goal to any other phase) by configuring explicit
> executions bound to a phase
>
> see: https://maven.apache.org/guides/mini/guide-default-execution-ids.html
>
> You would need to use an id of "default-update" to override the update
> goal.
>
> -M
>
>
> On 22-12-19 18:04, Stanimir Stamenkov wrote:
> > I'm having a POM like:
> >
> >      <build>
> >          <pluginManagement>
> >              <plugins>
> >                  <plugin>
> >                      <groupId>org.liquibase</groupId>
> >                      <artifactId>liquibase-maven-plugin</artifactId>
> >                      <version>3.8.3</version>
> >                      <configuration>
> >                          <changeLogFile>...</changeLogFile>
> >                      </configuration>
> >                  </plugin>
> >              </plugins>
> >          </pluginManagement>
> >      </build>
> >
> > I don't want the plugin executed as part of the build but I want to be
> > able to execute its goals [1] explicitly.  The goals get executed
> > directly (no build phases get triggered), f.e.:
> >
> >      mvn liquibase:update
> >
> > but then it usually (while not necessarily, depending on project
> > configuration) require "process-resources" to be completed, so I have to:
> >
> >      mvn process-resources liquibase:update
> >
> > Is it possible to trigger "process-resources" automatically via plugin
> > configuration in POM (a`la Gradle's dependsOn [2]), or this is just
> > hard-coded in the plugin itself?
> >
> > [1] https://www.liquibase.org/documentation/maven/index.html
> > [2] https://docs.gradle.org/current/userguide/more_about_tasks.html
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Stanimir Stamenkov-2
In reply to this post by Thomas Broyer-2
Mon, 23 Dec 2019 11:37:19 +0100, /Thomas Broyer/:

> It's hardcoded in the plugin (and this is why you have things like
> sources:jar and sources:jar-no-fork depending on how you need/want to
> invoke it)

I see now – thanks for clarifying.  I've always wondered what those
*-no-fork goals are for – I've thought it has to do something with
forking the JVM process but seems I've been completely wrong. :-)  In
any case, I think dynamic "executePhase" configuration would be really
nice to have, the same way one could dynamically bind a goal to a
specific phase.


> Le dim. 22 déc. 2019 à 18:04, Stanimir Stamenkov a écrit :
>
>> I'm having a POM like:
>>
>>       <build>
>>           <pluginManagement>
>>               <plugins>
>>                   <plugin>
>>                       <groupId>org.liquibase</groupId>
>>                       <artifactId>liquibase-maven-plugin</artifactId>
>>                       <version>3.8.3</version>
>>                       <configuration>
>>                           <changeLogFile>...</changeLogFile>
>>                       </configuration>
>>                   </plugin>
>>               </plugins>
>>           </pluginManagement>
>>       </build>
>>
>> I don't want the plugin executed as part of the build but I want to be
>> able to execute its goals [1] explicitly.  The goals get executed
>> directly (no build phases get triggered), f.e.:
>>
>>       mvn liquibase:update
>>
>> but then it usually (while not necessarily, depending on project
>> configuration) require "process-resources" to be completed, so I have to:
>>
>>       mvn process-resources liquibase:update
>>
>> Is it possible to trigger "process-resources" automatically via plugin
>> configuration in POM (a`la Gradle's dependsOn [2]), or this is just
>> hard-coded in the plugin itself?
>>
>> [1] https://www.liquibase.org/documentation/maven/index.html
>> [2] https://docs.gradle.org/current/userguide/more_about_tasks.html

--
Stanimir

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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Manfred Moser-4
In reply to this post by Stanimir Stamenkov-2
Just make a profile and add it all in there.

Stanimir Stamenkov wrote on 2019-12-22 09:04 (GMT -08:00):

> I'm having a POM like:
>
>     <build>
>         <pluginManagement>
>             <plugins>
>                 <plugin>
>                     <groupId>org.liquibase</groupId>
>                     <artifactId>liquibase-maven-plugin</artifactId>
>                     <version>3.8.3</version>
>                     <configuration>
>                         <changeLogFile>...</changeLogFile>
>                     </configuration>
>                 </plugin>
>             </plugins>
>         </pluginManagement>
>     </build>
>
> I don't want the plugin executed as part of the build but I want to be
> able to execute its goals [1] explicitly.  The goals get executed
> directly (no build phases get triggered), f.e.:
>
>     mvn liquibase:update
>
> but then it usually (while not necessarily, depending on project
> configuration) require "process-resources" to be completed, so I have to:
>
>     mvn process-resources liquibase:update
>
> Is it possible to trigger "process-resources" automatically via plugin
> configuration in POM (a`la Gradle's dependsOn [2]), or this is just
> hard-coded in the plugin itself?
>
> [1] https://www.liquibase.org/documentation/maven/index.html
> [2] https://docs.gradle.org/current/userguide/more_about_tasks.html
>
> --
> Stanimir
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Stanimir Stamenkov-2
Mon, 23 Dec 2019 18:16:13 +0100 (CET), /Manfred Moser/:

> Just make a profile and add it all in there.

Are you suggesting adding something like:

     <profiles>
         <profile>
             <id>liquibase-update</id>
             <build>
                 <plugins>
                     <plugin>
                         <groupId>org.liquibase</groupId>
                         <artifactId>liquibase-maven-plugin</artifactId>
                         <executions>
                             <execution>
                                 <phase>process-resources</phase>
                                 <goals>
                                     <goal>update</goal>
                                 </goals>
                             </execution>
                         </executions>
                     </plugin>
                 </plugins>
             </build>
         </profile>
     </profiles>

then using command like:

     mvn process-resources -P liquibase-update

?

It doesn't appear shorter than:

     mvn process-resources liquibase:update

and I guess I'll have to replicate the profile for all possible
liquibase goals (possibly 5-10 of them).  All in all, it doesn't appear
feasible unless I'm missing something with your suggestion?


> Stanimir Stamenkov wrote on 2019-12-22 09:04 (GMT -08:00):
>
>> I'm having a POM like:
>>
>>      <build>
>>          <pluginManagement>
>>              <plugins>
>>                  <plugin>
>>                      <groupId>org.liquibase</groupId>
>>                      <artifactId>liquibase-maven-plugin</artifactId>
>>                      <version>3.8.3</version>
>>                      <configuration>
>>                          <changeLogFile>...</changeLogFile>
>>                      </configuration>
>>                  </plugin>
>>              </plugins>
>>          </pluginManagement>
>>      </build>
>>
>> I don't want the plugin executed as part of the build but I want to be
>> able to execute its goals [1] explicitly.  The goals get executed
>> directly (no build phases get triggered), f.e.:
>>
>>      mvn liquibase:update
>>
>> but then it usually (while not necessarily, depending on project
>> configuration) require "process-resources" to be completed, so I have to:
>>
>>      mvn process-resources liquibase:update
>>
>> Is it possible to trigger "process-resources" automatically via plugin
>> configuration in POM (a`la Gradle's dependsOn [2]), or this is just
>> hard-coded in the plugin itself?
>>
>> [1] https://www.liquibase.org/documentation/maven/index.html
>> [2] https://docs.gradle.org/current/userguide/more_about_tasks.html

--
Stanimir

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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Manfred Moser-4
well... with using the profile you can add more plugins and all sorts of other stuff and the command will stay that long

Manfre

Stanimir Stamenkov wrote on 2019-12-23 09:50 (GMT -08:00):

> Mon, 23 Dec 2019 18:16:13 +0100 (CET), /Manfred Moser/:
>
>> Just make a profile and add it all in there.
>
> Are you suggesting adding something like:
>
>     <profiles>
>         <profile>
>             <id>liquibase-update</id>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <groupId>org.liquibase</groupId>
>                         <artifactId>liquibase-maven-plugin</artifactId>
>                         <executions>
>                             <execution>
>                                 <phase>process-resources</phase>
>                                 <goals>
>                                     <goal>update</goal>
>                                 </goals>
>                             </execution>
>                         </executions>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>     </profiles>
>
> then using command like:
>
>     mvn process-resources -P liquibase-update
>
> ?
>
> It doesn't appear shorter than:
>
>     mvn process-resources liquibase:update
>
> and I guess I'll have to replicate the profile for all possible
> liquibase goals (possibly 5-10 of them).  All in all, it doesn't appear
> feasible unless I'm missing something with your suggestion?
>
>
>> Stanimir Stamenkov wrote on 2019-12-22 09:04 (GMT -08:00):
>>
>>> I'm having a POM like:
>>>
>>>      <build>
>>>          <pluginManagement>
>>>              <plugins>
>>>                  <plugin>
>>>                      <groupId>org.liquibase</groupId>
>>>                      <artifactId>liquibase-maven-plugin</artifactId>
>>>                      <version>3.8.3</version>
>>>                      <configuration>
>>>                          <changeLogFile>...</changeLogFile>
>>>                      </configuration>
>>>                  </plugin>
>>>              </plugins>
>>>          </pluginManagement>
>>>      </build>
>>>
>>> I don't want the plugin executed as part of the build but I want to be
>>> able to execute its goals [1] explicitly.  The goals get executed
>>> directly (no build phases get triggered), f.e.:
>>>
>>>      mvn liquibase:update
>>>
>>> but then it usually (while not necessarily, depending on project
>>> configuration) require "process-resources" to be completed, so I have to:
>>>
>>>      mvn process-resources liquibase:update
>>>
>>> Is it possible to trigger "process-resources" automatically via plugin
>>> configuration in POM (a`la Gradle's dependsOn [2]), or this is just
>>> hard-coded in the plugin itself?
>>>
>>> [1] https://www.liquibase.org/documentation/maven/index.html
>>> [2] https://docs.gradle.org/current/userguide/more_about_tasks.html
>
> --
> Stanimir
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Stanimir Stamenkov-2
Mon, 23 Dec 2019 21:43:36 +0100 (CET), /Manfred Moser/:

> well... with using the profile you can add more plugins and all sorts of other stuff and the command will stay that long

I must admit I'm completely puzzled by your suggestion – why I would be
adding all sorts of stuff gaining nothing but adding complexity to the
build script.  Anyway, thanks for your comments.

--
Stanimir

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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Jeff Jensen
>  I must admit I'm completely puzzled by your suggestion [snip]
Perhaps your specific example requires no further profile configuration,
however, since a profile enables configuring many things and calling one
goal/mojo is only one, Manfred generally suggests that it's no more effort
to run a profile with multiple plugins configured than 1.


On Tue, Dec 24, 2019 at 7:09 AM Stanimir Stamenkov
<[hidden email]> wrote:

> Mon, 23 Dec 2019 21:43:36 +0100 (CET), /Manfred Moser/:
>
> > well... with using the profile you can add more plugins and all sorts of
> other stuff and the command will stay that long
>
> I must admit I'm completely puzzled by your suggestion – why I would be
> adding all sorts of stuff gaining nothing but adding complexity to the
> build script.  Anyway, thanks for your comments.
>
> --
> Stanimir
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Manfred Moser-4
In reply to this post by Stanimir Stamenkov-2
Typically a separate invocation like needing to update the data schema involves more than one plugin.

The best and most common example is a release profile. It often includes things like javadoc, signing, obfustcating, creating additional files and so on. And you just run it with a profile.


If you truly want to invoke only the one plugin, it wont matter. But in practice .. most of time it will be more than one plugin at a time.

Stanimir Stamenkov wrote on 2019-12-24 05:09 (GMT -08:00):

> Mon, 23 Dec 2019 21:43:36 +0100 (CET), /Manfred Moser/:
>
>> well... with using the profile you can add more plugins and all sorts of other
>> stuff and the command will stay that long
>
> I must admit I'm completely puzzled by your suggestion – why I would be
> adding all sorts of stuff gaining nothing but adding complexity to the
> build script.  Anyway, thanks for your comments.
>
> --
> Stanimir
>


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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Stanimir Stamenkov-2
Tue, 24 Dec 2019 17:27:18 +0100 (CET), /Manfred Moser/:

> Typically a separate invocation like needing to update the data schema involves more than one plugin.
>
> The best and most common example is a release profile. It often includes things like javadoc, signing, obfustcating, creating additional files and so on. And you just run it with a profile.
>
>
> If you truly want to invoke only the one plugin, it wont matter. But in practice .. most of time it will be more than one plugin at a time.

In my use case the (liquibase) maven plugin is only used for
development.  The development of a new database change generally
involves multiple command invocations:

# Prepare source change
mvn liquibase:update
mvn liquibase:rollback
# Update the change in the source, then
mvn liquibase:updateTestingRollback

Rinse and repeat, and mix other goals into the cycle.  This would happen
even if the plugin is otherwise programmed into a release profile.  So
I've asked if it is possible to configure the default behavior to always
execute process-resources phase with this plugin, but seems it is
currently not.

--
Stanimir

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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Stanimir Stamenkov-2
In reply to this post by Jeff Jensen
Tue, 24 Dec 2019 09:34:05 -0600, /Jeff Jensen/:

> Perhaps your specific example requires no further profile configuration,
> however, since a profile enables configuring many things and calling one
> goal/mojo is only one, Manfred generally suggests that it's no more effort
> to run a profile with multiple plugins configured than 1.

Perhaps this could help clarify the intended use case a bit – from my
original post:

> I don't want the plugin executed as part of the build but I want to be
> able to execute its goals explicitly.

And the example configuration I've given uses just <pluginManagement>
section.  So no, I'm not interested into setting up a profile for an
automated build.

--
Stanimir

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

Reply | Threaded
Open this post in threaded view
|

Re: Configure default execution phase

Manfred Moser-4
In reply to this post by Stanimir Stamenkov-2
What I am trying to say is that you can just add all these invocations to one profile and bind them to different phases or just the same phase and have them in order in the pom file and then you just invoke the one profile.

Plugin invocations can all be bound to specific phases in the pom and can be bound to a default phase in the code of the plugin.

Manfred

Stanimir Stamenkov wrote on 2019-12-24 08:47 (GMT -08:00):

> Tue, 24 Dec 2019 17:27:18 +0100 (CET), /Manfred Moser/:
>
>> Typically a separate invocation like needing to update the data schema
>> involves more than one plugin.
>>
>> The best and most common example is a release profile. It often includes
>> things like javadoc, signing, obfustcating, creating additional files and so
>> on. And you just run it with a profile.
>>
>>
>> If you truly want to invoke only the one plugin, it wont matter. But in
>> practice .. most of time it will be more than one plugin at a time.
>
> In my use case the (liquibase) maven plugin is only used for
> development.  The development of a new database change generally
> involves multiple command invocations:
>
> # Prepare source change
> mvn liquibase:update
> mvn liquibase:rollback
> # Update the change in the source, then
> mvn liquibase:updateTestingRollback
>
> Rinse and repeat, and mix other goals into the cycle.  This would happen
> even if the plugin is otherwise programmed into a release profile.  So
> I've asked if it is possible to configure the default behavior to always
> execute process-resources phase with this plugin, but seems it is
> currently not.
>
> --
> Stanimir
>


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