You must declare a parameter in your Mojo of class Project and use the
expression ${project}

Jeff



On 12/12/07, EJ Ciramella <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
> > 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to