[英]How to get Maven release to clone git submodules?
I've got a Maven project with some git submodules linked. 我有一个链接了一些git子模块的Maven项目。 Everything works fine until I do a release:prepare or :perform, the clean checkout these targets perform does not contain the submodules (or in other words, git clone is not recursive).
在我执行release:prepare或:perform之前,一切工作正常,这些目标执行的干净签出不包含子模块(或者git clone不递归)。 I could not find a proper way to configure Maven to call git clone with the --recursive option.
我找不到正确的方法来配置Maven以--recursive选项调用git clone。
I was thinking of using the scm provider configuration (http://maven.apache.org/scm/git.html) or simply to configure the release plugin directly in the pom.xml, but couldn't get it to work. 我在考虑使用scm提供程序配置(http://maven.apache.org/scm/git.html),或者只是直接在pom.xml中配置发布插件,但无法正常工作。
Thanks. 谢谢。
Here's the same solution but without a script: 这是相同的解决方案,但没有脚本:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<inherited>false</inherited> <!-- only execute these in the parent -->
<executions>
<execution>
<id>git submodule update</id>
<phase>initialize</phase>
<configuration>
<executable>git</executable>
<arguments>
<argument>submodule</argument>
<argument>update</argument>
<argument>--init</argument>
<argument>--recursive</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
I just added the following plugin: 我刚刚添加了以下插件:
<!-- This is a workaround to get submodules working with the maven release plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>initialize</phase>
<id>invoke build</id>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>build/bin/update.sh</executable>
</configuration>
</plugin>
And my update.sh contains: 我的update.sh包含:
#!/bin/bash
git submodule update --init
git submodule foreach git submodule update --init
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.