簡體   English   中英

如何獲得Maven版本以克隆git子模塊?

[英]How to get Maven release to clone git submodules?

我有一個鏈接了一些git子模塊的Maven項目。 在我執行release:prepare或:perform之前,一切工作正常,這些目標執行的干凈簽出不包含子模塊(或者git clone不遞歸)。 我找不到正確的方法來配置Maven以--recursive選項調用git clone。

我在考慮使用scm提供程序配置(http://maven.apache.org/scm/git.html),或者只是直接在pom.xml中配置發布插件,但無法正常工作。

謝謝。

這是相同的解決方案,但沒有腳本:

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

我剛剛添加了以下插件:

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

我的update.sh包含:

#!/bin/bash
git submodule update --init
git submodule foreach git submodule update --init

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM