简体   繁体   English

Pomless Tycho build + Maven发布插件

[英]Pomless Tycho build + maven release plugin

I have a pomless tycho build which I want to release with the maven release plugin. 我有一个没有pom的tycho版本,我想与maven release插件一起发布。 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. 我遇到的问题是,即使生成的.polyglot.build.properties不包含在git-add目标的配置中,我也会从git插件中获取错误。

Parent pom.xml: 父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 致命的:pathspec'my.plugin / .polyglot.build.properties'与任何文件都不匹配

After looking at the source code of tycho-pomless, polyglot, and maven-release, I conclude pomless build can't work with maven release. 在查看了tycho-pomless,polyglot和maven-release的源代码之后,我得出结论,pomless构建无法与maven版本一起使用。 I need to add pom.xml 我需要添加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 tycho-pomless使用polyglot,它从build.properties创建一个临时pom, 在JVM退出时将删除
  2. maven release:prepare spawns a child maven process to execute the preparation goals. maven版本:prepare产生一个子maven流程来执行准备目标。 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. 可用的mavenExecutorId值是调用一个新进程的“ invoker”和一个派生该进程的“ forked”。 Which means both spawn a new JVM. 这意味着两者都产生了一个新的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. 因此,总而言之,在存在准备目标的情况下,看起来像无typo-pomless(或实际上是任何多语言版本)和maven-release不兼容,并且似乎没有解决方法。 The possible workaround of executin the preparation goals in the same JVM seems to be unavailable. 在同一JVM中执行准备目标的可执行方法似乎不可用。 So the solution is adding a pom.xml 所以解决方案是添加pom.xml

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. 查看pathspec 'my.plugin/.polyglot.build.properties'提到的路径是否正确。

Double-check if your POM and folder hierarchy is at the right place, meaning in the project root folder. 仔细检查您的POM和文件夹层次结构是否在正确的位置,即项目根文件夹中。

The OP kutschkem refers in the comments to: OP kutschkem 在注释中引用:

the .polyglot.build.properties is a temporary file, deleted by the release:prepare child process exit. .polyglot.build.properties是一个临时文件,由release:prepare子进程出口删除。
But release plugin picks it up as the pom of the project to checkin. 但是发布插件将其作为要检入的项目的pom。

That might be why I see in Tycho/Reproducible Version Qualifiers 这可能就是为什么我在第谷/可复制版本限定词中看到的原因

       <jgit.ignore>
         pom.xml
         .polyglot.build.properties
       </jgit.ignore>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM