diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-11-11 15:21:30 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-11-11 16:11:01 +0400 |
commit | fdcfd70b54b4ed3a97ae0f6ca5d4ac2aa7ebeb7e (patch) | |
tree | db1b4754bbe07e79ac93b779cd1e1b3c36caa298 /plugins/sonar-jacoco-plugin | |
parent | cab2f0e2a5a6ba3b294e3be356a363fd1c93689f (diff) | |
download | sonarqube-fdcfd70b54b4ed3a97ae0f6ca5d4ac2aa7ebeb7e.tar.gz sonarqube-fdcfd70b54b4ed3a97ae0f6ca5d4ac2aa7ebeb7e.zip |
SONAR-2792 Add default exclusions for JaCoCo
Diffstat (limited to 'plugins/sonar-jacoco-plugin')
3 files changed, 14 insertions, 4 deletions
diff --git a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoConfiguration.java b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoConfiguration.java index b0bb0e8bb6e..d34579343a8 100644 --- a/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoConfiguration.java +++ b/plugins/sonar-jacoco-plugin/src/main/java/org/sonar/plugins/jacoco/JacocoConfiguration.java @@ -49,6 +49,7 @@ import org.sonar.api.config.Settings; @Property( key = JacocoConfiguration.EXCLUDES_PROPERTY, name = "Excludes", + defaultValue = JacocoConfiguration.EXCLUDES_DEFAULT_VALUE, description = "A list of class names that should be excluded from execution analysis." + " The list entries are separated by a colon (:) and may use wildcard characters (* and ?)." + " Except for performance optimization or technical corner cases this option is normally not required.", @@ -93,6 +94,15 @@ public class JacocoConfiguration implements BatchExtension { public static final String IT_REPORT_PATH_DEFAULT_VALUE = ""; public static final String INCLUDES_PROPERTY = "sonar.jacoco.includes"; public static final String EXCLUDES_PROPERTY = "sonar.jacoco.excludes"; + + /** + * Hibernate uses Javassist to modify entity classes and without exclusion of such classes from JaCoCo exception might be thrown: + * <pre> + * Javassist Enhancement failed: org.sonar.api.profiles.Alert + * java.lang.VerifyError: (class: org/sonar/api/profiles/Alert_$$_javassist_3, method: <clinit> signature: ()V) Illegal local variable number + * </pre> + */ + public static final String EXCLUDES_DEFAULT_VALUE = "*_javassist_*"; public static final String EXCLCLASSLOADER_PROPERTY = "sonar.jacoco.exclclassloader"; public static final String ANT_TARGETS_PROPERTY = "sonar.jacoco.antTargets"; public static final String ANT_TARGETS_DEFAULT_VALUE = ""; diff --git a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoMavenPluginHandlerTest.java b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoMavenPluginHandlerTest.java index da4d93ef83c..a4f3fb368cb 100644 --- a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoMavenPluginHandlerTest.java +++ b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JaCoCoMavenPluginHandlerTest.java @@ -72,7 +72,7 @@ public class JaCoCoMavenPluginHandlerTest { handler.configure(project, plugin); verify(configuration).getJvmArgument(); - assertThat(plugin.getParameter("argLine"), is("-javaagent:jacocoagent.jar=destfile=target/jacoco.exec")); + assertThat(plugin.getParameter("argLine"), is("-javaagent:jacocoagent.jar=destfile=target/jacoco.exec,excludes=*_javassist_*")); assertThat(plugin.getParameter("testFailureIgnore"), is("true")); } @@ -84,7 +84,7 @@ public class JaCoCoMavenPluginHandlerTest { handler.configure(project, plugin); verify(configuration).getJvmArgument(); - assertThat(plugin.getParameter("argLine"), is("-javaagent:jacocoagent.jar=destfile=target/jacoco.exec -esa")); + assertThat(plugin.getParameter("argLine"), is("-javaagent:jacocoagent.jar=destfile=target/jacoco.exec,excludes=*_javassist_* -esa")); assertThat(plugin.getParameter("testFailureIgnore"), is("true")); } diff --git a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JacocoConfigurationTest.java b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JacocoConfigurationTest.java index 212a3a30edb..70dd2dea60a 100644 --- a/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JacocoConfigurationTest.java +++ b/plugins/sonar-jacoco-plugin/src/test/java/org/sonar/plugins/jacoco/JacocoConfigurationTest.java @@ -51,7 +51,7 @@ public class JacocoConfigurationTest { @Test public void defaults() { assertThat(jacocoConfiguration.getReportPath(), is("target/jacoco.exec")); - assertThat(jacocoConfiguration.getJvmArgument(), is("-javaagent:jacocoagent.jar=destfile=target/jacoco.exec")); + assertThat(jacocoConfiguration.getJvmArgument(), is("-javaagent:jacocoagent.jar=destfile=target/jacoco.exec,excludes=*_javassist_*")); assertThat(jacocoConfiguration.getItReportPath(), nullValue()); @@ -79,7 +79,7 @@ public class JacocoConfigurationTest { configuration.setProperty(JacocoConfiguration.REPORT_PATH_PROPERTY, "jacoco.exec"); assertThat(jacocoConfiguration.getReportPath(), is("jacoco.exec")); - assertThat(jacocoConfiguration.getJvmArgument(), is("-javaagent:jacocoagent.jar=destfile=jacoco.exec")); + assertThat(jacocoConfiguration.getJvmArgument(), is("-javaagent:jacocoagent.jar=destfile=jacoco.exec,excludes=*_javassist_*")); } @Test |