Thanks, but it still doesn't work.
project.getArtifacts() return an empty list.
/**
* The maven project.
* @resolveTransitiveDependencies
* @parameter expression="${project}"
* @required
* @readonly
*/
private MavenProject project;
public void execute() throws
MojoExecutionException {
getLog().info("size: " +
project.getArtifacts().size()); //return 0
for(Iterator
it=project.getArtifacts().iterator();it.hasNext();){
Artifact artifact=(Artifact)it.next();
getLog().info("arifact:
"+artifact.getFile());
}
--- Brett Porter <[EMAIL PROTECTED]> a écrit :
> This only returns whatever the systemPath tag is,
> which is not
> specified (as expected).
>
> What you want is to enumerate project.getArtifacts()
> - which includes
> all transitive dependencies, not just the ones
> listed - and use
> artifact.getFile() to get the location.
>
> To ensure the dependencies are resolved, you need to
> add
> @resolveTransitiveDependencies
> to the mojo metadat.a
>
> Cheers,
> Brett
>
> On 10/31/05, Régis LOWE
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I want to know how can I get the path of a
> dependency.
> > I've tried dependency.getSystemPath() but it
> returns
> > null.
> >
> >
>
//////////////////////////////////////////////////////////
> >
> > for (Iterator it =
> > project.getDependencies().iterator();
> it.hasNext();) {
> > Dependency dependency = (Dependency) it.next();
> > dependency.getSystemPath();//null
> > }
> >
> > here is my pom:
> > ...
> > <packaging>maven-plugin</packaging>
> > <version>1.0-SNAPSHOT</version>
> > <name>Maven Mojo Archetype</name>
> > <url>http://maven.apache.org</url>
> > <dependencies>
> > <dependency>
> > <groupId>org.apache.maven</groupId>
> > <artifactId>maven-plugin-api</artifactId>
> > <version>2.0</version>
> > </dependency>
> > <dependency>
> > <groupId>ant</groupId>
> > <artifactId>ant</artifactId>
> > <version>1.6.5</version>
> > </dependency>
> > <dependency>
> > <groupId>org.apache.maven</groupId>
> > <artifactId>maven-project</artifactId>
> > <version>2.0</version>
> > </dependency>
> > </dependencies>
> > ...
> >
> >
> >
> >
> >
> >
> >
> >
>
___________________________________________________________________________
> > Appel audio GRATUIT partout dans le monde avec le
> nouveau Yahoo! Messenger
> > Téléchargez cette version sur
> http://fr.messenger.yahoo.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]
>
>
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]