I have a maven-project, using "test"-phase as well as "integration-test"-phase. In the test-phase, JUnit-Tests are executed, in integration-test there are HTMLUnit-tests. I am using Jacoco[1]-maven-plugin in purpose to measure the codecoverage done by the JUnit-tests of my project. When doing integration-test, I am using maven-embedded-glassfish-plugin to start a glassfish-server and deploy my app before executing the tests.
Sad but true, I have to disable jacoco for time being, as it does not harmony with "integration-test"-phase.
Jacoco's report goal is / should be exceucted at prepare-package-phase, so I assume that it should not influence integration-test-phase. But when I enable jacoco:report, my integration-tests do not run any more because of memory-size problems[2].
How do I stop jacoco:report influencing the integration-test-phase?
[1] http://www.eclemma.org/jacoco/
[2]
java.lang.instrument.IllegalClassFormatException: Error while instrumenting class com/steadystate/css/parser/SACParserCSS21TokenManager.
at org.jacoco.agent.rt_6l8m50.CoverageTransformer.transform(CoverageTransformer.java:91)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at com.steadystate.css.parser.SACParserCSS21.<init>(SACParserCSS21.java:2196)
at com.steadystate.css.parser.SACParserCSS21.<init>(SACParserCSS21.java:23)
at com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.parseCSS(CSSStyleSheet.java:530)
at com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleSheet.<init>(CSSStyleSheet.java:152)
at com.gargoylesoftware.htmlunit.javascript.host.html.HTMLStyleElement.getSheet(HTMLStyleElement.java:73)
at com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList.item(StyleSheetList.java:129)
at com.gargoylesoftware.htmlunit.javascript.host.Window.getComputedStyle(Window.java:1591)
at com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.getCurrentStyle(HTMLElement.java:2465)
at com.gargoylesoftware.htmlunit.html.DomNode.isDisplayed(DomNode.java:688)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.isVisible(HtmlSerializer.java:377)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendText(HtmlSerializer.java:371)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendNode(HtmlSerializer.java:126)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendChildren(HtmlSerializer.java:249)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendNode(HtmlSerializer.java:198)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendChildren(HtmlSerializer.java:249)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendNode(HtmlSerializer.java:198)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendChildren(HtmlSerializer.java:249)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendNode(HtmlSerializer.java:198)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendChildren(HtmlSerializer.java:249)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.appendNode(HtmlSerializer.java:198)
at com.gargoylesoftware.htmlunit.html.HtmlSerializer.asText(HtmlSerializer.java:57)
at com.gargoylesoftware.htmlunit.html.DomNode.asText(DomNode.java:740)
at webappTest.IndexIT.index(IndexIT.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
Caused by: java.lang.RuntimeException: Method code too large!
at org.jacoco.agent.rt_6l8m50.asm.MethodWriter.a(Unknown Source)
at org.jacoco.agent.rt_6l8m50.asm.ClassWriter.toByteArray(Unknown Source)
at org.jacoco.agent.rt_6l8m50.core.instr.Instrumenter.instrument(Instrumenter.java:70)
at org.jacoco.agent.rt_6l8m50.core.instr.Instrumenter.instrument(Instrumenter.java:82)
at org.jacoco.agent.rt_6l8m50.CoverageTransformer.transform(CoverageTransformer.java:89)
... 67 more
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.313 sec
Exception in thread "ThreadedStreamConsumer" Exception in thread "Thread-25" Exception in thread "Thread-26" Exception in thread "DynamicReloader"
Ok, so I see the problem.
The method jjMoveNfa_0 of class
http://grepcode.com/file/repo1.maven.org/maven2/net.sourceforge.cssparser/cssparser/0.9.5/com/steadystate/css/parser/SACParserCSS21TokenManager.java
is insanely long with 4203 loc. So the solution for you should be to avoid instrumentation on this class.
You can exclude package "com.steadystate", which includes the class, by telling the jacoco-maven-plugin to do so:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<configuration>
<excludes>
<exclude>**com.steadystate*</exclude>
</excludes>
...
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With