maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Tran <dant...@gmail.com>
Subject Re: Generate A Maven artifact's dependencies and licenses ( how to instantiate a MavenProject using a giving artifact coordinate)
Date Sat, 12 Jul 2014 18:06:22 GMT
I found a solution for this is to start up with my existing MavenProject
which is very much empty since it is run under standalone command line,
push the interested artifact into the MavenProject as a dependency
artifact, after that I can use it with MavenDependencyGraphBuilder

-Dan


On Fri, Jul 11, 2014 at 9:55 PM, Dan Tran <dantran@gmail.com> wrote:

>
> Hello,
>
> I have a need to create an spreadsheet ( for legal purpose) containing a
> Maven artifact, base on a given coordinate,  and all of its transitive
> dependencies and associated license info
>
> There are 2 plugins having this kind of requirements:
> maven-project-info-report-plugin and license-maven-plugin, both of these
> projects  have a maven project to work with. ( ie MavenProject )
>
> For my case,  I need to  instantiate MavenProject from the provided
> artifact using ProjectBuilder component, but this gives all kind of problem
> from stack overflow to NPE
>
> here is code
>
>     private MavenProject getMavenProjectFromArtifact( Artifact artifact )
>         throws ProjectBuildingException
>     {
>         ProjectBuildingRequest request = new
> DefaultProjectBuildingRequest();
>         request.setLocalRepository( localRepository );
>         request.setPluginArtifactRepositories( pluginArtifactRepositories
> );
>         request.setRemoteRepositories( remoteRepositories );
>         request.setResolveDependencies( true );
>         request.setResolveVersionRanges( true );
>
>
>         ProjectBuildingResult result = projectBuilder.build( artifact,
> request );
>
>         return result.getProject();
>     }
>
>
> Am I using the right builder?
>
>
> Any advice to get this working is very much appreciated.
>
>
> Thanks
>
> -Dan
>
>
>
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message