Maven发布插件跳过测试但没有准备

moo*_*mid 5 java maven

当使用maven的版本的插件,两者mvn release:preparemvn release:perform运行测试.

有什么方法可以配置东西,所以它们只运行期间mvn release:prepare

我知道你可以通过:

-Darguments="-DskipTests"
Run Code Online (Sandbox Code Playgroud)

但这会在两个目标中跳过测试,我不想要.而且我也不希望它们在正常运行期间运行mvn release:perform,因为执行期间的故障已经标记了存储库.

Tom*_*ome 5

您应该能够通过将该<releaseProfiles>元素添加到release-plugin 配置中来做到这一点。这将仅用于发布:执行 Mojo。

像这样的事情应该可以解决问题:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <releaseProfiles>skipTestsForReleasePerform</releaseProfiles>
            </configuration>
        </plugin>
    </plugins>
</build>
(...)
<profiles>
    <profile>
        <id>skipTestsForReleasePerform</id>
        <properties>
            <maven.test.skip>true</maven.test.skip>
        </properties>
    </profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)