如何配置maven-release-plugin以使用maven-scm-provider-gitexe'shalow'选项

时间:2018-05-31 22:56:27

标签: git maven maven-release-plugin

我正在尝试配置maven发布插件,以利用maven-scm-provider-gitexe提供的新浅层选项。 我的pom看起来如下

<properties>
    <shallow>true</shallow>
</properties>
<pluginManagement>
    <plugins>
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-gitexe</artifactId>
                    <version>1.10.0</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</pluginManagement>

但是这会导致以下错误

Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:perform (default-cli) on project dory-interfaces: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.3.2:perform failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-release-plugin:2.3.2:perform: java.lang.NoSuchFieldError: SHALLOW
-----------------------------------------------------
realm =    plugin>org.apache.maven.plugins:maven-release-plugin:2.3.2
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:.m2/repository/org/apache/maven/plugins/maven-release-plugin/2.3.2/maven-release-plugin-2.3.2.jar
urls[1] = file:.m2/repository/org/apache/maven/scm/maven-scm-provider-gitexe/1.10.0/maven-scm-provider-gitexe-1.10.0.jar
urls[2] = file:.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
urls[3] = file:.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar

还尝试使用版本maven-release-plugin版本2.5.3

1 个答案:

答案 0 :(得分:5)

也许只是添加缺少的依赖项

<plugin>
    <artifactId>maven-release-plugin</artifactId>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-api</artifactId>
            <version>1.10.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-gitexe</artifactId>
            <version>1.10.0</version>
        </dependency>
    </dependencies>
</plugin>