Hi,
I am developing a jira plugin. I started writing tests and I saw the jira-maven-plugin uses surefire and failsafe plugin under the hood (I guess). I got some problems running integration test. After I found the way where test class needs to be placed I tried to change the configuration of both plugins but I was not successful. My question is:
How can I change both configurations (espacially the include/exlude pattern)?
Community moderators have prevented the ability to post new answers.
Hi Alexander,
Short answer: don't fight it with executions — just declare the plugins with a configuration block and AMPS merges it in.
AMPS doesn't bind surefire/failsafe to the lifecycle the normal way. It invokes those goals itself (via MojoExecutor) so the ITs run in the window between the host app starting and shutting down. But AMPS is meant to respect any configuration you provide in the build/plugins section of your POM. So:
<build>
<plugins>
<!-- unit tests: atlas-unit-test / mvn test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes><include>**/*UnitTest.java</include></includes>
<excludes><exclude>it/**</exclude></excludes>
</configuration>
</plugin>
<!-- integration tests: atlas-integration-test / mvn integration-test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes><include>it/**/*Test.java</include></includes>
</configuration>
</plugin>
</plugins>
</build>
No version element, no executions, no phase. If you add executions of your own they'll fire outside the AMPS window and the host application won't be up — which is usually why people see "Confluence/Jira starts, stops, no tests ran".
Two things that trip people up:
it package is the default for a reason. AMPS runs all the tests in your project's it package against the started host application, with ut the convention for unit tests. If you just move your IT classes under src/test/java/it/... and name them *Test.java, you may not need to override anything.For quick ad-hoc filtering, -Dtest= and -Dit.test= work as usual.
--Hugo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.