How to get Maven release to clone git submodules?

后端 未结 2 2018
别那么骄傲
别那么骄傲 2020-12-23 15:47

I\'ve got a Maven project with some git submodules linked. Everything works fine until I do a release:prepare or :perform, the clean checkout these targets perform does not

相关标签:
2条回答
  • 2020-12-23 15:49

    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>
    
    0 讨论(0)
  • 2020-12-23 16:07

    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:

    #!/bin/bash
    git submodule update --init
    git submodule foreach git submodule update --init
    
    0 讨论(0)
提交回复
热议问题