How to disable integration test in Clover
Asked by a b:

I am using maven and Clover in my project, but I do not want the integration test classes get executed. These integration test classes were written a long time ago, which will fail the Clover procedure. Is there a way to disable integration test when running Clover? I am using automation Clover integration.


Answers:
author: Marek Parfianowicz
body: 1) In case your integration tests are launched using maven-failsafe-plugin (and not the maven-surefire-plugin), then you can disable their execution by adding the following parameter in configuration of a Maven Task:

```
-DskipITs=true
```

See: <http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#skipITs>

2) Alternatively, you can use manual Clover integration and do not run the ['integration-test' phase](http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference). For instance:

```
mvn clean clover2:setup test clover2:aggregate clover2:clover -Dmaven.clover.licenseLocation=/path/to/clover.license
```

3) Alternatively, you can also define proper exclusion patterns to omit your integration tests. This works for both maven-surefire-plugin and maven-failsafe-plugin.

See:

<http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#excludes>

<http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#excludes>

comments: author: a b
body: Hi Marek, thanks so much for the reply. I finally adopt 2nd option.1) I configured Clover in a individual job and followed the instructmentcreate a separate Job in which automatic Clover integration is enabledcreate a Maven task in this job, which will do nothing (call the "clean" goal, for instance)Bamboo will automatically add Clover-related goals (clover2:setup verify clover2:aggregate clover2:clover)So in my step it is just a clean command. The -DskipITs=true does not help at all in my test.2) "test" phrase works as expected. Just a bit more complicated than automatically Clover. Finally I figured it out. One thing to mention is the com.atlassian.maven.plugins:: prefix is needed before clover2, otherwise there is an exception related to m2e. I did not add com.atlassian.maven.plugins in my pom.xml. I can not figure the root cause...3) Need update pom.xml or something else. Aside.HOWEVER, the integrating with Clover, it looks like bamboo can not fetch code from Stash frequently. I have to manully run branch, but it is definitely not the spirit of CI. I opened another card <https://answers.atlassian.com/questions/12911103/checkout-default-repository1-failed-with-code-128>Could you please help on this card as well? Thank you!


author: Marek Parfianowicz
body: \> The -DskipITs=true does not help at all in my test.Maybe you're not using maven-cargo-plugin for them? Or test naming convention used is different?\> One thing to mention is the com.atlassian.maven.plugins:: prefix is needed before clover2Maven searches for build plugins in the 'org.apache.maven.plugins' groupId by default. As Clover plugin has "com.atlassian.maven.plugins" gropuId, you have to either use fully qualified name (as you did) or to declare the following snippet in \~/.m2/settings.xml:\<pluginGroups\> \<pluginGroup\>com.atlassian.maven.plugins\</pluginGroup\>\</pluginGroups\>\> otherwise there is an exception related to m2e. \[...\] I can not figure the root cause...Could you share build logs, please? (you can create a ticket on support.atlassian.com or paste a link here)\> HOWEVER, the integrating with Clover, it looks like bamboo can not fetch code from Stash frequently. \[...\] Could you please help on this card as well?I guess this is a problem with Stash. I'll ask Stash team to have a look at it.


author: a b
body: Hi Marek,Thanks for the explanation.We do not use maven-cargo-plugin. My understanding is in automatic integration, according to <https://confluence.atlassian.com/display/BAMBOO/Enabling+the+Clover+add-on>this beneath Maven goals is like "clover2:setup verify clover2:aggregate clover2:clover"And IT will be run during verify phrase.The log related to m2e is here:01-Mar-2015 20:38:49 \[WARNING\] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available01-Mar-2015 20:38:49 \[WARNING\] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0Although it is a warning, I did not see it in a successful build. And all the build steps failed after this warning. So I consider it is a fatal warning.


author: Marek Parfianowicz
body: Could you run a build with debug logging (mvn -X), create a ticket at <http://support.atlassian.com> and attach entire build log, please? I'd love to investigate it.


author: a b
body: Hi @Marek Parfianowicz, I am kind of busy these days. Will update you later.


author: a b
body: hi @Marek Parfianowicz , I created a ticket regarding the m2e exception here <https://support.atlassian.com/servicedesk/customer/portal/13/CLV-6218>Please take a look.Another question is Clover report is not generated in multi-module maven project, could you please take a look as well?<https://answers.atlassian.com/questions/12918095>or <https://support.atlassian.com/servicedesk/customer/portal/13/CLV-6219>I appreciate your great help!


Tags: clover