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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED] > 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:[EMAIL PROTECTED] > 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:[EMAIL PROTECTED] > 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:[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED]> wrote: > > 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 > > > > --------------------------------------------------------------------- > 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] > > > --------------------------------------------------------------------- > 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] > > > --------------------------------------------------------------------- > 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]
