1

I have a maven pom.xml for a project, which does not use inheritance. I want to skip 1 test sometimes. I want to run mvn -P jenkins and have the following enabled:

<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>

Can I just have:

<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>

at the top of the POM and override just the plugins, or do I need to copy my whole configuration (resources, testResources, etc) into the profile block of XML?

mikeb
  • 10,578
  • 7
  • 62
  • 120

1 Answers1

2

You can just override your plugin configuration on the profile.

If you don't copy resources/testResources etc on your profile, maven will use default resources/testResources of the pom.xml

fabballe
  • 761
  • 4
  • 12