Thanks Emmanuel,

I've tried replacing:

this.project.addArtifacts(artifactsToAdd,
    DefaultArtifactFactory());

With:

    /**
     * @parameter
expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
     * @required
     * @readonly
     */
   private ArtifactFactory factory;


this.project.addArtifacts(artifactsToAdd, this.artifact);

but it didn't help.

Thanks
-Vinnt

> -----Original Message-----
> From: Emmanuel Venisse [mailto:[EMAIL PROTECTED]
> Sent: lundi 13 juin 2005 20:06
> To: Maven Developers List
> Subject: Re: [m2] How to add an artifact dynamically to the CP?
> 
> 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]







___________________________________________________________________________
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]

Reply via email to