I got the expect result.I use mvn compile myplugin:mojo to run my own task, instead of mvn myplugin:mojo. It works.
Is it because the compile phase to load the dependency graph of the project, even if I use @requiresDependencyResolution test it doesn't work. 2008/9/17 Brian E. Fox <[EMAIL PROTECTED]> > You need to add @requiresDependencyResolution test (or compile etc) > > -----Original Message----- > From: 陈思淼 [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 17, 2008 10:44 AM > To: Maven Users List > Subject: How to get all dependecy in a mojo ? > > My mojo extends AbstractWarMojo, I want to get all the Project's > dependencies including the transitive denpendecies. So i config the > MavenProject in my mojo like thsi: > > > > /** > > > * The maven project. > > > * > > > * @parameter expression="${project}" > > > * @required > > > * @readonly > > > */ > > > private MavenProject project; > > project.getArtifacts() is a empty collection. I saw war plugin and them get > all the war's dependencies in this way? who can tell me how to get all > dependecy in a mojo ? > Thank you. >