0

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

我试过:

  • 传递 -Dmaven.test.skip=true 命令行参数
  • 创建一个surefire插件跳过测试的配置文件,并在scm配置“配置文件”部分列出该配置文件
  • 将“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 没有传播配置文件。

4

1 回答 1

1

在配置文件中试试这个:

<profiles>
    <profile>
        <id>skiptest</id>
        <properties>
            <maven.test.skip>true</maven.test.skip>
        </properties>
    </profile>
</profiles>
于 2011-05-03T09:49:50.520 回答