maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerome Lacoste" <>
Subject [clover:instrument forked lifecyle] modified project artifacts list do not get propagated to the WAR/EAR mojos. Is this expected ?
Date Wed, 21 May 2008 18:09:51 GMT
Clovered EAR / WAR artifacts lacks clovered versions of transitive
dependencies. Cf: This
issue still exists in the maven clover plugin 3.7 from atlassian.
We've tested maven 2.0.6 and 2.0.9.

The issue is caused apparently as the clover plugins tries to modify
the project artifacts list in a forked lifecycle, but the change is
not propagated to the mojos executed later on. My understanding is
that the way clover tries to achieve this is not possible, as the
forked lifecycle ends before the war/ear mojos are executed.

Can someone confirm this reasoning, and maybe provide an alternative
solution to this problem ?

The clover instrument mojo forks its own lifecycle. This lifecyle then
triggers the clover instrumentInternal after the validate phase. In
this forked lifecycle, the instrumentInternal mojo is bound to the
install phase.

 * @goal instrument
 * @execute phase="install" lifecycle="clover"



So when we run clover:instrument as part of a WAR project we see the
following things happening.

[INFO] [clover:instrument]
[INFO] [clover:instrumentInternal]
[INFO] [resources:resources]
[INFO] [war:war]

As part of clover:instrumentInternal, clover tries to override the
project artifacts and dependency artifacts.
This is done here:

 * @goal instrumentInternal
 * @phase validate
 * @requiresDependencyResolution test

 private void swizzleCloverDependencies()
getProject().getDependencyArtifacts() ) );
            swizzleCloverDependencies( getProject().getArtifacts() ) );

According to the debug logs, the swizzleCloverDependencies does the
thing properly:

[INFO] [clover:instrumentInternal]
DEBUG] [Clover]  source root
[DEBUG] [Clover] List of dependency artifacts after changes:
[DEBUG] [Clover]   Artifact [junit:junit:jar:3.8.1], scope = [test]
[DEBUG] [Clover]   Artifact [com.cenqua.clover:clover:jar:2.1.0],
scope = [compile]
[DEBUG] [Clover]   Artifact [com.test.helloworld:app:jar:clover:1.0],
scope = [compile]
[DEBUG] [Clover] List of artifacts after changes:
[DEBUG] [Clover]   Artifact [junit:junit:jar:3.8.1], scope = [test]
[DEBUG] [Clover]   Artifact [com.test.helloworld:app1:jar:clover:1.0],
scope = [compile]
[DEBUG] [Clover]   Artifact [com.test.helloworld:app:jar:clover:1.0],
scope = [compile]
[DEBUG] Configuring mojo
'org.apache.maven.plugins:maven-resources-plugin:2.2:resources' -->

The problem is when the war mojo is invoked later on, the list of
artifacts is still the old one. I.e. we miss some clovered artifacts.

Did the forked life cycle stop after the execution of the
instrumentInternal mojo and did the changes setArtifacts() get lost ?

Or should I expect maven to appropriately pass the appropriate
artifacts to the war mojo, as invoked as part of this special lifecyle



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message