「テスト」フェーズと「統合テスト」フェーズを使用するmavenプロジェクトがあります。テストフェーズでは JUnit テストが実行され、統合テストでは HTMLUnit テストが実行されます。プロジェクトの JUnit テストによって行われたコードカバレッジを測定する目的で Jacoco[1]-maven-plugin を使用しています。統合テストを行うとき、maven-embedded-glassfish-plugin を使用して Glassfish-server を起動し、テストを実行する前にアプリをデプロイします。
残念ながら、jacoco は「統合テスト」フェーズと調和しないため、当面は無効にする必要があります。
Jacoco のレポートの目標は、パッケージの準備段階で実行する必要があるため、統合テスト段階に影響を与えるべきではないと思います。しかし、jacoco:report を有効にすると、メモリ サイズの問題が原因で統合テストが実行されなくなります [2]。
統合テストフェーズに影響を与える jacoco:report を停止するにはどうすればよいですか?
[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"