Pomless Tycho build + Maven发布插件

时间:2019-06-13 11:34:16

标签: maven maven-release-plugin tycho maven-scm

我有一个没有pom的tycho构建,我想与maven release插件一起发布。我遇到的问题是,即使生成的.polyglot.build.properties目标配置中未包含该生成的git-add,我也从git插件中得到了错误。

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

我得到的错误:

  

致命的:pathspec'my.plugin / .polyglot.build.properties'   没有任何文件

2 个答案:

答案 0 :(得分:2)

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

原因是:

  1. tycho-pomless使用多语言,它从build.properties创建临时pom,deleted when the JVM exits
  2. maven版本:prepare产生一个child maven process来执行准备目标。子进程完成后,这将删除临时文件。可用的mavenExecutorId值是调用一个新进程的“ invoker”和一个派生该进程的“ forked”。这意味着它们都产生了一个新的JVM。

因此,总而言之,在存在准备目标的情况下,看起来像无typo-pomless(或实际上是任何多语言版本)和maven-release不兼容,并且似乎没有解决方法。在同一JVM中执行准备目标的可执行方法似乎不可用。因此,解决方案是添加pom.xml

答案 1 :(得分:0)

首先检查一下,这类似于this question,插件确实找到了应该添加的文件,但是在创建命令行时,它不遵循正确的根目录。

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

仔细检查您的POM和文件夹层次结构是否在正确的位置,即在项目根文件夹中。

OP kutschkemin the comments指向:

  

.polyglot.build.properties是一个临时文件,已由release:prepare子进程出口删除。
  但是发布插件将其作为要检入项目的pom。

这也许就是为什么我在Tycho/Reproducible Version Qualifiers

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