1

I would like to do something DURING the release:prepare step BEFORE the prepare release commit is made, such that my changes are included in the prepare release commit. It is a multi-module project with a parent pom.

I added the following to the pluginManagement section of the parent pom.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
        <preparationGoals>exec:exec@tagLiquibase</preparationGoals>
    </configuration>
</plugin>

I added the following in the pom for the module where I want the script that does what needs doing to run.

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>tagLiquibase</id>
                            <configuration>
                                <goals><goal>exec</goal></goals>
                                <executable>/bin/bash</executable>
                                <arguments>
                                    <argument>./tagChangeLog.sh</argument>
                                    <argument>-rv</argument>
                                    <argument>v${env.RELEASE_VERSION}</argument>
                                </arguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

The ./tagChangeLog.sh IS running, but it's running AFTER the prepare release commit is made and therefore the changes, which are adding a tag in the liquibase change log, aren't being included in the prepare release commit. What am I doing wrong?

Tangentially, when I added the maven-release-plugin to the parent pom with <preparationGoals>exec:exec@tagLiquibase</preparationGoals>, the exec-maven-plugin is being called for some, but not all modules in the project, and I had to do something stupid like the following in those other modules, including the parent pom, to avoid getting errors:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>tagLiquibase</id>
            <configuration>
                <executable>echo</executable>
            </configuration>
        </execution>
    </executions>
</plugin>

Why is this and is there any way to avoid the exec-maven-plugin being called for modules where I didn't even want to mention it.

Thanks in advance!

I tried what I described above and I was expecting the tagChangelog.sh script to be executed BEFORE the prepare release commit, rather than after it.

0 Answers0