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

 

 

 

 

 

 

Reply via email to