aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
494 stars 182 forks source link

Is it possible put all command parameter to the configuration? #376

Closed jeffwji closed 1 year ago

jeffwji commented 1 year ago

For example, if I prefer push to remote when perform release-start. but not pushing when release-finish, I have to set -DpushRemote=true to the first command, and set -DpushRemote=false the the second. Which is very annoy. However there is a <pushRemote> option under <configuration> but it looks affect globally. I'm hoping it can be set separately and works to every command line parameter. For example:

<configuration>
  <args>
    <releaseStart>
      <pushRemote>true</pushRemote>
      <otherParameter>...</otherParameter>
    </releaseStart>
    <releaseFinish>
      <pushRemote>false</pushRemote>
      <otherParameter>...</otherParameter>
    <releaseFinish>
    <otherPhase>
      ...
    </otherPhase>
  </args>
</configuration>
aleksandr-m commented 1 year ago

AFAIK Maven doesn't support this. Ideas of workarounds are welcome.

mzatko commented 1 year ago

i think it should work "classic maven way"

<plugin>
   <artifactId>gitflow-maven-plugin</artifactId>
   ...
   <configuration>
      <!-- common configuration -->
   </configuration>
   <executions>
      <execution>
         <goals>
            <goal>release-start</goal>
         </goals>
         <configuration>
            <!-- per-goal(s) configuration -->
            <pushRemote>true</pushRemote>
         </configuration>
      </execution>
      <execution>
         <goals>
            <goal>release-finish</goal>
         </goals>
         <configuration>
            <!-- per-goal(s) configuration -->
            <pushRemote>false</pushRemote>
         </configuration>
      </execution>
   </executions>
</plugin>
aleksandr-m commented 1 year ago

@mzatko Each execution must have unique id.

One possible workaround is to use execution id in command line - see Maven 3.3.1 Release Notes.

alexist commented 1 year ago

I think you can define some profiles, for example release-start, release-finish and configure in each profile the specic configuration (pushRemote,....). Then execute the gitflow goal with the related profile mvn giflow:release-start -Prelease-start

aleksandr-m commented 1 year ago

@jeffwji Have you resolved this?

jeffwji commented 1 year ago

@jeffwji Have you resolved this?

Yes, it has been resolved!

aleksandr-m commented 1 year ago

@jeffwji Good. Can you post which solution did you use, to help future visitors.