1

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

kutschkem
  • 7,826
  • 3
  • 21
  • 56

2 Answers2

2

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

kutschkem
  • 7,826
  • 3
  • 21
  • 56
0

Check first is this is similar to this question, where the plugin does finds the files it should add, but, when creating the command line, it does not respect the correct root directory.

See if the path mentioned in pathspec 'my.plugin/.polyglot.build.properties' the correct one.

Double-check if your POM and folder hierarchy is at the right place, meaning in the project root folder.

The OP kutschkem refers in the comments to:

the .polyglot.build.properties is a temporary file, deleted by the release:prepare child process exit.
But release plugin picks it up as the pom of the project to checkin.

That might be why I see in Tycho/Reproducible Version Qualifiers

       <jgit.ignore>
         pom.xml
         .polyglot.build.properties
       </jgit.ignore>
kutschkem
  • 7,826
  • 3
  • 21
  • 56
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • LOL it's great how that's my own question, just for another project. Thanks for pointing me, that gives me an idea how this can maybe be solved. – kutschkem Jun 18 '19 at 07:58
  • @kutschkem I did not notice you were the one asking that other question :) Don't hesitate to post here your own answer – VonC Jun 18 '19 at 08:43
  • The issue seems to be that the .polyglot.build.properties is not an existing file, it is an in-memory pom for the pomless build. But release plugin picks it up as the pom of the project to checkin. – kutschkem Jun 19 '19 at 06:00
  • @kutschkem OK, I have included your comment in the answer for more visibility. – VonC Jun 19 '19 at 06:07