如何让Maven发布克隆git子模块? [英] How to get Maven release to clone git submodules?

查看:199
本文介绍了如何让Maven发布克隆git子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连接了一些git子模块的Maven项目。一切工作正常,直到我做一个版本:准备或:执行,这些目标执行干净的签出不包含子模块(或换句话说,git克隆不递归)。
我找不到一个正确的方式来配置Maven,使用--recursive选项来调用git clone。

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 contain the submodules (or in other words, git clone is not recursive). I could not find a proper way to configure Maven to call git clone with the --recursive option.

我正在考虑使用scm提供程序配置( http://maven.apache.org/scm/git.html),或者直接在pom.xml中配置发布插件,但无法使其发挥作用。

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.

谢谢。

Thanks.

推荐答案

我刚刚添加了以下插件:

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>

我的update.sh包含:

And my update.sh contains:

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

这篇关于如何让Maven发布克隆git子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆