如何在使用mvn scm:bootstrap时跳过单元测试

时间:2011-05-03 09:41:03

标签: maven maven-scm

我正在尝试使用mvn scm插件检查每日标记,并从该版本的代码创建一个程序集。我配置了scm插件,并且everythhing运行良好,除了我似乎无法告诉它不运行单元测试。

我试过了:

  • 传递-Dmaven.test.skip = true命令行参数
  • 创建surefire插件跳过测试的配置文件,并在scm配置“profiles”部分列出该配置文件
  • 将“maven.test.skip = true”设置为环境变量

在所有情况下,当scm插件开始运行我告诉它在配置中运行的目标时(见下文),它还会运行单元测试。

以下是我使用配置文件跳过测试的示例:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-scm-plugin</artifactId>
    <version>1.0</version>
    <configuration>
        <goals>install,assembly:assembly</goals>
        <profiles>skiptest</profiles>
    </configuration>
</plugin>

这是配置文件(我在项目的pom.xml中定义了它):

<profiles>
    <profile>
        <id>skiptest</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

我用来执行结帐和引导的命令是:

mvn scm:bootstrap -DscmVersion=daily-20110427-421 -DscmVersionType=tag

我正在Linux机器上运行mvn 2.2.1,并从CVS存储库进行结账。这是一个现有项目,我有持续集成和标记所有启动和运行,我只想查看每日标记并从中创建一个程序集。

非常感谢任何提示。

编辑:使用下面的答案,但只有在我升级到maven-scm-plugin 1.1版之后。显然,1.0没有传播配置文件。

1 个答案:

答案 0 :(得分:1)

在个人资料中尝试此操作:

<profiles>
    <profile>
        <id>skiptest</id>
        <properties>
            <maven.test.skip>true</maven.test.skip>
        </properties>
    </profile>
</profiles>