AW: How to add a dependency dynamically during the build in a plugin?

2009-01-16 Thread Lewis, Eric
Well, if anyone has a better idea how to add JARs to the dependencies which are 
created by another process (and are out of Maven's control), I'm all ears  :-)
Basically my problem is the webstart plugin which adds JARs only from the 
dependencies to the WAR it creates. As I mentioned, these WARs come from 
another build, so I can't reach them.

Best regards,
Eric

> -Ursprüngliche Nachricht-
> Von: Wayne Fay [mailto:wayne...@gmail.com] 
> Gesendet: Donnerstag, 15. Januar 2009 19:08
> An: Maven Users List
> Betreff: Re: How to add a dependency dynamically during the 
> build in a plugin?
> 
> >> I just started to write my first plugin which should add some JARs
> >> dynamically to the project's dependencies.
> 
> Adding dependencies dynamically during the build is generally regarded
> as a "bad idea" for various reasons.
> 
> So, I don't expect that you will get much of a response to this...
> 
> Wayne
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 
> 

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: AW: How to add a dependency dynamically during the build in a plugin?

2009-01-15 Thread Eugene Kuleshov

Eric,

  Short answer, please don't do it. Plugins that add dependencies like that
cause major grief to any ide integrations and also make it impossible to
change versions of used dependencies, essentially making your plugin less
useful.

  regards,
  Eugene



Lewis, Eric-2 wrote:
> 
> Anyone?  :-) 
> 
>> -Ursprüngliche Nachricht-
>> Von: Lewis, Eric [mailto:eric.le...@ipi.ch] 
>> Gesendet: Dienstag, 13. Januar 2009 14:15
>> An: Maven Users List
>> Betreff: How to add a dependency dynamically during the build 
>> in a plugin?
>> 
>> Hi
>> 
>> I just started to write my first plugin which should add some JARs
>> dynamically to the project's dependencies.
>> Unfortunately, I found no documentation about how to add a 
>> dependency at
>> runtime (Sonatype book, Maven site, blogs...).
>> 
>> I have the project injected by Plexus and want to add some 
>> dependencies
>> like this:
>>   Dependency dependency = new Dependency();
>>   dependency.setGroupId(groupId);
>>   dependency.setArtifactId(artifactId);
>>   dependency.setVersion(version);
>>   dependency.setScope("system");
>>   dependency.setSystemPath(jarFile.getAbsolutePath());
>>   this.project.getDependencies().add(dependency);
>> 
>> When using this.project.getDependencies() later on, I find those
>> dependencies.
>> 
>> However, I also added the Maven dependency plugin later in 
>> the build to
>> have a list of dependencies:
>>   
>> org.apache.maven.plugins
>> maven-dependency-plugin
>> 
>>   
>> package
>> 
>>   list
>> 
>>   
>> 
>> 
>>   true
>>  
>> true
>> 
>>   
>> 
>> But it only shows the existing dependencies from the POM:
>> [INFO] [dependency:list {execution: default}]
>> [INFO] 
>> [INFO] The following files have been resolved:
>> [INFO]commons-lang:commons-lang:jar:2.4:compile:C:\Documents and
>> Settings\xyz\.m2\repository\commons-lang\commons-lang\2.4\comm
>> ons-lang-2
>> .4.jar
>> 
>> So obviously, it doesn't work.
>> 
>> I also tried
>> this.project.getDependencyManagement().addDependency(dependency);
>> 
>> which didn't change anything.
>> 
>> Is there a reference about the internals of the dependency mechanism?
>> 
>> Best regards,
>> Eric
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-add-a-dependency-dynamically-during-the-build-in-a-plugin--tp21435580p21480117.html
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



AW: How to add a dependency dynamically during the build in a plugin?

2009-01-15 Thread Lewis, Eric
Anyone?  :-) 

> -Ursprüngliche Nachricht-
> Von: Lewis, Eric [mailto:eric.le...@ipi.ch] 
> Gesendet: Dienstag, 13. Januar 2009 14:15
> An: Maven Users List
> Betreff: How to add a dependency dynamically during the build 
> in a plugin?
> 
> Hi
> 
> I just started to write my first plugin which should add some JARs
> dynamically to the project's dependencies.
> Unfortunately, I found no documentation about how to add a 
> dependency at
> runtime (Sonatype book, Maven site, blogs...).
> 
> I have the project injected by Plexus and want to add some 
> dependencies
> like this:
>   Dependency dependency = new Dependency();
>   dependency.setGroupId(groupId);
>   dependency.setArtifactId(artifactId);
>   dependency.setVersion(version);
>   dependency.setScope("system");
>   dependency.setSystemPath(jarFile.getAbsolutePath());
>   this.project.getDependencies().add(dependency);
> 
> When using this.project.getDependencies() later on, I find those
> dependencies.
> 
> However, I also added the Maven dependency plugin later in 
> the build to
> have a list of dependencies:
>   
> org.apache.maven.plugins
> maven-dependency-plugin
> 
>   
> package
> 
>   list
> 
>   
> 
> 
>   true
>  
> true
> 
>   
> 
> But it only shows the existing dependencies from the POM:
> [INFO] [dependency:list {execution: default}]
> [INFO] 
> [INFO] The following files have been resolved:
> [INFO]commons-lang:commons-lang:jar:2.4:compile:C:\Documents and
> Settings\xyz\.m2\repository\commons-lang\commons-lang\2.4\comm
> ons-lang-2
> .4.jar
> 
> So obviously, it doesn't work.
> 
> I also tried
> this.project.getDependencyManagement().addDependency(dependency);
> 
> which didn't change anything.
> 
> Is there a reference about the internals of the dependency mechanism?
> 
> Best regards,
> Eric
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 
> 

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org