You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Frederik Bayart <fb...@myrio.com> on 2006/08/04 06:24:28 UTC

[m2] runtime classpath/transitive dependencies from an artifact resolved from repository

Hallo,

 

I'm try to get the runtime classpath from an artifact resolved from the
repository, or at least the transitive dependencies.

I try to use the maven-dependency and maven-assembly plugin as example,
without success at the moment.

So this is my source code :

 

artifact =
artifactFactory.createArtifact(groupId,artifactId,version,Artifact.SCOPE
_PROVIDED, "jar" );

artifactResolver.resolve(artifact,
this.project.getRemoteArtifactRepositories(), localRepo);

artifactProject = projectBuilder.buildFromRepository(artifact,
this.project.getRemoteArtifactRepositories(),localRepo);

 

Now the problem is that the api's are not documented, so I have to guess
a little bit what a certain function could do.

 

if I ask the runtime classpath of this project with

 

artifactProject.getRuntimeClasspathElements();

 

I get only "target/classes" as runtime classpath, so probably this
function is not what I'm looking for. So I try to do the job via
dependencies.

 

artifactProject.getDependencies() returns the direct dependencies, but I
need also the indirect dependencies.

 

So I try the function 

 

result = resolver.resolveTransitively( new HashSet(),

                                artifactProject.getArtifact(),

 
this.project.getRemoteArtifactRepositories(),

                                localRepo,

                                this.metadataSource );

 

hoping that this would be return the transitive dependencies. However
this returns an empty result set.

 

The metadata source is defined as parameter by :

 

@parameter
expression="${component.org.apache.maven.artifact.metadata.ArtifactMetad
ataSource}"

 

Can anybody give some help ? The last weeks, I saw on the mailing list
that several people where trying to do something similar.

 

Frederik

 

 

 

 

 

 


Re: [m2] runtime classpath/transitive dependencies from an artifact res

Posted by nsm <it...@hotmail.com>.
Hi Frederik,

I am in the same boat as you. 
If you made progress or found any solution, please share your experience

Thanks
nsm


Frederik Bayart-2 wrote:
> 
> Hallo,
> 
>  
> 
> I'm try to get the runtime classpath from an artifact resolved from the
> repository, or at least the transitive dependencies.
> 
> I try to use the maven-dependency and maven-assembly plugin as example,
> without success at the moment.
> 
> So this is my source code :
> 
>  
> 
> artifact =
> artifactFactory.createArtifact(groupId,artifactId,version,Artifact.SCOPE
> _PROVIDED, "jar" );
> 
> artifactResolver.resolve(artifact,
> this.project.getRemoteArtifactRepositories(), localRepo);
> 
> artifactProject = projectBuilder.buildFromRepository(artifact,
> this.project.getRemoteArtifactRepositories(),localRepo);
> 
>  
> 
> Now the problem is that the api's are not documented, so I have to guess
> a little bit what a certain function could do.
> 
>  
> 
> if I ask the runtime classpath of this project with
> 
>  
> 
> artifactProject.getRuntimeClasspathElements();
> 
>  
> 
> I get only "target/classes" as runtime classpath, so probably this
> function is not what I'm looking for. So I try to do the job via
> dependencies.
> 
>  
> 
> artifactProject.getDependencies() returns the direct dependencies, but I
> need also the indirect dependencies.
> 
>  
> 
> So I try the function 
> 
>  
> 
> result = resolver.resolveTransitively( new HashSet(),
> 
>                                 artifactProject.getArtifact(),
> 
>  
> this.project.getRemoteArtifactRepositories(),
> 
>                                 localRepo,
> 
>                                 this.metadataSource );
> 
>  
> 
> hoping that this would be return the transitive dependencies. However
> this returns an empty result set.
> 
>  
> 
> The metadata source is defined as parameter by :
> 
>  
> 
> @parameter
> expression="${component.org.apache.maven.artifact.metadata.ArtifactMetad
> ataSource}"
> 
>  
> 
> Can anybody give some help ? The last weeks, I saw on the mailing list
> that several people where trying to do something similar.
> 
>  
> 
> Frederik
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-m2--runtime-classpath-transitive-dependencies--from-an-artifact-resolved-from-repository-tf2049286.html#a6181567
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org