On Fri, May 23, 2008 at 7:59 AM, Jerome Lacoste <[EMAIL PROTECTED]> wrote: > On Wed, May 21, 2008 at 8:09 PM, Jerome Lacoste > <[EMAIL PROTECTED]> wrote: >> Clovered EAR / WAR artifacts lacks clovered versions of transitive >> dependencies. Cf: http://jira.codehaus.org/browse/MCLOVER-70. This >> issue still exists in the maven clover plugin 3.7 from atlassian. >> We've tested maven 2.0.6 and 2.0.9.
I've had some time to investigate the problem further. Maven re-resolves the list of transitive dependencies for each plugin it runs that uses requiresDependencyResolution. The results are different depending in which phase the plugin is to going to get ran. At the same time, clover with its "swizzle" method, tried to redefine the list of dependencies. Doing so, it worked with a set of transitive dependencies that is going to be discarded in a later phase by maven. I managed to hack maven to do what I want. I've added a way to register the "swizzle" functionality from clover so that this operation gets registered and applied each time the artifacts are re-resolved and the transitive dependencies reset: public void setArtifacts( Set artifacts ) { this.artifacts = artifacts; // flush the calculated artifactMap this.artifactMap = null; + + postProcessArtifacts(); } + public static interface ArtifactPostProcessor { + Set convert( Set artifacts ); + } + + private List artifactPostProcessors = new ArrayList(); + + public void addArtifactPostProcessor( ArtifactPostProcessor artifactPostProcessor ) + { + artifactPostProcessors.add( artifactPostProcessor ); + } + + private void postProcessArtifacts() { + for ( Iterator i = artifactPostProcessors.iterator(); i.hasNext(); ) + { + ArtifactPostProcessor postProcessor = (ArtifactPostProcessor) i.next(); + + this.artifacts = postProcessor.convert( this.artifacts ); + } + } + This requires a change of the clover plugin of course. I've tested it with my simple helloWorld WAR project and all transitive dependencies are now added properly. I expect it to work with EARs as well. Not sure what a better solution should be, especially in light of 2.1.x. A better idea ? Or is there no solution to this problem ? Jerome --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]