maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Tran <dant...@gmail.com>
Subject Generate A Maven artifact's dependencies and licenses ( how to instantiate a MavenProject using a giving artifact coordinate)
Date Sat, 12 Jul 2014 04:55:20 GMT
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