You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by EJ Ciramella <ej...@upromise.com> on 2007/12/12 08:08:22 UTC

Getting a dependency list in a custom plugin

Hello all - I have what seems like a simple question that's got me
stumped at the moment.
 
Is there a way to iterate over the dependencies in a particular project
inside a custom plugin?
 
I keep wanting to do something like:
 
     ArrayList deps = (ArrayList) proj.getDependencies();
     for(int x = 0; x < deps.size(); x++)
     {
      getLog().info("--> "+deps.get(x));
     }
 
Just for testing purposes, but at runtime, I keep getting this
stacktrace:
 
java.lang.NoClassDefFoundError: org/apache/maven/project/Model
        at org.apache.maven.project.Project.<init>(Project.java:120)
        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa
nager.java:420)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
LifecycleExecutor.java:539)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
l(DefaultLifecycleExecutor.java:493)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL
ifecycleExecutor.java:463)
 
I get the feeling I'm not using the right Project class.
 
Any suggestions would be really helpful.

RE: Getting a dependency list in a custom plugin

Posted by EJ Ciramella <ej...@upromise.com>.
So we're using ATG here, and part of assembling an ATG install is providing a classpath in the manifest file.

We have lots of dependencies for compiling (with either compile or nothing depending on who added the dependency), but many of these aren't needed for runtime because ATG jars included as part of the config-path setup provide them during runtime.  What I want to do is be able to pick and choose from what's being used for our compile classpath, but I don't want everything. 

-----Original Message-----
From: Wayne Fay [mailto:waynefay@gmail.com] 
Sent: Wednesday, December 12, 2007 7:39 PM
To: Maven Users List
Subject: Re: Getting a dependency list in a custom plugin

Sounds like you're re-inventing the scope concept (compile, provided,
test, etc)... What exactly are you trying to do here?

Wayne

On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> With a little more consideration, I don't really want every dependency (obviously, who'd want a junit jar in their war file if they could help it).
>
> So here's a more conceptual question, what's the best way to allow one set of dependencies but let the end user configure which items get line entries in this manifest file?
>
> Like a dependencyset in an assembly descriptor:
>
>        <dependencySet>
>          <outputFileNameMapping></outputFileNameMapping>
>          <useStrictFiltering>false</useStrictFiltering>
>          <outputDirectory>/someoutputplace</outputDirectory>
>          <unpack>true</unpack>
>          <unpackOptions>
>             <includes>
>               <include>someincludes</include>
>             </includes>
>          </unpackOptions>
>          <includes>
>             <include>group:artifacid:type:version</include> (where version can be * or blank I think)
>          </includes>
>        </dependencySet>
>
> Any thoughts?
>
>
> -----Original Message-----
> From: EJ Ciramella [mailto:ejciramella@upromise.com]
> Sent: Wednesday, December 12, 2007 5:10 PM
> To: Maven Users List
> Subject: RE: Getting a dependency list in a custom plugin
>
> So maybe I got ahead of myself a bit, I'm having a bit of trouble with the Dependency portion:
>
> In my class, I have this -
>
>    /** @parameter expression="${project.dependencies}" */
>    private Dependency dependencies;
>
> But when I run, I get this:
>
> Cause: Cannot assign configuration entry 'dependencies' to 'class org.apache.maven.model.Dependency' from '${project.dependencies}', which is of type class java.
> util.ArrayList
>
> So my understanding is that ${project.dependencies} is really an ArrayList, but when I try something like this:
>
>    /** @parameter expression="${project.dependencies}" */
>    private ArrayList dependencies;
>
> And:
>
>          for(int x = 0; x < dependencies.size(); x++)
>          {
>                  if (artifact.getGroupId().equals(((Dependency)dependencies.get(x)).getGroupId()) && artifact.getArtifactId().equals(((Dependency)dependencies.get(x)).getArtifactId()))
>                  {
>                          getLog().info(artifact.getFile().getPath());
>                  }
>          }
>
>
> I get:
>
>
> [INFO] null
> [INFO] ------------------------------------------------------------------------
> [INFO] Trace
> java.lang.NullPointerException
>        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:33)
>        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>
> With a bit more research, the artifacts are null.  This returns nothing:
>
> Set artifacts = mavenProject.getDependencyArtifacts();
>
> What should I be doing instead?
>
>
>
>
>
>
> -----Original Message-----
> From: EJ Ciramella [mailto:ejciramella@upromise.com]
> Sent: Wednesday, December 12, 2007 2:22 PM
> To: Maven Users List
> Subject: RE: Getting a dependency list in a custom plugin
>
> Sorry - but this reply got me up and running in the first two seconds.
>
> Link 3 is worth a million bucks IMHO.
>
> -----Original Message-----
> From: EJ Ciramella [mailto:ejciramella@upromise.com]
> Sent: Wednesday, December 12, 2007 2:16 PM
> To: Maven Users List
> Subject: RE: Getting a dependency list in a custom plugin
>
> Thank you very much!
>
> /digesting...
>
>
> -----Original Message-----
> From: Wayne Fay [mailto:waynefay@gmail.com]
> Sent: Wednesday, December 12, 2007 1:28 PM
> To: Maven Users List
> Subject: Re: Getting a dependency list in a custom plugin
>
> A few good links for you, EJ:
>
> http://wiki.wsmoak.net/cgi-bin/wiki.pl?Maven/PluginDevelopment
> http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
>
> Wayne
>
> On 12/12/07, Jeff MAURY <je...@jeffmaury.com> wrote:
> > You must declare a parameter in your Mojo of class Project and use the
> > expression ${project}
> >
> > Jeff
> >
> >
> >
> > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > >
> > > Yeah, I'm having much better results (they're blank, but in a format
> > > that's recognizable) using:
> > >
> > >    <dependency>
> > >      <groupId>org.apache.maven</groupId>
> > >      <artifactId>maven-project</artifactId>
> > >      <version>2.0.4</version>
> > >    </dependency>
> > >
> > > But what's weird is I'm seeing this:
> > >
> > > <snip>
> > >        MavenProject proj = new MavenProject();
> > >        getLog().info("artifact ID here "+proj.getArtifactId());
> > > </snip>
> > >
> > >
> > > Yeilds:
> > >
> > > artifact ID here empty-project
> > >
> > >
> > > I'm guessing I need to do something that gets an instance of the current
> > > project.  How does one do this from their AbstractMojo based plugin?
> > >
> > > -----Original Message-----
> > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > MAURY
> > > Sent: Wednesday, December 12, 2007 11:27 AM
> > > To: Maven Users List
> > > Subject: Re: Getting a dependency list in a custom plugin
> > >
> > > For Maven2, the groupId is org.apache.maven and the version is 2.0.x.
> > >
> > > Regards
> > > Jeff
> > >
> > >
> > >
> > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > >
> > > > Additionally, I've added:
> > > >
> > > > <plugins>
> > > >          <plugin>
> > > >          <dependencies>
> > > >                        <dependency>
> > > >                          <groupId>maven</groupId>
> > > >                          <artifactId>maven-model</artifactId>
> > > >                          <version>3.0.1</version>
> > > >                        </dependency>
> > > >          </dependencies>
> > > > ....
> > > >
> > > >
> > > > To my pom, but I still am getting
> > > >
> > > > [INFO] Trace
> > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > >
> > > > /scratcheshead
> > > >
> > > > -----Original Message-----
> > > > From: EJ Ciramella [mailto:ejciramella@upromise.com]
> > > > Sent: Wednesday, December 12, 2007 10:43 AM
> > > > To: Maven Users List
> > > > Subject: RE: Getting a dependency list in a custom plugin
> > > >
> > > > So, what dependency should I be using to get access to the maven project
> > > > class?  I get the feeling I'm using the wrong one.
> > > >
> > > > I've opted to use:
> > > >
> > > > import org.apache.maven.project.Project;
> > > >
> > > > From:
> > > >        <dependency>
> > > >          <groupId>maven</groupId>
> > > >          <artifactId>maven</artifactId>
> > > >          <version>1.1-beta-3</version>
> > > >        </dependency>
> > > >
> > > > I feel like this is the maven1 version...
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > > MAURY
> > > > Sent: Wednesday, December 12, 2007 3:21 AM
> > > > To: Maven Users List
> > > > Subject: Re: Getting a dependency list in a custom plugin
> > > >
> > > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > > >
> > > > > Hello all - I have what seems like a simple question that's got me
> > > > > stumped at the moment.
> > > > >
> > > > > Is there a way to iterate over the dependencies in a particular
> > > project
> > > > > inside a custom plugin?
> > > > >
> > > > > I keep wanting to do something like:
> > > > >
> > > > >     ArrayList deps = (ArrayList) proj.getDependencies();
> > > > >     for(int x = 0; x < deps.size(); x++)
> > > > >     {
> > > > >      getLog().info("--> "+deps.get(x));
> > > > >     }
> > > > >
> > > > > Just for testing purposes, but at runtime, I keep getting this
> > > > > stacktrace:
> > > > >
> > > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > > >        at org.apache.maven.project.Project.<init>(Project.java:120)
> > > > >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> > > > >        at
> > > > > org.apache.maven.plugin.DefaultPluginManager.executeMojo
> > > (DefaultPluginMa
> > > > > nager.java:420)
> > > > >        at
> > > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> > > (Default
> > > > > LifecycleExecutor.java:539)
> > > > >        at
> > > > >
> > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > > > > l(DefaultLifecycleExecutor.java:493)
> > > > >        at
> > > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> > > (DefaultL
> > > > > ifecycleExecutor.java:463)
> > > > >
> > > > > I get the feeling I'm not using the right Project class.
> > > >
> > > >
> > > > I think you're missing a dependency in your plugin POM so that the
> > > > classpath
> > > > affected to your plugin is not complete.
> > > >
> > > > Jeff
> > > >
> > > >
> > > > Any suggestions would be really helpful.
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > La mélancolie c'est communiste
> > > > Tout le monde y a droit de temps en temps
> > > > La mélancolie n'est pas capitaliste
> > > > C'est même gratuit pour les perdants
> > > > La mélancolie c'est pacifiste
> > > > On ne lui rentre jamais dedans
> > > > La mélancolie oh tu sais ça existe
> > > > Elle se prend même avec des gants
> > > > La mélancolie c'est pour les syndicalistes
> > > > Il faut juste sa carte de permanent
> > > >
> > > > Miossec (2006)
> > > >
> > > > http://www.jeffmaury.com
> > > > http://riadiscuss.jeffmaury.com
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > La mélancolie c'est communiste
> > > Tout le monde y a droit de temps en temps
> > > La mélancolie n'est pas capitaliste
> > > C'est même gratuit pour les perdants
> > > La mélancolie c'est pacifiste
> > > On ne lui rentre jamais dedans
> > > La mélancolie oh tu sais ça existe
> > > Elle se prend même avec des gants
> > > La mélancolie c'est pour les syndicalistes
> > > Il faut juste sa carte de permanent
> > >
> > > Miossec (2006)
> > >
> > > http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > La mélancolie c'est communiste
> > Tout le monde y a droit de temps en temps
> > La mélancolie n'est pas capitaliste
> > C'est même gratuit pour les perdants
> > La mélancolie c'est pacifiste
> > On ne lui rentre jamais dedans
> > La mélancolie oh tu sais ça existe
> > Elle se prend même avec des gants
> > La mélancolie c'est pour les syndicalistes
> > Il faut juste sa carte de permanent
> >
> > Miossec (2006)
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


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


Re: Getting a dependency list in a custom plugin

Posted by Wayne Fay <wa...@gmail.com>.
Sounds like you're re-inventing the scope concept (compile, provided,
test, etc)... What exactly are you trying to do here?

Wayne

On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> With a little more consideration, I don't really want every dependency (obviously, who'd want a junit jar in their war file if they could help it).
>
> So here's a more conceptual question, what's the best way to allow one set of dependencies but let the end user configure which items get line entries in this manifest file?
>
> Like a dependencyset in an assembly descriptor:
>
>        <dependencySet>
>          <outputFileNameMapping></outputFileNameMapping>
>          <useStrictFiltering>false</useStrictFiltering>
>          <outputDirectory>/someoutputplace</outputDirectory>
>          <unpack>true</unpack>
>          <unpackOptions>
>             <includes>
>               <include>someincludes</include>
>             </includes>
>          </unpackOptions>
>          <includes>
>             <include>group:artifacid:type:version</include> (where version can be * or blank I think)
>          </includes>
>        </dependencySet>
>
> Any thoughts?
>
>
> -----Original Message-----
> From: EJ Ciramella [mailto:ejciramella@upromise.com]
> Sent: Wednesday, December 12, 2007 5:10 PM
> To: Maven Users List
> Subject: RE: Getting a dependency list in a custom plugin
>
> So maybe I got ahead of myself a bit, I'm having a bit of trouble with the Dependency portion:
>
> In my class, I have this -
>
>    /** @parameter expression="${project.dependencies}" */
>    private Dependency dependencies;
>
> But when I run, I get this:
>
> Cause: Cannot assign configuration entry 'dependencies' to 'class org.apache.maven.model.Dependency' from '${project.dependencies}', which is of type class java.
> util.ArrayList
>
> So my understanding is that ${project.dependencies} is really an ArrayList, but when I try something like this:
>
>    /** @parameter expression="${project.dependencies}" */
>    private ArrayList dependencies;
>
> And:
>
>          for(int x = 0; x < dependencies.size(); x++)
>          {
>                  if (artifact.getGroupId().equals(((Dependency)dependencies.get(x)).getGroupId()) && artifact.getArtifactId().equals(((Dependency)dependencies.get(x)).getArtifactId()))
>                  {
>                          getLog().info(artifact.getFile().getPath());
>                  }
>          }
>
>
> I get:
>
>
> [INFO] null
> [INFO] ------------------------------------------------------------------------
> [INFO] Trace
> java.lang.NullPointerException
>        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:33)
>        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
>        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>
> With a bit more research, the artifacts are null.  This returns nothing:
>
> Set artifacts = mavenProject.getDependencyArtifacts();
>
> What should I be doing instead?
>
>
>
>
>
>
> -----Original Message-----
> From: EJ Ciramella [mailto:ejciramella@upromise.com]
> Sent: Wednesday, December 12, 2007 2:22 PM
> To: Maven Users List
> Subject: RE: Getting a dependency list in a custom plugin
>
> Sorry - but this reply got me up and running in the first two seconds.
>
> Link 3 is worth a million bucks IMHO.
>
> -----Original Message-----
> From: EJ Ciramella [mailto:ejciramella@upromise.com]
> Sent: Wednesday, December 12, 2007 2:16 PM
> To: Maven Users List
> Subject: RE: Getting a dependency list in a custom plugin
>
> Thank you very much!
>
> /digesting...
>
>
> -----Original Message-----
> From: Wayne Fay [mailto:waynefay@gmail.com]
> Sent: Wednesday, December 12, 2007 1:28 PM
> To: Maven Users List
> Subject: Re: Getting a dependency list in a custom plugin
>
> A few good links for you, EJ:
>
> http://wiki.wsmoak.net/cgi-bin/wiki.pl?Maven/PluginDevelopment
> http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
> http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook
>
> Wayne
>
> On 12/12/07, Jeff MAURY <je...@jeffmaury.com> wrote:
> > You must declare a parameter in your Mojo of class Project and use the
> > expression ${project}
> >
> > Jeff
> >
> >
> >
> > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > >
> > > Yeah, I'm having much better results (they're blank, but in a format
> > > that's recognizable) using:
> > >
> > >    <dependency>
> > >      <groupId>org.apache.maven</groupId>
> > >      <artifactId>maven-project</artifactId>
> > >      <version>2.0.4</version>
> > >    </dependency>
> > >
> > > But what's weird is I'm seeing this:
> > >
> > > <snip>
> > >        MavenProject proj = new MavenProject();
> > >        getLog().info("artifact ID here "+proj.getArtifactId());
> > > </snip>
> > >
> > >
> > > Yeilds:
> > >
> > > artifact ID here empty-project
> > >
> > >
> > > I'm guessing I need to do something that gets an instance of the current
> > > project.  How does one do this from their AbstractMojo based plugin?
> > >
> > > -----Original Message-----
> > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > MAURY
> > > Sent: Wednesday, December 12, 2007 11:27 AM
> > > To: Maven Users List
> > > Subject: Re: Getting a dependency list in a custom plugin
> > >
> > > For Maven2, the groupId is org.apache.maven and the version is 2.0.x.
> > >
> > > Regards
> > > Jeff
> > >
> > >
> > >
> > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > >
> > > > Additionally, I've added:
> > > >
> > > > <plugins>
> > > >          <plugin>
> > > >          <dependencies>
> > > >                        <dependency>
> > > >                          <groupId>maven</groupId>
> > > >                          <artifactId>maven-model</artifactId>
> > > >                          <version>3.0.1</version>
> > > >                        </dependency>
> > > >          </dependencies>
> > > > ....
> > > >
> > > >
> > > > To my pom, but I still am getting
> > > >
> > > > [INFO] Trace
> > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > >
> > > > /scratcheshead
> > > >
> > > > -----Original Message-----
> > > > From: EJ Ciramella [mailto:ejciramella@upromise.com]
> > > > Sent: Wednesday, December 12, 2007 10:43 AM
> > > > To: Maven Users List
> > > > Subject: RE: Getting a dependency list in a custom plugin
> > > >
> > > > So, what dependency should I be using to get access to the maven project
> > > > class?  I get the feeling I'm using the wrong one.
> > > >
> > > > I've opted to use:
> > > >
> > > > import org.apache.maven.project.Project;
> > > >
> > > > From:
> > > >        <dependency>
> > > >          <groupId>maven</groupId>
> > > >          <artifactId>maven</artifactId>
> > > >          <version>1.1-beta-3</version>
> > > >        </dependency>
> > > >
> > > > I feel like this is the maven1 version...
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > > MAURY
> > > > Sent: Wednesday, December 12, 2007 3:21 AM
> > > > To: Maven Users List
> > > > Subject: Re: Getting a dependency list in a custom plugin
> > > >
> > > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > > >
> > > > > Hello all - I have what seems like a simple question that's got me
> > > > > stumped at the moment.
> > > > >
> > > > > Is there a way to iterate over the dependencies in a particular
> > > project
> > > > > inside a custom plugin?
> > > > >
> > > > > I keep wanting to do something like:
> > > > >
> > > > >     ArrayList deps = (ArrayList) proj.getDependencies();
> > > > >     for(int x = 0; x < deps.size(); x++)
> > > > >     {
> > > > >      getLog().info("--> "+deps.get(x));
> > > > >     }
> > > > >
> > > > > Just for testing purposes, but at runtime, I keep getting this
> > > > > stacktrace:
> > > > >
> > > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > > >        at org.apache.maven.project.Project.<init>(Project.java:120)
> > > > >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> > > > >        at
> > > > > org.apache.maven.plugin.DefaultPluginManager.executeMojo
> > > (DefaultPluginMa
> > > > > nager.java:420)
> > > > >        at
> > > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> > > (Default
> > > > > LifecycleExecutor.java:539)
> > > > >        at
> > > > >
> > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > > > > l(DefaultLifecycleExecutor.java:493)
> > > > >        at
> > > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> > > (DefaultL
> > > > > ifecycleExecutor.java:463)
> > > > >
> > > > > I get the feeling I'm not using the right Project class.
> > > >
> > > >
> > > > I think you're missing a dependency in your plugin POM so that the
> > > > classpath
> > > > affected to your plugin is not complete.
> > > >
> > > > Jeff
> > > >
> > > >
> > > > Any suggestions would be really helpful.
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > La mélancolie c'est communiste
> > > > Tout le monde y a droit de temps en temps
> > > > La mélancolie n'est pas capitaliste
> > > > C'est même gratuit pour les perdants
> > > > La mélancolie c'est pacifiste
> > > > On ne lui rentre jamais dedans
> > > > La mélancolie oh tu sais ça existe
> > > > Elle se prend même avec des gants
> > > > La mélancolie c'est pour les syndicalistes
> > > > Il faut juste sa carte de permanent
> > > >
> > > > Miossec (2006)
> > > >
> > > > http://www.jeffmaury.com
> > > > http://riadiscuss.jeffmaury.com
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > La mélancolie c'est communiste
> > > Tout le monde y a droit de temps en temps
> > > La mélancolie n'est pas capitaliste
> > > C'est même gratuit pour les perdants
> > > La mélancolie c'est pacifiste
> > > On ne lui rentre jamais dedans
> > > La mélancolie oh tu sais ça existe
> > > Elle se prend même avec des gants
> > > La mélancolie c'est pour les syndicalistes
> > > Il faut juste sa carte de permanent
> > >
> > > Miossec (2006)
> > >
> > > http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > La mélancolie c'est communiste
> > Tout le monde y a droit de temps en temps
> > La mélancolie n'est pas capitaliste
> > C'est même gratuit pour les perdants
> > La mélancolie c'est pacifiste
> > On ne lui rentre jamais dedans
> > La mélancolie oh tu sais ça existe
> > Elle se prend même avec des gants
> > La mélancolie c'est pour les syndicalistes
> > Il faut juste sa carte de permanent
> >
> > Miossec (2006)
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


RE: Getting a dependency list in a custom plugin

Posted by EJ Ciramella <ej...@upromise.com>.
With a little more consideration, I don't really want every dependency (obviously, who'd want a junit jar in their war file if they could help it).

So here's a more conceptual question, what's the best way to allow one set of dependencies but let the end user configure which items get line entries in this manifest file?

Like a dependencyset in an assembly descriptor:

        <dependencySet>
          <outputFileNameMapping></outputFileNameMapping>
          <useStrictFiltering>false</useStrictFiltering>
          <outputDirectory>/someoutputplace</outputDirectory>
          <unpack>true</unpack>
          <unpackOptions>
             <includes>
               <include>someincludes</include>
             </includes>
          </unpackOptions>
          <includes>
             <include>group:artifacid:type:version</include> (where version can be * or blank I think)
          </includes>
        </dependencySet> 

Any thoughts?


-----Original Message-----
From: EJ Ciramella [mailto:ejciramella@upromise.com] 
Sent: Wednesday, December 12, 2007 5:10 PM
To: Maven Users List
Subject: RE: Getting a dependency list in a custom plugin

So maybe I got ahead of myself a bit, I'm having a bit of trouble with the Dependency portion:

In my class, I have this - 

    /** @parameter expression="${project.dependencies}" */
    private Dependency dependencies;

But when I run, I get this:

Cause: Cannot assign configuration entry 'dependencies' to 'class org.apache.maven.model.Dependency' from '${project.dependencies}', which is of type class java.
util.ArrayList

So my understanding is that ${project.dependencies} is really an ArrayList, but when I try something like this:

    /** @parameter expression="${project.dependencies}" */
    private ArrayList dependencies;

And:

    	  for(int x = 0; x < dependencies.size(); x++)
    	  {
    		  if (artifact.getGroupId().equals(((Dependency)dependencies.get(x)).getGroupId()) && artifact.getArtifactId().equals(((Dependency)dependencies.get(x)).getArtifactId())) 
    		  {
    			  getLog().info(artifact.getFile().getPath());
    		  }
    	  }


I get:


[INFO] null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:33)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

With a bit more research, the artifacts are null.  This returns nothing:

Set artifacts = mavenProject.getDependencyArtifacts();

What should I be doing instead?




 

-----Original Message-----
From: EJ Ciramella [mailto:ejciramella@upromise.com] 
Sent: Wednesday, December 12, 2007 2:22 PM
To: Maven Users List
Subject: RE: Getting a dependency list in a custom plugin

Sorry - but this reply got me up and running in the first two seconds.

Link 3 is worth a million bucks IMHO. 

-----Original Message-----
From: EJ Ciramella [mailto:ejciramella@upromise.com] 
Sent: Wednesday, December 12, 2007 2:16 PM
To: Maven Users List
Subject: RE: Getting a dependency list in a custom plugin

Thank you very much!

/digesting...
 

-----Original Message-----
From: Wayne Fay [mailto:waynefay@gmail.com] 
Sent: Wednesday, December 12, 2007 1:28 PM
To: Maven Users List
Subject: Re: Getting a dependency list in a custom plugin

A few good links for you, EJ:

http://wiki.wsmoak.net/cgi-bin/wiki.pl?Maven/PluginDevelopment
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook

Wayne

On 12/12/07, Jeff MAURY <je...@jeffmaury.com> wrote:
> You must declare a parameter in your Mojo of class Project and use the
> expression ${project}
>
> Jeff
>
>
>
> On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> >
> > Yeah, I'm having much better results (they're blank, but in a format
> > that's recognizable) using:
> >
> >    <dependency>
> >      <groupId>org.apache.maven</groupId>
> >      <artifactId>maven-project</artifactId>
> >      <version>2.0.4</version>
> >    </dependency>
> >
> > But what's weird is I'm seeing this:
> >
> > <snip>
> >        MavenProject proj = new MavenProject();
> >        getLog().info("artifact ID here "+proj.getArtifactId());
> > </snip>
> >
> >
> > Yeilds:
> >
> > artifact ID here empty-project
> >
> >
> > I'm guessing I need to do something that gets an instance of the current
> > project.  How does one do this from their AbstractMojo based plugin?
> >
> > -----Original Message-----
> > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > MAURY
> > Sent: Wednesday, December 12, 2007 11:27 AM
> > To: Maven Users List
> > Subject: Re: Getting a dependency list in a custom plugin
> >
> > For Maven2, the groupId is org.apache.maven and the version is 2.0.x.
> >
> > Regards
> > Jeff
> >
> >
> >
> > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > >
> > > Additionally, I've added:
> > >
> > > <plugins>
> > >          <plugin>
> > >          <dependencies>
> > >                        <dependency>
> > >                          <groupId>maven</groupId>
> > >                          <artifactId>maven-model</artifactId>
> > >                          <version>3.0.1</version>
> > >                        </dependency>
> > >          </dependencies>
> > > ....
> > >
> > >
> > > To my pom, but I still am getting
> > >
> > > [INFO] Trace
> > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > >
> > > /scratcheshead
> > >
> > > -----Original Message-----
> > > From: EJ Ciramella [mailto:ejciramella@upromise.com]
> > > Sent: Wednesday, December 12, 2007 10:43 AM
> > > To: Maven Users List
> > > Subject: RE: Getting a dependency list in a custom plugin
> > >
> > > So, what dependency should I be using to get access to the maven project
> > > class?  I get the feeling I'm using the wrong one.
> > >
> > > I've opted to use:
> > >
> > > import org.apache.maven.project.Project;
> > >
> > > From:
> > >        <dependency>
> > >          <groupId>maven</groupId>
> > >          <artifactId>maven</artifactId>
> > >          <version>1.1-beta-3</version>
> > >        </dependency>
> > >
> > > I feel like this is the maven1 version...
> > >
> > >
> > > -----Original Message-----
> > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > MAURY
> > > Sent: Wednesday, December 12, 2007 3:21 AM
> > > To: Maven Users List
> > > Subject: Re: Getting a dependency list in a custom plugin
> > >
> > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > >
> > > > Hello all - I have what seems like a simple question that's got me
> > > > stumped at the moment.
> > > >
> > > > Is there a way to iterate over the dependencies in a particular
> > project
> > > > inside a custom plugin?
> > > >
> > > > I keep wanting to do something like:
> > > >
> > > >     ArrayList deps = (ArrayList) proj.getDependencies();
> > > >     for(int x = 0; x < deps.size(); x++)
> > > >     {
> > > >      getLog().info("--> "+deps.get(x));
> > > >     }
> > > >
> > > > Just for testing purposes, but at runtime, I keep getting this
> > > > stacktrace:
> > > >
> > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > >        at org.apache.maven.project.Project.<init>(Project.java:120)
> > > >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> > > >        at
> > > > org.apache.maven.plugin.DefaultPluginManager.executeMojo
> > (DefaultPluginMa
> > > > nager.java:420)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> > (Default
> > > > LifecycleExecutor.java:539)
> > > >        at
> > > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > > > l(DefaultLifecycleExecutor.java:493)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> > (DefaultL
> > > > ifecycleExecutor.java:463)
> > > >
> > > > I get the feeling I'm not using the right Project class.
> > >
> > >
> > > I think you're missing a dependency in your plugin POM so that the
> > > classpath
> > > affected to your plugin is not complete.
> > >
> > > Jeff
> > >
> > >
> > > Any suggestions would be really helpful.
> > > >
> > >
> > >
> > >
> > > --
> > > La mélancolie c'est communiste
> > > Tout le monde y a droit de temps en temps
> > > La mélancolie n'est pas capitaliste
> > > C'est même gratuit pour les perdants
> > > La mélancolie c'est pacifiste
> > > On ne lui rentre jamais dedans
> > > La mélancolie oh tu sais ça existe
> > > Elle se prend même avec des gants
> > > La mélancolie c'est pour les syndicalistes
> > > Il faut juste sa carte de permanent
> > >
> > > Miossec (2006)
> > >
> > > http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > La mélancolie c'est communiste
> > Tout le monde y a droit de temps en temps
> > La mélancolie n'est pas capitaliste
> > C'est même gratuit pour les perdants
> > La mélancolie c'est pacifiste
> > On ne lui rentre jamais dedans
> > La mélancolie oh tu sais ça existe
> > Elle se prend même avec des gants
> > La mélancolie c'est pour les syndicalistes
> > Il faut juste sa carte de permanent
> >
> > Miossec (2006)
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
>

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


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


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


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


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


RE: Getting a dependency list in a custom plugin

Posted by EJ Ciramella <ej...@upromise.com>.
So maybe I got ahead of myself a bit, I'm having a bit of trouble with the Dependency portion:

In my class, I have this - 

    /** @parameter expression="${project.dependencies}" */
    private Dependency dependencies;

But when I run, I get this:

Cause: Cannot assign configuration entry 'dependencies' to 'class org.apache.maven.model.Dependency' from '${project.dependencies}', which is of type class java.
util.ArrayList

So my understanding is that ${project.dependencies} is really an ArrayList, but when I try something like this:

    /** @parameter expression="${project.dependencies}" */
    private ArrayList dependencies;

And:

    	  for(int x = 0; x < dependencies.size(); x++)
    	  {
    		  if (artifact.getGroupId().equals(((Dependency)dependencies.get(x)).getGroupId()) && artifact.getArtifactId().equals(((Dependency)dependencies.get(x)).getArtifactId())) 
    		  {
    			  getLog().info(artifact.getFile().getPath());
    		  }
    	  }


I get:


[INFO] null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:33)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

With a bit more research, the artifacts are null.  This returns nothing:

Set artifacts = mavenProject.getDependencyArtifacts();

What should I be doing instead?




 

-----Original Message-----
From: EJ Ciramella [mailto:ejciramella@upromise.com] 
Sent: Wednesday, December 12, 2007 2:22 PM
To: Maven Users List
Subject: RE: Getting a dependency list in a custom plugin

Sorry - but this reply got me up and running in the first two seconds.

Link 3 is worth a million bucks IMHO. 

-----Original Message-----
From: EJ Ciramella [mailto:ejciramella@upromise.com] 
Sent: Wednesday, December 12, 2007 2:16 PM
To: Maven Users List
Subject: RE: Getting a dependency list in a custom plugin

Thank you very much!

/digesting...
 

-----Original Message-----
From: Wayne Fay [mailto:waynefay@gmail.com] 
Sent: Wednesday, December 12, 2007 1:28 PM
To: Maven Users List
Subject: Re: Getting a dependency list in a custom plugin

A few good links for you, EJ:

http://wiki.wsmoak.net/cgi-bin/wiki.pl?Maven/PluginDevelopment
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook

Wayne

On 12/12/07, Jeff MAURY <je...@jeffmaury.com> wrote:
> You must declare a parameter in your Mojo of class Project and use the
> expression ${project}
>
> Jeff
>
>
>
> On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> >
> > Yeah, I'm having much better results (they're blank, but in a format
> > that's recognizable) using:
> >
> >    <dependency>
> >      <groupId>org.apache.maven</groupId>
> >      <artifactId>maven-project</artifactId>
> >      <version>2.0.4</version>
> >    </dependency>
> >
> > But what's weird is I'm seeing this:
> >
> > <snip>
> >        MavenProject proj = new MavenProject();
> >        getLog().info("artifact ID here "+proj.getArtifactId());
> > </snip>
> >
> >
> > Yeilds:
> >
> > artifact ID here empty-project
> >
> >
> > I'm guessing I need to do something that gets an instance of the current
> > project.  How does one do this from their AbstractMojo based plugin?
> >
> > -----Original Message-----
> > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > MAURY
> > Sent: Wednesday, December 12, 2007 11:27 AM
> > To: Maven Users List
> > Subject: Re: Getting a dependency list in a custom plugin
> >
> > For Maven2, the groupId is org.apache.maven and the version is 2.0.x.
> >
> > Regards
> > Jeff
> >
> >
> >
> > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > >
> > > Additionally, I've added:
> > >
> > > <plugins>
> > >          <plugin>
> > >          <dependencies>
> > >                        <dependency>
> > >                          <groupId>maven</groupId>
> > >                          <artifactId>maven-model</artifactId>
> > >                          <version>3.0.1</version>
> > >                        </dependency>
> > >          </dependencies>
> > > ....
> > >
> > >
> > > To my pom, but I still am getting
> > >
> > > [INFO] Trace
> > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > >
> > > /scratcheshead
> > >
> > > -----Original Message-----
> > > From: EJ Ciramella [mailto:ejciramella@upromise.com]
> > > Sent: Wednesday, December 12, 2007 10:43 AM
> > > To: Maven Users List
> > > Subject: RE: Getting a dependency list in a custom plugin
> > >
> > > So, what dependency should I be using to get access to the maven project
> > > class?  I get the feeling I'm using the wrong one.
> > >
> > > I've opted to use:
> > >
> > > import org.apache.maven.project.Project;
> > >
> > > From:
> > >        <dependency>
> > >          <groupId>maven</groupId>
> > >          <artifactId>maven</artifactId>
> > >          <version>1.1-beta-3</version>
> > >        </dependency>
> > >
> > > I feel like this is the maven1 version...
> > >
> > >
> > > -----Original Message-----
> > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > MAURY
> > > Sent: Wednesday, December 12, 2007 3:21 AM
> > > To: Maven Users List
> > > Subject: Re: Getting a dependency list in a custom plugin
> > >
> > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > >
> > > > Hello all - I have what seems like a simple question that's got me
> > > > stumped at the moment.
> > > >
> > > > Is there a way to iterate over the dependencies in a particular
> > project
> > > > inside a custom plugin?
> > > >
> > > > I keep wanting to do something like:
> > > >
> > > >     ArrayList deps = (ArrayList) proj.getDependencies();
> > > >     for(int x = 0; x < deps.size(); x++)
> > > >     {
> > > >      getLog().info("--> "+deps.get(x));
> > > >     }
> > > >
> > > > Just for testing purposes, but at runtime, I keep getting this
> > > > stacktrace:
> > > >
> > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > >        at org.apache.maven.project.Project.<init>(Project.java:120)
> > > >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> > > >        at
> > > > org.apache.maven.plugin.DefaultPluginManager.executeMojo
> > (DefaultPluginMa
> > > > nager.java:420)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> > (Default
> > > > LifecycleExecutor.java:539)
> > > >        at
> > > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > > > l(DefaultLifecycleExecutor.java:493)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> > (DefaultL
> > > > ifecycleExecutor.java:463)
> > > >
> > > > I get the feeling I'm not using the right Project class.
> > >
> > >
> > > I think you're missing a dependency in your plugin POM so that the
> > > classpath
> > > affected to your plugin is not complete.
> > >
> > > Jeff
> > >
> > >
> > > Any suggestions would be really helpful.
> > > >
> > >
> > >
> > >
> > > --
> > > La mélancolie c'est communiste
> > > Tout le monde y a droit de temps en temps
> > > La mélancolie n'est pas capitaliste
> > > C'est même gratuit pour les perdants
> > > La mélancolie c'est pacifiste
> > > On ne lui rentre jamais dedans
> > > La mélancolie oh tu sais ça existe
> > > Elle se prend même avec des gants
> > > La mélancolie c'est pour les syndicalistes
> > > Il faut juste sa carte de permanent
> > >
> > > Miossec (2006)
> > >
> > > http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > La mélancolie c'est communiste
> > Tout le monde y a droit de temps en temps
> > La mélancolie n'est pas capitaliste
> > C'est même gratuit pour les perdants
> > La mélancolie c'est pacifiste
> > On ne lui rentre jamais dedans
> > La mélancolie oh tu sais ça existe
> > Elle se prend même avec des gants
> > La mélancolie c'est pour les syndicalistes
> > Il faut juste sa carte de permanent
> >
> > Miossec (2006)
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
>

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


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


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


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


RE: Getting a dependency list in a custom plugin

Posted by EJ Ciramella <ej...@upromise.com>.
Sorry - but this reply got me up and running in the first two seconds.

Link 3 is worth a million bucks IMHO. 

-----Original Message-----
From: EJ Ciramella [mailto:ejciramella@upromise.com] 
Sent: Wednesday, December 12, 2007 2:16 PM
To: Maven Users List
Subject: RE: Getting a dependency list in a custom plugin

Thank you very much!

/digesting...
 

-----Original Message-----
From: Wayne Fay [mailto:waynefay@gmail.com] 
Sent: Wednesday, December 12, 2007 1:28 PM
To: Maven Users List
Subject: Re: Getting a dependency list in a custom plugin

A few good links for you, EJ:

http://wiki.wsmoak.net/cgi-bin/wiki.pl?Maven/PluginDevelopment
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook

Wayne

On 12/12/07, Jeff MAURY <je...@jeffmaury.com> wrote:
> You must declare a parameter in your Mojo of class Project and use the
> expression ${project}
>
> Jeff
>
>
>
> On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> >
> > Yeah, I'm having much better results (they're blank, but in a format
> > that's recognizable) using:
> >
> >    <dependency>
> >      <groupId>org.apache.maven</groupId>
> >      <artifactId>maven-project</artifactId>
> >      <version>2.0.4</version>
> >    </dependency>
> >
> > But what's weird is I'm seeing this:
> >
> > <snip>
> >        MavenProject proj = new MavenProject();
> >        getLog().info("artifact ID here "+proj.getArtifactId());
> > </snip>
> >
> >
> > Yeilds:
> >
> > artifact ID here empty-project
> >
> >
> > I'm guessing I need to do something that gets an instance of the current
> > project.  How does one do this from their AbstractMojo based plugin?
> >
> > -----Original Message-----
> > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > MAURY
> > Sent: Wednesday, December 12, 2007 11:27 AM
> > To: Maven Users List
> > Subject: Re: Getting a dependency list in a custom plugin
> >
> > For Maven2, the groupId is org.apache.maven and the version is 2.0.x.
> >
> > Regards
> > Jeff
> >
> >
> >
> > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > >
> > > Additionally, I've added:
> > >
> > > <plugins>
> > >          <plugin>
> > >          <dependencies>
> > >                        <dependency>
> > >                          <groupId>maven</groupId>
> > >                          <artifactId>maven-model</artifactId>
> > >                          <version>3.0.1</version>
> > >                        </dependency>
> > >          </dependencies>
> > > ....
> > >
> > >
> > > To my pom, but I still am getting
> > >
> > > [INFO] Trace
> > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > >
> > > /scratcheshead
> > >
> > > -----Original Message-----
> > > From: EJ Ciramella [mailto:ejciramella@upromise.com]
> > > Sent: Wednesday, December 12, 2007 10:43 AM
> > > To: Maven Users List
> > > Subject: RE: Getting a dependency list in a custom plugin
> > >
> > > So, what dependency should I be using to get access to the maven project
> > > class?  I get the feeling I'm using the wrong one.
> > >
> > > I've opted to use:
> > >
> > > import org.apache.maven.project.Project;
> > >
> > > From:
> > >        <dependency>
> > >          <groupId>maven</groupId>
> > >          <artifactId>maven</artifactId>
> > >          <version>1.1-beta-3</version>
> > >        </dependency>
> > >
> > > I feel like this is the maven1 version...
> > >
> > >
> > > -----Original Message-----
> > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > MAURY
> > > Sent: Wednesday, December 12, 2007 3:21 AM
> > > To: Maven Users List
> > > Subject: Re: Getting a dependency list in a custom plugin
> > >
> > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > >
> > > > Hello all - I have what seems like a simple question that's got me
> > > > stumped at the moment.
> > > >
> > > > Is there a way to iterate over the dependencies in a particular
> > project
> > > > inside a custom plugin?
> > > >
> > > > I keep wanting to do something like:
> > > >
> > > >     ArrayList deps = (ArrayList) proj.getDependencies();
> > > >     for(int x = 0; x < deps.size(); x++)
> > > >     {
> > > >      getLog().info("--> "+deps.get(x));
> > > >     }
> > > >
> > > > Just for testing purposes, but at runtime, I keep getting this
> > > > stacktrace:
> > > >
> > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > >        at org.apache.maven.project.Project.<init>(Project.java:120)
> > > >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> > > >        at
> > > > org.apache.maven.plugin.DefaultPluginManager.executeMojo
> > (DefaultPluginMa
> > > > nager.java:420)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> > (Default
> > > > LifecycleExecutor.java:539)
> > > >        at
> > > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > > > l(DefaultLifecycleExecutor.java:493)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> > (DefaultL
> > > > ifecycleExecutor.java:463)
> > > >
> > > > I get the feeling I'm not using the right Project class.
> > >
> > >
> > > I think you're missing a dependency in your plugin POM so that the
> > > classpath
> > > affected to your plugin is not complete.
> > >
> > > Jeff
> > >
> > >
> > > Any suggestions would be really helpful.
> > > >
> > >
> > >
> > >
> > > --
> > > La mélancolie c'est communiste
> > > Tout le monde y a droit de temps en temps
> > > La mélancolie n'est pas capitaliste
> > > C'est même gratuit pour les perdants
> > > La mélancolie c'est pacifiste
> > > On ne lui rentre jamais dedans
> > > La mélancolie oh tu sais ça existe
> > > Elle se prend même avec des gants
> > > La mélancolie c'est pour les syndicalistes
> > > Il faut juste sa carte de permanent
> > >
> > > Miossec (2006)
> > >
> > > http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > La mélancolie c'est communiste
> > Tout le monde y a droit de temps en temps
> > La mélancolie n'est pas capitaliste
> > C'est même gratuit pour les perdants
> > La mélancolie c'est pacifiste
> > On ne lui rentre jamais dedans
> > La mélancolie oh tu sais ça existe
> > Elle se prend même avec des gants
> > La mélancolie c'est pour les syndicalistes
> > Il faut juste sa carte de permanent
> >
> > Miossec (2006)
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
>

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


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


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


RE: Getting a dependency list in a custom plugin

Posted by EJ Ciramella <ej...@upromise.com>.
Thank you very much!

/digesting...
 

-----Original Message-----
From: Wayne Fay [mailto:waynefay@gmail.com] 
Sent: Wednesday, December 12, 2007 1:28 PM
To: Maven Users List
Subject: Re: Getting a dependency list in a custom plugin

A few good links for you, EJ:

http://wiki.wsmoak.net/cgi-bin/wiki.pl?Maven/PluginDevelopment
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook

Wayne

On 12/12/07, Jeff MAURY <je...@jeffmaury.com> wrote:
> You must declare a parameter in your Mojo of class Project and use the
> expression ${project}
>
> Jeff
>
>
>
> On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> >
> > Yeah, I'm having much better results (they're blank, but in a format
> > that's recognizable) using:
> >
> >    <dependency>
> >      <groupId>org.apache.maven</groupId>
> >      <artifactId>maven-project</artifactId>
> >      <version>2.0.4</version>
> >    </dependency>
> >
> > But what's weird is I'm seeing this:
> >
> > <snip>
> >        MavenProject proj = new MavenProject();
> >        getLog().info("artifact ID here "+proj.getArtifactId());
> > </snip>
> >
> >
> > Yeilds:
> >
> > artifact ID here empty-project
> >
> >
> > I'm guessing I need to do something that gets an instance of the current
> > project.  How does one do this from their AbstractMojo based plugin?
> >
> > -----Original Message-----
> > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > MAURY
> > Sent: Wednesday, December 12, 2007 11:27 AM
> > To: Maven Users List
> > Subject: Re: Getting a dependency list in a custom plugin
> >
> > For Maven2, the groupId is org.apache.maven and the version is 2.0.x.
> >
> > Regards
> > Jeff
> >
> >
> >
> > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > >
> > > Additionally, I've added:
> > >
> > > <plugins>
> > >          <plugin>
> > >          <dependencies>
> > >                        <dependency>
> > >                          <groupId>maven</groupId>
> > >                          <artifactId>maven-model</artifactId>
> > >                          <version>3.0.1</version>
> > >                        </dependency>
> > >          </dependencies>
> > > ....
> > >
> > >
> > > To my pom, but I still am getting
> > >
> > > [INFO] Trace
> > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > >
> > > /scratcheshead
> > >
> > > -----Original Message-----
> > > From: EJ Ciramella [mailto:ejciramella@upromise.com]
> > > Sent: Wednesday, December 12, 2007 10:43 AM
> > > To: Maven Users List
> > > Subject: RE: Getting a dependency list in a custom plugin
> > >
> > > So, what dependency should I be using to get access to the maven project
> > > class?  I get the feeling I'm using the wrong one.
> > >
> > > I've opted to use:
> > >
> > > import org.apache.maven.project.Project;
> > >
> > > From:
> > >        <dependency>
> > >          <groupId>maven</groupId>
> > >          <artifactId>maven</artifactId>
> > >          <version>1.1-beta-3</version>
> > >        </dependency>
> > >
> > > I feel like this is the maven1 version...
> > >
> > >
> > > -----Original Message-----
> > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > MAURY
> > > Sent: Wednesday, December 12, 2007 3:21 AM
> > > To: Maven Users List
> > > Subject: Re: Getting a dependency list in a custom plugin
> > >
> > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > >
> > > > Hello all - I have what seems like a simple question that's got me
> > > > stumped at the moment.
> > > >
> > > > Is there a way to iterate over the dependencies in a particular
> > project
> > > > inside a custom plugin?
> > > >
> > > > I keep wanting to do something like:
> > > >
> > > >     ArrayList deps = (ArrayList) proj.getDependencies();
> > > >     for(int x = 0; x < deps.size(); x++)
> > > >     {
> > > >      getLog().info("--> "+deps.get(x));
> > > >     }
> > > >
> > > > Just for testing purposes, but at runtime, I keep getting this
> > > > stacktrace:
> > > >
> > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > >        at org.apache.maven.project.Project.<init>(Project.java:120)
> > > >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> > > >        at
> > > > org.apache.maven.plugin.DefaultPluginManager.executeMojo
> > (DefaultPluginMa
> > > > nager.java:420)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> > (Default
> > > > LifecycleExecutor.java:539)
> > > >        at
> > > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > > > l(DefaultLifecycleExecutor.java:493)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> > (DefaultL
> > > > ifecycleExecutor.java:463)
> > > >
> > > > I get the feeling I'm not using the right Project class.
> > >
> > >
> > > I think you're missing a dependency in your plugin POM so that the
> > > classpath
> > > affected to your plugin is not complete.
> > >
> > > Jeff
> > >
> > >
> > > Any suggestions would be really helpful.
> > > >
> > >
> > >
> > >
> > > --
> > > La mélancolie c'est communiste
> > > Tout le monde y a droit de temps en temps
> > > La mélancolie n'est pas capitaliste
> > > C'est même gratuit pour les perdants
> > > La mélancolie c'est pacifiste
> > > On ne lui rentre jamais dedans
> > > La mélancolie oh tu sais ça existe
> > > Elle se prend même avec des gants
> > > La mélancolie c'est pour les syndicalistes
> > > Il faut juste sa carte de permanent
> > >
> > > Miossec (2006)
> > >
> > > http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > La mélancolie c'est communiste
> > Tout le monde y a droit de temps en temps
> > La mélancolie n'est pas capitaliste
> > C'est même gratuit pour les perdants
> > La mélancolie c'est pacifiste
> > On ne lui rentre jamais dedans
> > La mélancolie oh tu sais ça existe
> > Elle se prend même avec des gants
> > La mélancolie c'est pour les syndicalistes
> > Il faut juste sa carte de permanent
> >
> > Miossec (2006)
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
>

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


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


Re: Getting a dependency list in a custom plugin

Posted by Wayne Fay <wa...@gmail.com>.
A few good links for you, EJ:

http://wiki.wsmoak.net/cgi-bin/wiki.pl?Maven/PluginDevelopment
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook

Wayne

On 12/12/07, Jeff MAURY <je...@jeffmaury.com> wrote:
> You must declare a parameter in your Mojo of class Project and use the
> expression ${project}
>
> Jeff
>
>
>
> On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> >
> > Yeah, I'm having much better results (they're blank, but in a format
> > that's recognizable) using:
> >
> >    <dependency>
> >      <groupId>org.apache.maven</groupId>
> >      <artifactId>maven-project</artifactId>
> >      <version>2.0.4</version>
> >    </dependency>
> >
> > But what's weird is I'm seeing this:
> >
> > <snip>
> >        MavenProject proj = new MavenProject();
> >        getLog().info("artifact ID here "+proj.getArtifactId());
> > </snip>
> >
> >
> > Yeilds:
> >
> > artifact ID here empty-project
> >
> >
> > I'm guessing I need to do something that gets an instance of the current
> > project.  How does one do this from their AbstractMojo based plugin?
> >
> > -----Original Message-----
> > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > MAURY
> > Sent: Wednesday, December 12, 2007 11:27 AM
> > To: Maven Users List
> > Subject: Re: Getting a dependency list in a custom plugin
> >
> > For Maven2, the groupId is org.apache.maven and the version is 2.0.x.
> >
> > Regards
> > Jeff
> >
> >
> >
> > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > >
> > > Additionally, I've added:
> > >
> > > <plugins>
> > >          <plugin>
> > >          <dependencies>
> > >                        <dependency>
> > >                          <groupId>maven</groupId>
> > >                          <artifactId>maven-model</artifactId>
> > >                          <version>3.0.1</version>
> > >                        </dependency>
> > >          </dependencies>
> > > ....
> > >
> > >
> > > To my pom, but I still am getting
> > >
> > > [INFO] Trace
> > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > >
> > > /scratcheshead
> > >
> > > -----Original Message-----
> > > From: EJ Ciramella [mailto:ejciramella@upromise.com]
> > > Sent: Wednesday, December 12, 2007 10:43 AM
> > > To: Maven Users List
> > > Subject: RE: Getting a dependency list in a custom plugin
> > >
> > > So, what dependency should I be using to get access to the maven project
> > > class?  I get the feeling I'm using the wrong one.
> > >
> > > I've opted to use:
> > >
> > > import org.apache.maven.project.Project;
> > >
> > > From:
> > >        <dependency>
> > >          <groupId>maven</groupId>
> > >          <artifactId>maven</artifactId>
> > >          <version>1.1-beta-3</version>
> > >        </dependency>
> > >
> > > I feel like this is the maven1 version...
> > >
> > >
> > > -----Original Message-----
> > > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > > MAURY
> > > Sent: Wednesday, December 12, 2007 3:21 AM
> > > To: Maven Users List
> > > Subject: Re: Getting a dependency list in a custom plugin
> > >
> > > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > > >
> > > > Hello all - I have what seems like a simple question that's got me
> > > > stumped at the moment.
> > > >
> > > > Is there a way to iterate over the dependencies in a particular
> > project
> > > > inside a custom plugin?
> > > >
> > > > I keep wanting to do something like:
> > > >
> > > >     ArrayList deps = (ArrayList) proj.getDependencies();
> > > >     for(int x = 0; x < deps.size(); x++)
> > > >     {
> > > >      getLog().info("--> "+deps.get(x));
> > > >     }
> > > >
> > > > Just for testing purposes, but at runtime, I keep getting this
> > > > stacktrace:
> > > >
> > > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > > >        at org.apache.maven.project.Project.<init>(Project.java:120)
> > > >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> > > >        at
> > > > org.apache.maven.plugin.DefaultPluginManager.executeMojo
> > (DefaultPluginMa
> > > > nager.java:420)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> > (Default
> > > > LifecycleExecutor.java:539)
> > > >        at
> > > >
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > > > l(DefaultLifecycleExecutor.java:493)
> > > >        at
> > > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> > (DefaultL
> > > > ifecycleExecutor.java:463)
> > > >
> > > > I get the feeling I'm not using the right Project class.
> > >
> > >
> > > I think you're missing a dependency in your plugin POM so that the
> > > classpath
> > > affected to your plugin is not complete.
> > >
> > > Jeff
> > >
> > >
> > > Any suggestions would be really helpful.
> > > >
> > >
> > >
> > >
> > > --
> > > La mélancolie c'est communiste
> > > Tout le monde y a droit de temps en temps
> > > La mélancolie n'est pas capitaliste
> > > C'est même gratuit pour les perdants
> > > La mélancolie c'est pacifiste
> > > On ne lui rentre jamais dedans
> > > La mélancolie oh tu sais ça existe
> > > Elle se prend même avec des gants
> > > La mélancolie c'est pour les syndicalistes
> > > Il faut juste sa carte de permanent
> > >
> > > Miossec (2006)
> > >
> > > http://www.jeffmaury.com
> > > http://riadiscuss.jeffmaury.com
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> > La mélancolie c'est communiste
> > Tout le monde y a droit de temps en temps
> > La mélancolie n'est pas capitaliste
> > C'est même gratuit pour les perdants
> > La mélancolie c'est pacifiste
> > On ne lui rentre jamais dedans
> > La mélancolie oh tu sais ça existe
> > Elle se prend même avec des gants
> > La mélancolie c'est pour les syndicalistes
> > Il faut juste sa carte de permanent
> >
> > Miossec (2006)
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
>

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


Re: Getting a dependency list in a custom plugin

Posted by Jeff MAURY <je...@jeffmaury.com>.
You must declare a parameter in your Mojo of class Project and use the
expression ${project}

Jeff



On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
>
> Yeah, I'm having much better results (they're blank, but in a format
> that's recognizable) using:
>
>    <dependency>
>      <groupId>org.apache.maven</groupId>
>      <artifactId>maven-project</artifactId>
>      <version>2.0.4</version>
>    </dependency>
>
> But what's weird is I'm seeing this:
>
> <snip>
>        MavenProject proj = new MavenProject();
>        getLog().info("artifact ID here "+proj.getArtifactId());
> </snip>
>
>
> Yeilds:
>
> artifact ID here empty-project
>
>
> I'm guessing I need to do something that gets an instance of the current
> project.  How does one do this from their AbstractMojo based plugin?
>
> -----Original Message-----
> From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> MAURY
> Sent: Wednesday, December 12, 2007 11:27 AM
> To: Maven Users List
> Subject: Re: Getting a dependency list in a custom plugin
>
> For Maven2, the groupId is org.apache.maven and the version is 2.0.x.
>
> Regards
> Jeff
>
>
>
> On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> >
> > Additionally, I've added:
> >
> > <plugins>
> >          <plugin>
> >          <dependencies>
> >                        <dependency>
> >                          <groupId>maven</groupId>
> >                          <artifactId>maven-model</artifactId>
> >                          <version>3.0.1</version>
> >                        </dependency>
> >          </dependencies>
> > ....
> >
> >
> > To my pom, but I still am getting
> >
> > [INFO] Trace
> > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> >
> > /scratcheshead
> >
> > -----Original Message-----
> > From: EJ Ciramella [mailto:ejciramella@upromise.com]
> > Sent: Wednesday, December 12, 2007 10:43 AM
> > To: Maven Users List
> > Subject: RE: Getting a dependency list in a custom plugin
> >
> > So, what dependency should I be using to get access to the maven project
> > class?  I get the feeling I'm using the wrong one.
> >
> > I've opted to use:
> >
> > import org.apache.maven.project.Project;
> >
> > From:
> >        <dependency>
> >          <groupId>maven</groupId>
> >          <artifactId>maven</artifactId>
> >          <version>1.1-beta-3</version>
> >        </dependency>
> >
> > I feel like this is the maven1 version...
> >
> >
> > -----Original Message-----
> > From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> > MAURY
> > Sent: Wednesday, December 12, 2007 3:21 AM
> > To: Maven Users List
> > Subject: Re: Getting a dependency list in a custom plugin
> >
> > On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> > >
> > > Hello all - I have what seems like a simple question that's got me
> > > stumped at the moment.
> > >
> > > Is there a way to iterate over the dependencies in a particular
> project
> > > inside a custom plugin?
> > >
> > > I keep wanting to do something like:
> > >
> > >     ArrayList deps = (ArrayList) proj.getDependencies();
> > >     for(int x = 0; x < deps.size(); x++)
> > >     {
> > >      getLog().info("--> "+deps.get(x));
> > >     }
> > >
> > > Just for testing purposes, but at runtime, I keep getting this
> > > stacktrace:
> > >
> > > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> > >        at org.apache.maven.project.Project.<init>(Project.java:120)
> > >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> > >        at
> > > org.apache.maven.plugin.DefaultPluginManager.executeMojo
> (DefaultPluginMa
> > > nager.java:420)
> > >        at
> > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
> (Default
> > > LifecycleExecutor.java:539)
> > >        at
> > >
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > > l(DefaultLifecycleExecutor.java:493)
> > >        at
> > > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> (DefaultL
> > > ifecycleExecutor.java:463)
> > >
> > > I get the feeling I'm not using the right Project class.
> >
> >
> > I think you're missing a dependency in your plugin POM so that the
> > classpath
> > affected to your plugin is not complete.
> >
> > Jeff
> >
> >
> > Any suggestions would be really helpful.
> > >
> >
> >
> >
> > --
> > La mélancolie c'est communiste
> > Tout le monde y a droit de temps en temps
> > La mélancolie n'est pas capitaliste
> > C'est même gratuit pour les perdants
> > La mélancolie c'est pacifiste
> > On ne lui rentre jamais dedans
> > La mélancolie oh tu sais ça existe
> > Elle se prend même avec des gants
> > La mélancolie c'est pour les syndicalistes
> > Il faut juste sa carte de permanent
> >
> > Miossec (2006)
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com

RE: Getting a dependency list in a custom plugin

Posted by EJ Ciramella <ej...@upromise.com>.
Yeah, I'm having much better results (they're blank, but in a format that's recognizable) using:

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-project</artifactId>
      <version>2.0.4</version>
    </dependency>

But what's weird is I'm seeing this:

<snip>
    	MavenProject proj = new MavenProject();
    	getLog().info("artifact ID here "+proj.getArtifactId());
</snip>


Yeilds:

artifact ID here empty-project 


I'm guessing I need to do something that gets an instance of the current project.  How does one do this from their AbstractMojo based plugin?

-----Original Message-----
From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff MAURY
Sent: Wednesday, December 12, 2007 11:27 AM
To: Maven Users List
Subject: Re: Getting a dependency list in a custom plugin

For Maven2, the groupId is org.apache.maven and the version is 2.0.x.

Regards
Jeff



On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
>
> Additionally, I've added:
>
> <plugins>
>          <plugin>
>          <dependencies>
>                        <dependency>
>                          <groupId>maven</groupId>
>                          <artifactId>maven-model</artifactId>
>                          <version>3.0.1</version>
>                        </dependency>
>          </dependencies>
> ....
>
>
> To my pom, but I still am getting
>
> [INFO] Trace
> java.lang.NoClassDefFoundError: org/apache/maven/project/Model
>
> /scratcheshead
>
> -----Original Message-----
> From: EJ Ciramella [mailto:ejciramella@upromise.com]
> Sent: Wednesday, December 12, 2007 10:43 AM
> To: Maven Users List
> Subject: RE: Getting a dependency list in a custom plugin
>
> So, what dependency should I be using to get access to the maven project
> class?  I get the feeling I'm using the wrong one.
>
> I've opted to use:
>
> import org.apache.maven.project.Project;
>
> From:
>        <dependency>
>          <groupId>maven</groupId>
>          <artifactId>maven</artifactId>
>          <version>1.1-beta-3</version>
>        </dependency>
>
> I feel like this is the maven1 version...
>
>
> -----Original Message-----
> From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> MAURY
> Sent: Wednesday, December 12, 2007 3:21 AM
> To: Maven Users List
> Subject: Re: Getting a dependency list in a custom plugin
>
> On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> >
> > Hello all - I have what seems like a simple question that's got me
> > stumped at the moment.
> >
> > Is there a way to iterate over the dependencies in a particular project
> > inside a custom plugin?
> >
> > I keep wanting to do something like:
> >
> >     ArrayList deps = (ArrayList) proj.getDependencies();
> >     for(int x = 0; x < deps.size(); x++)
> >     {
> >      getLog().info("--> "+deps.get(x));
> >     }
> >
> > Just for testing purposes, but at runtime, I keep getting this
> > stacktrace:
> >
> > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> >        at org.apache.maven.project.Project.<init>(Project.java:120)
> >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> >        at
> > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa
> > nager.java:420)
> >        at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
> > LifecycleExecutor.java:539)
> >        at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > l(DefaultLifecycleExecutor.java:493)
> >        at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL
> > ifecycleExecutor.java:463)
> >
> > I get the feeling I'm not using the right Project class.
>
>
> I think you're missing a dependency in your plugin POM so that the
> classpath
> affected to your plugin is not complete.
>
> Jeff
>
>
> Any suggestions would be really helpful.
> >
>
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com

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


Re: Getting a dependency list in a custom plugin

Posted by Jeff MAURY <je...@jeffmaury.com>.
For Maven2, the groupId is org.apache.maven and the version is 2.0.x.

Regards
Jeff



On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
>
> Additionally, I've added:
>
> <plugins>
>          <plugin>
>          <dependencies>
>                        <dependency>
>                          <groupId>maven</groupId>
>                          <artifactId>maven-model</artifactId>
>                          <version>3.0.1</version>
>                        </dependency>
>          </dependencies>
> ....
>
>
> To my pom, but I still am getting
>
> [INFO] Trace
> java.lang.NoClassDefFoundError: org/apache/maven/project/Model
>
> /scratcheshead
>
> -----Original Message-----
> From: EJ Ciramella [mailto:ejciramella@upromise.com]
> Sent: Wednesday, December 12, 2007 10:43 AM
> To: Maven Users List
> Subject: RE: Getting a dependency list in a custom plugin
>
> So, what dependency should I be using to get access to the maven project
> class?  I get the feeling I'm using the wrong one.
>
> I've opted to use:
>
> import org.apache.maven.project.Project;
>
> From:
>        <dependency>
>          <groupId>maven</groupId>
>          <artifactId>maven</artifactId>
>          <version>1.1-beta-3</version>
>        </dependency>
>
> I feel like this is the maven1 version...
>
>
> -----Original Message-----
> From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff
> MAURY
> Sent: Wednesday, December 12, 2007 3:21 AM
> To: Maven Users List
> Subject: Re: Getting a dependency list in a custom plugin
>
> On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
> >
> > Hello all - I have what seems like a simple question that's got me
> > stumped at the moment.
> >
> > Is there a way to iterate over the dependencies in a particular project
> > inside a custom plugin?
> >
> > I keep wanting to do something like:
> >
> >     ArrayList deps = (ArrayList) proj.getDependencies();
> >     for(int x = 0; x < deps.size(); x++)
> >     {
> >      getLog().info("--> "+deps.get(x));
> >     }
> >
> > Just for testing purposes, but at runtime, I keep getting this
> > stacktrace:
> >
> > java.lang.NoClassDefFoundError: org/apache/maven/project/Model
> >        at org.apache.maven.project.Project.<init>(Project.java:120)
> >        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
> >        at
> > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa
> > nager.java:420)
> >        at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
> > LifecycleExecutor.java:539)
> >        at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> > l(DefaultLifecycleExecutor.java:493)
> >        at
> > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL
> > ifecycleExecutor.java:463)
> >
> > I get the feeling I'm not using the right Project class.
>
>
> I think you're missing a dependency in your plugin POM so that the
> classpath
> affected to your plugin is not complete.
>
> Jeff
>
>
> Any suggestions would be really helpful.
> >
>
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com

RE: Getting a dependency list in a custom plugin

Posted by EJ Ciramella <ej...@upromise.com>.
Additionally, I've added:

  <plugins>
          <plugin>
          <dependencies>
			<dependency>
			  <groupId>maven</groupId>
			  <artifactId>maven-model</artifactId>
			  <version>3.0.1</version>
			</dependency>
          </dependencies>
....


To my pom, but I still am getting 

[INFO] Trace
java.lang.NoClassDefFoundError: org/apache/maven/project/Model

/scratcheshead 

-----Original Message-----
From: EJ Ciramella [mailto:ejciramella@upromise.com] 
Sent: Wednesday, December 12, 2007 10:43 AM
To: Maven Users List
Subject: RE: Getting a dependency list in a custom plugin

So, what dependency should I be using to get access to the maven project class?  I get the feeling I'm using the wrong one.

I've opted to use:

import org.apache.maven.project.Project;

From:
	<dependency>
	  <groupId>maven</groupId>
	  <artifactId>maven</artifactId>
	  <version>1.1-beta-3</version>
	</dependency>

I feel like this is the maven1 version...
 

-----Original Message-----
From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff MAURY
Sent: Wednesday, December 12, 2007 3:21 AM
To: Maven Users List
Subject: Re: Getting a dependency list in a custom plugin

On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
>
> Hello all - I have what seems like a simple question that's got me
> stumped at the moment.
>
> Is there a way to iterate over the dependencies in a particular project
> inside a custom plugin?
>
> I keep wanting to do something like:
>
>     ArrayList deps = (ArrayList) proj.getDependencies();
>     for(int x = 0; x < deps.size(); x++)
>     {
>      getLog().info("--> "+deps.get(x));
>     }
>
> Just for testing purposes, but at runtime, I keep getting this
> stacktrace:
>
> java.lang.NoClassDefFoundError: org/apache/maven/project/Model
>        at org.apache.maven.project.Project.<init>(Project.java:120)
>        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
>        at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa
> nager.java:420)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
> LifecycleExecutor.java:539)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> l(DefaultLifecycleExecutor.java:493)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL
> ifecycleExecutor.java:463)
>
> I get the feeling I'm not using the right Project class.


I think you're missing a dependency in your plugin POM so that the classpath
affected to your plugin is not complete.

Jeff


Any suggestions would be really helpful.
>



-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com

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


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


RE: Getting a dependency list in a custom plugin

Posted by EJ Ciramella <ej...@upromise.com>.
So, what dependency should I be using to get access to the maven project class?  I get the feeling I'm using the wrong one.

I've opted to use:

import org.apache.maven.project.Project;

From:
	<dependency>
	  <groupId>maven</groupId>
	  <artifactId>maven</artifactId>
	  <version>1.1-beta-3</version>
	</dependency>

I feel like this is the maven1 version...
 

-----Original Message-----
From: jeffmaury@gmail.com [mailto:jeffmaury@gmail.com] On Behalf Of Jeff MAURY
Sent: Wednesday, December 12, 2007 3:21 AM
To: Maven Users List
Subject: Re: Getting a dependency list in a custom plugin

On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
>
> Hello all - I have what seems like a simple question that's got me
> stumped at the moment.
>
> Is there a way to iterate over the dependencies in a particular project
> inside a custom plugin?
>
> I keep wanting to do something like:
>
>     ArrayList deps = (ArrayList) proj.getDependencies();
>     for(int x = 0; x < deps.size(); x++)
>     {
>      getLog().info("--> "+deps.get(x));
>     }
>
> Just for testing purposes, but at runtime, I keep getting this
> stacktrace:
>
> java.lang.NoClassDefFoundError: org/apache/maven/project/Model
>        at org.apache.maven.project.Project.<init>(Project.java:120)
>        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
>        at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa
> nager.java:420)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
> LifecycleExecutor.java:539)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> l(DefaultLifecycleExecutor.java:493)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL
> ifecycleExecutor.java:463)
>
> I get the feeling I'm not using the right Project class.


I think you're missing a dependency in your plugin POM so that the classpath
affected to your plugin is not complete.

Jeff


Any suggestions would be really helpful.
>



-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com

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


Re: Getting a dependency list in a custom plugin

Posted by Jeff MAURY <je...@jeffmaury.com>.
On 12/12/07, EJ Ciramella <ej...@upromise.com> wrote:
>
> Hello all - I have what seems like a simple question that's got me
> stumped at the moment.
>
> Is there a way to iterate over the dependencies in a particular project
> inside a custom plugin?
>
> I keep wanting to do something like:
>
>     ArrayList deps = (ArrayList) proj.getDependencies();
>     for(int x = 0; x < deps.size(); x++)
>     {
>      getLog().info("--> "+deps.get(x));
>     }
>
> Just for testing purposes, but at runtime, I keep getting this
> stacktrace:
>
> java.lang.NoClassDefFoundError: org/apache/maven/project/Model
>        at org.apache.maven.project.Project.<init>(Project.java:120)
>        at com.upromise.maven.helpers.ManiGen.execute(ManiGen.java:20)
>        at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa
> nager.java:420)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
> LifecycleExecutor.java:539)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoa
> l(DefaultLifecycleExecutor.java:493)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL
> ifecycleExecutor.java:463)
>
> I get the feeling I'm not using the right Project class.


I think you're missing a dependency in your plugin POM so that the classpath
affected to your plugin is not complete.

Jeff


Any suggestions would be really helpful.
>



-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com