mavenmaven-release-plugintychomaven-scm

Pomless Tycho build + maven release plugin


I have a pomless tycho build which I want to release with the maven release plugin. The issue I have is that I get errors from the git plugins for the generated .polyglot.build.properties even though it is not included in the configuration of the git-add goal.

Parent pom.xml:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <configuration>
                <autoVersionSubmodules>true</autoVersionSubmodules>
                <localCheckout>true</localCheckout>
                <preparationGoals>
                    org.eclipse.tycho:tycho-versions-plugin:${tycho.version}:update-eclipse-metadata
                    build-helper:parse-version
                    org.apache.maven.plugins:maven-scm-plugin:1.9.5:add
                    org.apache.maven.plugins:maven-scm-plugin:1.9.5:checkin
                </preparationGoals>
                <completionGoals>
                    org.eclipse.tycho:tycho-versions-plugin:${tycho.version}:update-eclipse-metadata
                    build-helper:parse-version
                    org.apache.maven.plugins:maven-scm-plugin:1.9.5:add
                    org.apache.maven.plugins:maven-scm-plugin:1.9.5:checkin
                </completionGoals>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <version>1.9.5</version>
            <executions>
                <execution>
                    <id>default-cli</id>
                    <goals>
                        <goal>add</goal>
                        <goal>checkin</goal>
                    </goals>
                    <configuration>
                        <includes>**/META-INF/MANIFEST.MF,**/feature.xml,**/*.product,**/category.xml,release.properties</includes>
                        <excludes>**/target/**</excludes>
                        <message>Changing the version to reflect the pom versions for the release</message>
                        <pushChanges>false</pushChanges>
                    </configuration>
                </execution>
            </executions>
        </plugin>

The error I get:

fatal: pathspec 'my.plugin/.polyglot.build.properties' did not match any files


Solution

  • After looking at the source code of tycho-pomless, polyglot, and maven-release, I conclude pomless build can't work with maven release. I need to add pom.xml

    The reason is:

    1. tycho-pomless uses polyglot, which creates an temporary pom from the build.properties, which is deleted when the JVM exits
    2. maven release:prepare spawns a child maven process to execute the preparation goals. When the child process finishes, this deletes the temporary files. The available mavenExecutorId values are "invoker" which invokes a new process, and "forked", which forks the process. Which means both spawn a new JVM.

    So in conclusion, it looks like tycho-pomless (or any polyglot build, really) and maven-release are incompatible in the presence of preparation goals, and there seems to be no workaround. The possible workaround of executin the preparation goals in the same JVM seems to be unavailable. So the solution is adding a pom.xml