Hi,
you can add this in your mojo :
/**
* @parameter
expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
* @required
* @readonly
*/
private ArtifactFactory factory;
Emmanuel
Vincent Massol wrote:
Hi,
I need to add the Clover JAR defined in the Clover plugin to the compile CP
of the project using the Clover plugin. This is because the Clover
instruments the source code and thus when compiling the instrumenting
sources the Clover JAR needs to be in the CP.
I've tried doing the following in my CloverMojo:
/**
* @parameter expression="${plugin.artifacts}"
* @required
*/
private List pluginArtifacts;
[...]
private void addCloverDependencyToCompileClasspath()
{
Artifact cloverArtifact = null;
Iterator artifacts = this.pluginArtifacts.iterator();
while (artifacts.hasNext())
{
Artifact artifact = (Artifact) artifacts.next();
if (artifact.getArtifactId().equalsIgnoreCase("clover"))
{
cloverArtifact = artifact;
break;
}
}
List artifactsToAdd = new ArrayList();
artifactsToAdd.add(cloverArtifact);
this.project.addArtifacts(artifactsToAdd,
new DefaultArtifactFactory());
}
The cloverArtifact variable is correctly filled with the Clover artifact but
the addArtifact() call does not seem to add the Clover JAR to the CP since
the compilation gives an error saying that the Clover JAR is missing.
Is that the right way to dynamically add an artifact to the CP?
Thanks
-Vincent
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
T�l�chargez cette version sur http://fr.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]