Maven配置文件覆盖1个插件



我有一个项目的maven pom.xml,它使用继承。有时我想跳过一次考试。我想运行mvn -P jenkins并启用以下内容:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <configuration>
            <excludes>
                <exclude>**/TestToSkip.java</exclude>
            </excludes>
        </configuration>
    </plugin>
</plugins>

我可以有:

<profiles>
    <profile>
        <id>profile-1</id>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
                <configuration>
                    <excludes>
                        <exclude>**/TestToSkip.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </profile>
</profiles>

在POM的顶部,只覆盖插件,或者我需要复制我的整个配置(资源,testResources等)到XML的配置文件块?

你可以在配置文件中覆盖你的插件配置。

如果你没有在你的配置文件中复制资源/testResources等,maven将使用默认的pom.xml的资源/testResources

最新更新