Pomless Tycho build + maven 发布插件

Pomless Tycho build + maven release plugin

我有一个 pomless tycho 构建,我想用 maven 发布插件发布它。我遇到的问题是我从生成的 .polyglot.build.properties 的 git 插件中得到错误,即使它没有包含在 git-add 目标的配置中。

父级 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>

我得到的错误:

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

首先检查这是否类似于 ,插件确实找到了它应该添加的文件,但是,在创建命令行时,它没有考虑正确的根目录。

查看pathspec 'my.plugin/.polyglot.build.properties'中提到的路径是否正确。

Double-check 如果您的 POM 和文件夹层次结构位于正确的位置,即在项目根文件夹中。

OP kutschkem refers 至:

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.

这可能就是我在 Tycho/Reproducible Version Qualifiers

中看到的原因
       <jgit.ignore>
         pom.xml
         .polyglot.build.properties
       </jgit.ignore>

查看 tycho-pomless、polyglot 和 maven-release 的源代码后,我得出结论,pomless 构建不能与 maven 版本一起使用。我需要添加 pom.xml

原因是:

  1. tycho-pomless 使用 polyglot,它从 build.properties 创建一个临时 pom,即 deleted when the JVM exits
  2. maven release:prepare 生成一个 child maven process 来执行准备目标。当子进程完成时,这将删除临时文件。可用的 mavenExecutorId 值为 "invoker" 和 "forked",前者调用新进程,后者分叉进程。这意味着两者都产生了一个新的 JVM。

所以总而言之,看起来 tycho-pomless(或者任何多语言构建,真的)和 maven-release 在准备目标的存在下是不兼容的,而且似乎没有解决方法。在同一个 JVM 中执行准备目标的可能解决方法似乎不可用。所以解决方案是添加一个 pom.xml