RE: [m2] How to add an artifact dynamically to the CP?
> -Original Message- > From: Brett Porter [mailto:[EMAIL PROTECTED] > Sent: mardi 14 juin 2005 10:58 > To: Maven Developers List > Subject: Re: [m2] How to add an artifact dynamically to the CP? [snip] > >- I don't have much hope that the Clover plugin will be able to be reused > in > >another context... It's too bound to the execution lifecycle I think. > > > > > The task itself should be though - you are just relying on the lifecycle > to get you a database. You just process the database. That's easy enough > to use elsewhere. Right but then what's the advantage over directly using the Clover API? [snip] 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]
RE: [m2] How to add an artifact dynamically to the CP?
> -Original Message- > From: Brett Porter [mailto:[EMAIL PROTECTED] > Sent: mardi 14 juin 2005 10:58 > To: Maven Developers List > Subject: Re: [m2] How to add an artifact dynamically to the CP? [snip] > >- I don't have much hope that the Clover plugin will be able to be reused > in > >another context... It's too bound to the execution lifecycle I think. > > > > > The task itself should be though - you are just relying on the lifecycle > to get you a database. You just process the database. That's easy enough > to use elsewhere. Right but then what's the advantage over directly using the Clover API? [snip] 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]
Re: [m2] How to add an artifact dynamically to the CP?
Vincent Massol wrote: Hi Michal, Thanks for the suggestion. Several points: - I would prefer to use the Mojo API for now as it allows me to learn how to use it, to flesh it out if required - I don't have much hope that the Clover plugin will be able to be reused in another context... It's too bound to the execution lifecycle I think. The task itself should be though - you are just relying on the lifecycle to get you a database. You just process the database. That's easy enough to use elsewhere. - If I use plexus then am I not simply replacing the maven dep by the plexus dep (actually I'll be adding it as the maven dep will always be needed I think). ATM, someone could reuse the Mojos that I have written. They would simply need to provide implementations for the Maven interfaces. But again I don't think it could be reused easily. Yes, manually doing work Maven does for you is not a good idea. - What about the other Mojos they're all bound to Maven too? Some more than they need to be. Ideally it shouldn't be necessary, unless you are doing Maven project specific things. eg. if you just need the packaging - use ${project.packaging}, not ${project} where you later get the packaging. It's ok for them to depend on maven-artifact, the model or such - they can be used outside of Maven. It's more the construction of those things that is a bigger deal usually. - Brett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [m2] How to add an artifact dynamically to the CP?
Hi Michal, Thanks for the suggestion. Several points: - I would prefer to use the Mojo API for now as it allows me to learn how to use it, to flesh it out if required - I don't have much hope that the Clover plugin will be able to be reused in another context... It's too bound to the execution lifecycle I think. - If I use plexus then am I not simply replacing the maven dep by the plexus dep (actually I'll be adding it as the maven dep will always be needed I think). ATM, someone could reuse the Mojos that I have written. They would simply need to provide implementations for the Maven interfaces. But again I don't think it could be reused easily. - What about the other Mojos they're all bound to Maven too? I'm probably missing something though... :-) Thanks -Vincent > -Original Message- > From: Michal Maczka [mailto:[EMAIL PROTECTED] > Sent: mardi 14 juin 2005 08:12 > To: Maven Developers List > Subject: Re: [m2] How to add an artifact dynamically to the CP? > > 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. > > > > > > > > > > Vincent, > > Maybe completly stupid and wrong proposition/idea - but wouldn't it be > simpler for you to reuse some plexus components directly in your clover > plugin > rather then to relay on maven lifecycle execution with some strange > tricks? > > As I understand mojo api - the main reason why it looks like it looks > was to make mojo standalone and reusable outside maven. > Doesn't it mean that clover mojo should also be aiming to be possibly > usable without maven? > > In you case you can probably reuse plexus compiler and test runner > components and bent them to your needs.. > > greets > > Michal ___ 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]
RE: [m2] How to add an artifact dynamically to the CP?
Hi Michal, Thanks for the suggestion. Several points: - I would prefer to use the Mojo API for now as it allows me to learn how to use it, to flesh it out if required - I don't have much hope that the Clover plugin will be able to be reused in another context... It's too bound to the execution lifecycle I think. - If I use plexus then am I not simply replacing the maven dep by the plexus dep (actually I'll be adding it as the maven dep will always be needed I think). ATM, someone could reuse the Mojos that I have written. They would simply need to provide implementations for the Maven interfaces. But again I don't think it could be reused easily. - What about the other Mojos they're all bound to Maven too? I'm probably missing something though... :-) Thanks -Vincent > -Original Message- > From: Michal Maczka [mailto:[EMAIL PROTECTED] > Sent: mardi 14 juin 2005 08:12 > To: Maven Developers List > Subject: Re: [m2] How to add an artifact dynamically to the CP? > > 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. > > > > > > > > > > Vincent, > > Maybe completly stupid and wrong proposition/idea - but wouldn't it be > simpler for you to reuse some plexus components directly in your clover > plugin > rather then to relay on maven lifecycle execution with some strange > tricks? > > As I understand mojo api - the main reason why it looks like it looks > was to make mojo standalone and reusable outside maven. > Doesn't it mean that clover mojo should also be aiming to be possibly > usable without maven? > > In you case you can probably reuse plexus compiler and test runner > components and bent them to your needs.. > > greets > > Michal ___ 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]
Re: [m2] How to add an artifact dynamically to the CP?
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. Vincent, Maybe completly stupid and wrong proposition/idea - but wouldn't it be simpler for you to reuse some plexus components directly in your clover plugin rather then to relay on maven lifecycle execution with some strange tricks? As I understand mojo api - the main reason why it looks like it looks was to make mojo standalone and reusable outside maven. Doesn't it mean that clover mojo should also be aiming to be possibly usable without maven? In you case you can probably reuse plexus compiler and test runner components and bent them to your needs.. greets Michal -- Znajdz swoja milosc na wiosne... >>> http://link.interia.pl/f187a - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [m2] How to add an artifact dynamically to the CP?
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]
RE: [m2] How to add an artifact dynamically to the CP?
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]
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]
RE: [m2] How to add an artifact dynamically to the CP?
Hi John, > -Original Message- > From: John Casey [mailto:[EMAIL PROTECTED] > Sent: lundi 13 juin 2005 20:23 > To: Maven Developers List > Subject: Re: [m2] How to add an artifact dynamically to the CP? [snip] > Personally, I'm not that wild about using params as return values (which > is very much like what modifying the List of artifacts would be)...on > the other hand, if you need to modify something (since the return type > is void), I think modifying the project instance is much more intuitive. > But that's just my opinion... I agree. > Vincent, if the aforementioned addCompileClasspathElement() doesn't > exist, let me know. It doesn't exist... :-) [snip] 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]
RE: [m2] How to add an artifact dynamically to the CP?
Hi John, > -Original Message- > From: John Casey [mailto:[EMAIL PROTECTED] > Sent: lundi 13 juin 2005 20:23 > To: Maven Developers List > Subject: Re: [m2] How to add an artifact dynamically to the CP? [snip] > Personally, I'm not that wild about using params as return values (which > is very much like what modifying the List of artifacts would be)...on > the other hand, if you need to modify something (since the return type > is void), I think modifying the project instance is much more intuitive. > But that's just my opinion... I agree. > Vincent, if the aforementioned addCompileClasspathElement() doesn't > exist, let me know. It doesn't exist... :-) [snip] 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]
Re: [m2] How to add an artifact dynamically to the CP?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I would imagine you will need to interact more with the project in this case, but I'm not sure. If there isn't already, there should be methods on MavenProject that allow something similar to: project.addCompileClasspathElement( File|Artifact element ); using a similar pattern to: project.addCompileSourceRoot( String sourceRoot ); Personally, I'm not that wild about using params as return values (which is very much like what modifying the List of artifacts would be)...on the other hand, if you need to modify something (since the return type is void), I think modifying the project instance is much more intuitive. But that's just my opinion... Vincent, if the aforementioned addCompileClasspathElement() doesn't exist, let me know. - -john 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] > > > -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFCrc7uK3h2CZwO/4URAmI/AJ0d+/QBq6rnN4+rj2FvzIIClQDdrACeITme 1zjvVUCFytcdXQq6w6qqkps= =EODv -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[m2] How to add an artifact dynamically to the CP?
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]
[m2] How to add an artifact dynamically to the CP?
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]