You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "James Olsen (JIRA)" <ji...@codehaus.org> on 2007/04/23 12:14:26 UTC

[jira] Created: (MCLOVER-70) Non-Clovered Jars used for Transitive Dependencies

Non-Clovered Jars used for Transitive Dependencies
--------------------------------------------------

                 Key: MCLOVER-70
                 URL: http://jira.codehaus.org/browse/MCLOVER-70
             Project: Maven 2.x Clover Plugin
          Issue Type: Bug
    Affects Versions: 2.3
            Reporter: James Olsen


When executing tests or building ear/war archives, the plugin is not using instrumented jars for transitive dependencies.  The ordinary jar is used instead.  Hence no test coverage stats are obtained for those components.  Adding the transitive dependency as a direct dependency on the project results in both the instrumented and plain jar appearing in the archive.  I presume the same also happens for the unit test classpath although I haven't confirmed.

The plugin should use the instrumented version of the jar where available regardless of whether the dependency is direct or transitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCLOVER-70) Non-Clovered Jars used for Transitive Dependencies

Posted by "Indrajit Khare (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCLOVER-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_94704 ] 

Indrajit Khare commented on MCLOVER-70:
---------------------------------------

I noticed this recently as well.  Using the maven-clover-plugin does not give comprehensive coverage numbers.  For projects that have modules that are dependent transitively non-clovered jars are being used for the dependencies when running tests in clover:instrument.

> Non-Clovered Jars used for Transitive Dependencies
> --------------------------------------------------
>
>                 Key: MCLOVER-70
>                 URL: http://jira.codehaus.org/browse/MCLOVER-70
>             Project: Maven 2.x Clover Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: James Olsen
>
> When executing tests or building ear/war archives, the plugin is not using instrumented jars for transitive dependencies.  The ordinary jar is used instead.  Hence no test coverage stats are obtained for those components.  Adding the transitive dependency as a direct dependency on the project results in both the instrumented and plain jar appearing in the archive.  I presume the same also happens for the unit test classpath although I haven't confirmed.
> The plugin should use the instrumented version of the jar where available regardless of whether the dependency is direct or transitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (MCLOVER-70) Non-Clovered Jars used for Transitive Dependencies

Posted by "Thomas Leonard (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCLOVER-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_97677 ] 

Thomas Leonard edited comment on MCLOVER-70 at 5/31/07 7:41 AM:
----------------------------------------------------------------

We have the same problem (two jars in classpath: clover and normal). Applying the patch fixes that, although it still doesn't use the clover version for transitive dependencies not given in the pom.xml.

Note: I have to compile the plugin with tests disabled (revision 535629), otherwise I get:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.maven.plugin.clover.internal.CloverMojoTest
[debug] Loading license from classpath [targetFile]
[debug] Using license file [targetFile]
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec
Running org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest
Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.099 sec <<< FAILURE!

Results :

Failed tests: 
  testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)
testSwizzleCloverDependenciesWhenOriginalVersionOfDependencyIsNewerThanCloveredOne(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)

Tests run: 6, Failures: 2, Errors: 0, Skipped: 0


The actual error is:

-------------------------------------------------------------------------------
Test set: org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest
-------------------------------------------------------------------------------
Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.098 sec <<< FAILURE!
testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)  Time elapsed: 0.031 sec  <<< FAILURE!
org.jmock.core.DynamicMockError: mockArtifact: no match found
Invoked: org.apache.maven.artifact.Artifact.getVersionRange()
Allowed:
stub: getClassifier, returns <null>
stub: getGroupId, returns <null>
stub: getArtifactId, returns <null>
stub: getVersion, returns <null>
stub: getType, returns <null>
stub: getScope, returns <null>
stub: getFile, returns <some/file/cloveredArtifact>
stub: getId, returns <null:null:null:null>
stub: setScope, is void
	at org.jmock.core.AbstractDynamicMock.mockInvocation(Unknown Source)
	at org.jmock.core.CoreMock.invoke(Unknown Source)
	at $Proxy2.getVersionRange(Unknown Source)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojo.swizzleCloverDependencies(CloverInstrumentInternalMojo.java:254)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest.testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(CloverInstrumentInternalMojoTest.java:112)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest.testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(CloverInstrumentInternalMojoTest.java:112)



 was:
We have the same problem. Applying the patch fixes it, but I have to compile the plugin with tests disabled (revision 535629), otherwise I get:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.maven.plugin.clover.internal.CloverMojoTest
[debug] Loading license from classpath [targetFile]
[debug] Using license file [targetFile]
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec
Running org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest
Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.099 sec <<< FAILURE!

Results :

Failed tests: 
  testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)
testSwizzleCloverDependenciesWhenOriginalVersionOfDependencyIsNewerThanCloveredOne(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)

Tests run: 6, Failures: 2, Errors: 0, Skipped: 0


The actual error is:

-------------------------------------------------------------------------------
Test set: org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest
-------------------------------------------------------------------------------
Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.098 sec <<< FAILURE!
testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)  Time elapsed: 0.031 sec  <<< FAILURE!
org.jmock.core.DynamicMockError: mockArtifact: no match found
Invoked: org.apache.maven.artifact.Artifact.getVersionRange()
Allowed:
stub: getClassifier, returns <null>
stub: getGroupId, returns <null>
stub: getArtifactId, returns <null>
stub: getVersion, returns <null>
stub: getType, returns <null>
stub: getScope, returns <null>
stub: getFile, returns <some/file/cloveredArtifact>
stub: getId, returns <null:null:null:null>
stub: setScope, is void
	at org.jmock.core.AbstractDynamicMock.mockInvocation(Unknown Source)
	at org.jmock.core.CoreMock.invoke(Unknown Source)
	at $Proxy2.getVersionRange(Unknown Source)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojo.swizzleCloverDependencies(CloverInstrumentInternalMojo.java:254)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest.testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(CloverInstrumentInternalMojoTest.java:112)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest.testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(CloverInstrumentInternalMojoTest.java:112)


> Non-Clovered Jars used for Transitive Dependencies
> --------------------------------------------------
>
>                 Key: MCLOVER-70
>                 URL: http://jira.codehaus.org/browse/MCLOVER-70
>             Project: Maven 2.x Clover Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: James Olsen
>         Attachments: mclover-70.patch
>
>
> When executing tests or building ear/war archives, the plugin is not using instrumented jars for transitive dependencies.  The ordinary jar is used instead.  Hence no test coverage stats are obtained for those components.  Adding the transitive dependency as a direct dependency on the project results in both the instrumented and plain jar appearing in the archive.  I presume the same also happens for the unit test classpath although I haven't confirmed.
> The plugin should use the instrumented version of the jar where available regardless of whether the dependency is direct or transitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MCLOVER-70) Non-Clovered Jars used for Transitive Dependencies

Posted by "Daniel Gredler (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCLOVER-70?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Gredler updated MCLOVER-70:
----------------------------------

    Attachment: mclover-70.patch

We've run into this issue as well, but it's not so much that transitive dependencies don't get clovered -- the problem is that both clovered and unclovered dependencies get used, meaning some transitive dependencies get their coverage updated, while others don't.

The Clover plugin "clovers" all dependencies (including transitive ones) correctly in CloverInstrumentInternalMojo#swizzleCloverDependencies(), but during the transitive dependency resolution which occurs later, Maven correctly recognizes that the regular versions of the clovered transitive dependencies are no longer referenced, and adds them. The result is that both versions of the transitive dependencies get referenced, and sometimes one version gets used, sometimes the other.

I'm attaching a patch which has fixed the problem for us locally. All it does is wrap clovered artifacts in a special Artifact implementation which delegates equals(), hashCode() and getDependencyConflictId() to a non-clovered artifact, so that during transitive dependency resolution the clovered artifact "looks" like the non-clovered version.

> Non-Clovered Jars used for Transitive Dependencies
> --------------------------------------------------
>
>                 Key: MCLOVER-70
>                 URL: http://jira.codehaus.org/browse/MCLOVER-70
>             Project: Maven 2.x Clover Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: James Olsen
>         Attachments: mclover-70.patch
>
>
> When executing tests or building ear/war archives, the plugin is not using instrumented jars for transitive dependencies.  The ordinary jar is used instead.  Hence no test coverage stats are obtained for those components.  Adding the transitive dependency as a direct dependency on the project results in both the instrumented and plain jar appearing in the archive.  I presume the same also happens for the unit test classpath although I haven't confirmed.
> The plugin should use the instrumented version of the jar where available regardless of whether the dependency is direct or transitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCLOVER-70) Non-Clovered Jars used for Transitive Dependencies

Posted by "Daniel Gredler (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCLOVER-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_97775 ] 

Daniel Gredler commented on MCLOVER-70:
---------------------------------------

Yeah, the patch breaks some unit tests... I think it has to do with some mock objects that are strict about what invocations they allow and when. Just install with -Dmaven.test.ignore :-)

> Non-Clovered Jars used for Transitive Dependencies
> --------------------------------------------------
>
>                 Key: MCLOVER-70
>                 URL: http://jira.codehaus.org/browse/MCLOVER-70
>             Project: Maven 2.x Clover Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: James Olsen
>         Attachments: mclover-70.patch
>
>
> When executing tests or building ear/war archives, the plugin is not using instrumented jars for transitive dependencies.  The ordinary jar is used instead.  Hence no test coverage stats are obtained for those components.  Adding the transitive dependency as a direct dependency on the project results in both the instrumented and plain jar appearing in the archive.  I presume the same also happens for the unit test classpath although I haven't confirmed.
> The plugin should use the instrumented version of the jar where available regardless of whether the dependency is direct or transitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCLOVER-70) Non-Clovered Jars used for Transitive Dependencies

Posted by "Indrajit Khare (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCLOVER-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96236 ] 

Indrajit Khare commented on MCLOVER-70:
---------------------------------------

I applied the patch to a version of the 2.5 code base I have on my system and noticed that though the clover dependencies were being resolved by swizzle correctly they weren't being used in the classpath unless they were direct dependencies.  I added some debug output in the swizzle method and noticed that it was being called twice.  Once for direct dependencies as defined in the pom file and once for all the dependencies (including transtive dependencies).  The ones in the transitive dependencies were then not in the classpath for any other mojo (compile, testCompile, surefire:test].

But with this patch there is now a pattern to the madness, and if I add all transitive dependencies as an explicit dependency in the pom then the correct clover artifacts are used, thus giving the comprehensive coverage I need.

> Non-Clovered Jars used for Transitive Dependencies
> --------------------------------------------------
>
>                 Key: MCLOVER-70
>                 URL: http://jira.codehaus.org/browse/MCLOVER-70
>             Project: Maven 2.x Clover Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: James Olsen
>         Attachments: mclover-70.patch
>
>
> When executing tests or building ear/war archives, the plugin is not using instrumented jars for transitive dependencies.  The ordinary jar is used instead.  Hence no test coverage stats are obtained for those components.  Adding the transitive dependency as a direct dependency on the project results in both the instrumented and plain jar appearing in the archive.  I presume the same also happens for the unit test classpath although I haven't confirmed.
> The plugin should use the instrumented version of the jar where available regardless of whether the dependency is direct or transitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCLOVER-70) Non-Clovered Jars used for Transitive Dependencies

Posted by "Daniel Gredler (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCLOVER-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_96504 ] 

Daniel Gredler commented on MCLOVER-70:
---------------------------------------

The patch should allow you to get comprehensive coverage without having to add all transitive dependencies directly. We have a project with nearly three dozen submodules, and it has been working without hacks for a week now, with this patch applied.

> Non-Clovered Jars used for Transitive Dependencies
> --------------------------------------------------
>
>                 Key: MCLOVER-70
>                 URL: http://jira.codehaus.org/browse/MCLOVER-70
>             Project: Maven 2.x Clover Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: James Olsen
>         Attachments: mclover-70.patch
>
>
> When executing tests or building ear/war archives, the plugin is not using instrumented jars for transitive dependencies.  The ordinary jar is used instead.  Hence no test coverage stats are obtained for those components.  Adding the transitive dependency as a direct dependency on the project results in both the instrumented and plain jar appearing in the archive.  I presume the same also happens for the unit test classpath although I haven't confirmed.
> The plugin should use the instrumented version of the jar where available regardless of whether the dependency is direct or transitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCLOVER-70) Non-Clovered Jars used for Transitive Dependencies

Posted by "Thomas Leonard (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCLOVER-70?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_97677 ] 

Thomas Leonard commented on MCLOVER-70:
---------------------------------------

We have the same problem. Applying the patch fixes it, but I have to compile the plugin with tests disabled (revision 535629), otherwise I get:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.maven.plugin.clover.internal.CloverMojoTest
[debug] Loading license from classpath [targetFile]
[debug] Using license file [targetFile]
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec
Running org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest
Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.099 sec <<< FAILURE!

Results :

Failed tests: 
  testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)
testSwizzleCloverDependenciesWhenOriginalVersionOfDependencyIsNewerThanCloveredOne(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)

Tests run: 6, Failures: 2, Errors: 0, Skipped: 0


The actual error is:

-------------------------------------------------------------------------------
Test set: org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest
-------------------------------------------------------------------------------
Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.098 sec <<< FAILURE!
testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest)  Time elapsed: 0.031 sec  <<< FAILURE!
org.jmock.core.DynamicMockError: mockArtifact: no match found
Invoked: org.apache.maven.artifact.Artifact.getVersionRange()
Allowed:
stub: getClassifier, returns <null>
stub: getGroupId, returns <null>
stub: getArtifactId, returns <null>
stub: getVersion, returns <null>
stub: getType, returns <null>
stub: getScope, returns <null>
stub: getFile, returns <some/file/cloveredArtifact>
stub: getId, returns <null:null:null:null>
stub: setScope, is void
	at org.jmock.core.AbstractDynamicMock.mockInvocation(Unknown Source)
	at org.jmock.core.CoreMock.invoke(Unknown Source)
	at $Proxy2.getVersionRange(Unknown Source)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojo.swizzleCloverDependencies(CloverInstrumentInternalMojo.java:254)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest.testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(CloverInstrumentInternalMojoTest.java:112)
	at org.apache.maven.plugin.clover.CloverInstrumentInternalMojoTest.testSwizzleCloverDependenciesWhenCloveredVersionOfDependencyIsNewerThanOriginal(CloverInstrumentInternalMojoTest.java:112)


> Non-Clovered Jars used for Transitive Dependencies
> --------------------------------------------------
>
>                 Key: MCLOVER-70
>                 URL: http://jira.codehaus.org/browse/MCLOVER-70
>             Project: Maven 2.x Clover Plugin
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: James Olsen
>         Attachments: mclover-70.patch
>
>
> When executing tests or building ear/war archives, the plugin is not using instrumented jars for transitive dependencies.  The ordinary jar is used instead.  Hence no test coverage stats are obtained for those components.  Adding the transitive dependency as a direct dependency on the project results in both the instrumented and plain jar appearing in the archive.  I presume the same also happens for the unit test classpath although I haven't confirmed.
> The plugin should use the instrumented version of the jar where available regardless of whether the dependency is direct or transitive.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira