maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Régis LOWE <emailregis-javamailingl...@yahoo.fr>
Subject Re: Dependency path
Date Mon, 31 Oct 2005 07:49:41 GMT
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 <brett.porter@gmail.com> 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
> <emailregis-javamailinglist@yahoo.fr> 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:
> 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
> 
> 



	
	
		
___________________________________________________________________________
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message