You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Geoff Macartney (JIRA)" <ji...@apache.org> on 2017/01/04 16:37:58 UTC
[jira] [Commented] (BROOKLYN-158) Brooklyn dependencyConvergence
enforcer fails when run with cobertura-maven-plugin
[ https://issues.apache.org/jira/browse/BROOKLYN-158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15798681#comment-15798681 ]
Geoff Macartney commented on BROOKLYN-158:
------------------------------------------
I tried out Jacoco (added the following profile in brooklyn-parent pom.xml)
{code:xml}
<profile>
<id>Jacoco</id>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals><goal>prepare-agent</goal></goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals><goal>report</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<argLine>${argLine} -Xms768m -Xmx768m -XX:MaxPermSize=256m -verbose:gc -XX:SoftRefLRUPolicyMSPerMB=1</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce</id>
<phase>none</phase>
</execution>
<execution>
<id>brooklyn-build-req</id>
<goals>
<goal>enforce</goal>
</goals>
<inherited>true</inherited>
<configuration combine.self="override">
<rules>
<requireJavaVersion>
<version>${java.version}.0</version>
</requireJavaVersion>
<requireMavenVersion>
<version>[3.0.0,)</version>
</requireMavenVersion>
<!--<dependencyConvergence/>-->
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
{code}
Note, the profile had to add overrides for a couple of plugins - maven-enforcer-plugin, to turn off the {{dependencyConvergence}}, and surefire, to add in an extra property to the {{argLine}} specification, to avoid Jacoco complaining about [missing data files|http://stackoverflow.com/questions/18107375/getting-skipping-jacoco-execution-due-to-missing-execution-data-file-upon-exec].
The above worked and in some folders of brooklyn-server it generated coverage results for me, however:
1. The results are not very much use as they don't work across modules, e.g. if you build in the
camp-brooklyn module you only get coverage results for the src/main/java in that module
{code}
Element Missed Instructions Cov. Missed Branches Cov. Missed Cxty Missed Lines Missed Methods Missed Classes
Total 2,487 of 9,426 73% 303 of 808 62% 301 842 363 1,774 86 434 7 79
org.apache.brooklyn.camp.brooklyn.spi.dsl.methods 8702,361 73% 158116 42% 120 303 128 554 27 162 2 28
org.apache.brooklyn.camp.brooklyn.spi.creation 7102,788 79% 78248 76% 93 304 94 680 24 141 2 23
org.apache.brooklyn.camp.brooklyn.spi.dsl 264807 75% 3179 71% 26 88 30 194 3 33 0 5
org.apache.brooklyn.camp.brooklyn 232199 46% 113 21% 22 42 53 105 15 35 2 8
org.apache.brooklyn.camp.brooklyn.spi.lookup 166215 56% 79 56% 12 29 27 77 6 21 0 7
org.apache.brooklyn.camp.brooklyn.spi.dsl.parse 136358 72% 1440 74% 16 41 11 91 2 14 0 3
org.apache.brooklyn.camp.brooklyn.spi.creation.service 97139 58% 410 71% 11 26 19 57 8 19 1 4
org.apache.brooklyn.camp.brooklyn.spi.platform 72 85% n/a 1 9 1 16 1 9 0 1
{code}
and not also coverage for brooklyn-core.
2. when I run it from the main brooklyn-server directory I get test failures in brooklyn-core as follows
{code}
===============================================
Surefire test
Tests run: 2013, Failures: 2, Skips: 0
===============================================
[GC (Allocation Failure) 409053K->165867K(776704K), 0.0050503 secs]
Tests run: 2013, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 137.307 sec <<< FAILURE! - in TestSuite
testXStreamDeserialize(org.apache.brooklyn.util.core.xstream.CompilerCompatibilityTest) Time elapsed: 0.013 sec <<< FAILURE!
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException:
No such field org.apache.brooklyn.util.core.xstream.CompilerCompatibilityTest$EnclosingClass$DynamicClass.this$1
---- Debugging information ----
field : this$1
class : org.apache.brooklyn.util.core.xstream.CompilerCompatibilityTest$EnclosingClass$DynamicClass
required-type : org.apache.brooklyn.util.core.xstream.CompilerCompatibilityTest$EnclosingClass$DynamicClass
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /org.apache.brooklyn.util.core.xstream.CompilerCompatibilityTest/dynamicClass/this$1
line number : 23
class[1] : org.apache.brooklyn.util.core.xstream.CompilerCompatibilityTest
version : not available
-------------------------------
at org.apache.brooklyn.util.core.xstream.CompilerCompatibilityTest.deserialize(CompilerCompatibilityTest.java:132)
at org.apache.brooklyn.util.core.xstream.CompilerCompatibilityTest.testXStreamDeserialize(CompilerCompatibilityTest.java:118)
testRenamedNonStaticInner(org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializerTest) Time elapsed: 0.004 sec <<< FAILURE!
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException:
No such field org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializerTest$MyStaticInner$MyNonStaticInner.this$1
---- Debugging information ----
field : this$1
class : org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializerTest$MyStaticInner$MyNonStaticInner
required-type : org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializerTest$MyStaticInner$MyNonStaticInner
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializerTest$MyStaticInner$MyNonStaticInner/this$1
line number : 3
version : not available
-------------------------------
at org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializerTest.runRenamed(XmlMementoSerializerTest.java:193)
at org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializerTest.testRenamedNonStaticInner(XmlMementoSerializerTest.java:171)
2017-01-04 13:22:37,665 INFO Brooklyn shutdown: stopping entities [TestEntityImpl{id=h6d4na1pd0}, TestEntityImpl{id=wdf33mkmjk}, BlockingEntityImpl{id=dzbmg9835v}]
Results :
Failed tests:
XmlMementoSerializerTest.testRenamedNonStaticInner:171->runRenamed:193 » UnknownField
CompilerCompatibilityTest.testXStreamDeserialize:118->deserialize:132 » UnknownField
Tests run: 2013, Failures: 2, Errors: 0, Skipped: 0
{code}
I also ran -PCoverage to see what coberatura would give me, with modifying the Coverage profile to include the same override of the
maven-enforcer-plugin, however, I didn't see the same behaviour mentioned by [~aled.sage] with coverage of 1.0, instead, the build
breaks almost at once with
{code}
[INFO] --- maven-antrun-plugin:1.8:run (instrument classes) @ brooklyn-utils-test-support ---
[INFO] Executing tasks
main:
[echo] INSTRUMENTING CLASSES FOR COBERTURA
[copy] Copying 14 files to /Users/geoff/workspaces/geomacy/brooklyn/brooklyn/brooklyn-server/utils/test-support/target/cobertura/coverage-classes
[cobertura-instrument] Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
[cobertura-instrument] at net.sourceforge.cobertura.instrument.InstrumentMain$LoggerWrapper.<init>(InstrumentMain.java:165)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.InstrumentMain$LoggerWrapper.<init>(InstrumentMain.java:164)
[cobertura-instrument] at net.sourceforge.cobertura.instrument.InstrumentMain.<clinit>(InstrumentMain.java:66)
[cobertura-instrument] Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
[cobertura-instrument] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[cobertura-instrument] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[cobertura-instrument] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
[cobertura-instrument] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[cobertura-instrument] ... 3 more
{code}
> Brooklyn dependencyConvergence enforcer fails when run with cobertura-maven-plugin
> ----------------------------------------------------------------------------------
>
> Key: BROOKLYN-158
> URL: https://issues.apache.org/jira/browse/BROOKLYN-158
> Project: Brooklyn
> Issue Type: Bug
> Affects Versions: 1.0.0
> Reporter: Aled Sage
>
> When building Brooklyn with `mvn clean install -PCoverage`, it fails in the maven-enforcer-plugin due to the dependencyConvergence rule.
> The workaround is to comment out the dependencyConvergence rule in the maven-enforcer-plugin plugin, in the parent/pom.xml.
> The Coverage profile pulls in:
> {noformat}
> <dependency>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>cobertura-maven-plugin</artifactId>
> <version>${cobertura.plugin.version}</version>
> <scope>test</scope>
> </dependency>
> {noformat}
> The error is things like that below (plus another couple of hundred lines of this).
> {noformat}
> [INFO] --- maven-enforcer-plugin:1.4:enforce (brooklyn-build-req) @ brooklyn-parent ---
> [WARNING]
> Dependency convergence error for junit:junit:3.8.2 paths to dependency are:
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-net.sourceforge.cobertura:cobertura:2.1.1
> +-org.apache.ant:ant-junit:1.8.3
> +-junit:junit:3.8.2
> and
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-net.sourceforge.cobertura:cobertura:2.1.1
> +-junit:junit:4.11
> and
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-org.apache.maven:maven-core:2.0.8
> +-org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1
> +-junit:junit:3.8.1
> [WARNING]
> Dependency convergence error for org.apache.maven:maven-project:2.0.8 paths to dependency are:
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-org.apache.maven:maven-core:2.0.8
> +-org.apache.maven:maven-project:2.0.8
> and
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-org.apache.maven:maven-project:2.0.8
> and
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-org.apache.maven.reporting:maven-reporting-impl:2.0.4.2
> +-org.apache.maven:maven-project:2.0.4
> [WARNING]
> Dependency convergence error for org.apache.maven.reporting:maven-reporting-api:2.0.8 paths to dependency are:
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-org.apache.maven:maven-core:2.0.8
> +-org.apache.maven.reporting:maven-reporting-api:2.0.8
> and
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-org.apache.maven.reporting:maven-reporting-api:2.0.8
> and
> +-org.apache.brooklyn:brooklyn-parent:0.8.0-SNAPSHOT
> +-org.codehaus.mojo:cobertura-maven-plugin:2.7
> +-org.apache.maven.reporting:maven-reporting-impl:2.0.4.2
> +-org.apache.maven.reporting:maven-reporting-api:2.0.4
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)