Nigel Magnay wrote:
Hi people

I'm trying to produce a fix for the cobertura mojo. When it instruments the
code, it adds cobertura as a dependency to the projects 'test' cycle by
doing

       this.project.setDependencyArtifacts( set );
where the set has included the artifact cobertura-1.7 in the 'test' scope.

The problem is, is that the cobertura POM includes asm-2.1. This is a
dependency for running cobertura to *instrument* the code, but it is not a
dependency (and prevents it from working for hibernate projects) a
dependency at runtime.

I hoped I might be able to add a filter in order to prevent this happening -
however I think the bit where the filter is used
(DefaultPluginManager::resolveTransitiveDependencies) manually just creates
a ScopeArtifactFilter, so I have no opportunity to change it to something
that might scope out the dependency.

Am I barking up the wrong tree here, or is there a better way of trying to
do this?

This smells like a scoping problem. ASM is not required for test execution (runtime) by Cobertura, ASM is only needed for swizzling the class files and that part is run during the process-classes phase. Cobertura itself needs it to compile and to instrument but ASM shouldn't end up in the test or runtime scopes/classpaths. I think this points to a tool scope or something akin to it.

If that proves to be the case it's probably not going to be fixed for 2.0.3.

A solution might be to add an artifact exclusion configuration to surefire (possibly only for forking mode). Then the lifecycle.xml for the Cobertura plug-in which controls the execution of surefire could exclude ASM during test runs. That could probably make it into the surefire plug-in's next release if that solution works. That's all I can think of off the top of my head.

I add this for you:

http://jira.codehaus.org/browse/MSUREFIRE-51

--

jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.

  -- Jacques Ellul, The Technological Society

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to