3 hints: 1. read Dan's explanations /> If you set “setResolveTransitively(true)” then the/ /> ArtifactResolutionResponse would have all the deps available in it./
2. try Dan's code: it's pretty straightforward 3. explain what you want to see more than this code (which set everything to let code downlaod anything, then asks resolver to resolve) Le vendredi 20 juin 2014 18:56:33 William Ferguson a écrit : > OK, so it will resolve from the reactor. > > But is the ArtifactResolutionResult going to contain the dependencies of > the Artifact that I resolve? > > > On Fri, Jun 20, 2014 at 6:46 PM, Hervé BOUTEMY <herve.bout...@free.fr> > > wrote: > > Le vendredi 20 juin 2014 08:36:46 William Ferguson a écrit : > > > Hi Dan, > > > > > > if the ArtifactResolutionResult contains the deps for the Artifact in > > > the > > > request then that's exactly what I want. However I can't see that it > > > > does. > > > > > What am I missing? > > > > > > NB the resolution also needs to be able to resolve Artifacts in the > > > reactor. I'm pretty certain that > > > > > > @Component > > > > > > private org.apache.maven.repository.RepositorySystem repository; > > > > > > is only going to resolve from the local repo, not the reactor, right? > > > > wrong, I already: > > - explained it > > - updated maven-dependency-tree javadoc to keep track of explanations [1] > > - updated the reactor IT to prove that it runs as expected (ie not > > resolved > > before compile, but resolved after compile) > > > > Regards, > > > > Hervé > > > > [1] > > http://maven.apache.org/shared-archives/maven-dependency-tree-LATEST/apido > > cs/org/apache/maven/shared/dependency/graph/DependencyGraphBuilder.html> > > > William > > > > > > On Fri, Jun 20, 2014 at 4:58 AM, Daniel Kulp <dk...@apache.org> wrote: > > > > For Aries, I ended up doing: > > > > @Component > > > > private org.apache.maven.repository.RepositorySystem repository; > > > > > > > > private File resolve(String artifactDescriptor) { > > > > > > > > String[] s = artifactDescriptor.split(":"); > > > > > > > > String type = (s.length >= 4 ? s[3] : "jar"); > > > > Artifact artifact = repository.createArtifact(s[0], s[1], > > > > s[2], > > > > > > > > type); > > > > > > > > ArtifactResolutionRequest request = new > > > > > > > > ArtifactResolutionRequest(); > > > > > > > > request.setArtifact(artifact); > > > > > > > > request.setResolveRoot(true).setResolveTransitively(false); > > > > request.setServers( session.getRequest().getServers() ); > > > > request.setMirrors( session.getRequest().getMirrors() ); > > > > request.setProxies( session.getRequest().getProxies() ); > > > > request.setLocalRepository(session.getLocalRepository()); > > > > request.setRemoteRepositories(session.getRequest().getRemoteRepositories() > > > > > > );> > > > > > > > > repository.resolve(request); > > > > return artifact.getFile(); > > > > > > > > } > > > > > > > > If you set “setResolveTransitively(true)” then the > > > > ArtifactResolutionResponse would have all the deps available in it. > > > > > > > > That seems to work for both Maven 3.0 and 3.1/3.2. > > > > > > > > Dan > > > > > > > > > > > > Op Thu, 19 Jun 2014 00:01:52 +0200 schreef William Ferguson < > > > > > > > > william.fergu...@xandar.com.au>: > > > > > I asked on maven-users but didn't get any viable responses. So I'm > > > > > hoping > > > > > someone here can help. > > > > > > > > > > -------------------------- > > > > > I have a Mojo that needs to work with Maven 3.0.* and 3.1+ > > > > > > > > > > In the Mojo I have an Artifact and I need to resolve it's > > > > dependencies. > > > > > > How > > > > > > > > > can/should I do it? > > > > > > > > > > If I can resolve the Artifact to a MavenProject then I can use > > > > > DependencyGraphBuilder (from maven-dependency-tree) to construct a > > > > graph > > > > > > of > > > > > > > > > the deps. But I'm struggling to make the Artifact to MavenProject > > > > > conversion happen. > > > > > > > > > > I thought that If I could get a URL to the Artifact's POM file then > > > > > I