2

I've added my own Maven plug-in to the build process like that:

    <plugins>
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <tagBase>...</tagBase>
                <preparationGoals>clean verify org.acme:my-super-cool-plugin:the-goal</preparationGoals>
                <completionGoals>org.acme:my-super-cool-plugin:the-goal"</completionGoals>
            </configuration>
        </plugin>
    </plugins>

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.acme</groupId>
                <artifactId>my-super-cool-plugin</artifactId>
                <version>1.2.3</version>
                <executions>
                    <execution>
                        <id>my-super-cool-id</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>the-goal</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>

Now the documentation states that completionGoals is called "after transformation back to the next development version but before committing", yet after releasing I see the changes my plug-in made as local changes only, they were not commited.

I already "fixed" it by adding scm:checkin to the completionGoals tag, but I'm wondering why it's not commited on it's own. Could it be because it's a Tycho project and that's screwing the Maven lifecycle up?

Stefan S.
  • 3,950
  • 5
  • 25
  • 77
  • As you mentioned the documentation states exactly how it works. If you expected something different i would suggest to create [JIRA](https://issues.apache.org/jira/browse/MRELEASE) for it. Apart from that are you using the correct release of maven-release-plugin? – khmarbaise Jul 15 '15 at 06:57
  • @khmarbaise No, I expected it to work exactly as the documentation states, but the `completionGoals` are evidently called **after** the commit, not before as stated. And I'm using the 2.5.1, which is new(ish). – Stefan S. Jul 15 '15 at 07:33
  • 2.5.1 is an older one. 2.5.2 is the most up-to-date. In this case i would suggest to file in a JIRA issue... – khmarbaise Jul 15 '15 at 08:24
  • @khmarbaise The the same problem still exists in 2.5.2. – Stefan S. Jul 15 '15 at 09:01
  • Ok. Then please file in a JIRA ticket...plus an example project. – khmarbaise Jul 16 '15 at 04:57

2 Answers2

0

The documentation actually states on another page that only the pom.xml is committed, so the links I posted are just misleading, not entirely wrong.

Stefan S.
  • 3,950
  • 5
  • 25
  • 77
0

Thanks to this question and this question Maven Release plugin: Running specific preparationGoals & completionGoals in some modules of a project we were able to build our release process just the way we wanted - all we needed was basically an additional build number being added to pom.xml.

So we created a plugin execution like this:

       <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>set-new-build-number</id>
                    <phase>none</phase>
                    <goals>
                        <goal>set-property</goal>
                    </goals>
                    <configuration>
                        <property>our.build.number</property>
                        <newVersion>${newBuildNumber}</newVersion>
                    </configuration>
                </execution>
            </executions>
        </plugin>

and then we reference the execution in the maven-release-plugin

 <completionGoals>versions:set-property@set-new-build-number</completionGoals>

which automatically changes the pom after having incremented to the next SNAPSHOT version, but before creating the commit 'prepare for next development iteration'

Chris
  • 347
  • 1
  • 11