public MavenProject build( File pom, ProjectBuilderConfiguration configuration ) throws ProjectBuildingException { ProjectBuildingRequest request = injectSession( toRequest( configuration ) ); try { return projectBuilder.build( pom, request ).getProject(); } catch ( ProjectBuildingException e ) { throw transformError( e ); } }
/** * This is used for pom-less execution like running archetype:generate. I am taking out the profile handling and the * interpolation of the base directory until we spec this out properly. */ public MavenProject buildStandaloneSuperProject( ProjectBuilderConfiguration configuration ) throws ProjectBuildingException { ProjectBuildingRequest request = injectSession( toRequest( configuration ) ); request.setProcessPlugins( false ); request.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); ModelSource modelSource = new UrlModelSource( getClass().getResource( "standalone.xml" ) ); MavenProject project = projectBuilder.build( modelSource, request ).getProject(); project.setExecutionRoot( true ); return project; }
public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ProjectBuilderConfiguration configuration, boolean allowStubModel ) throws ProjectBuildingException { ProjectBuildingRequest request = injectSession( toRequest( configuration ) ); request.setRemoteRepositories( normalizeToArtifactRepositories( remoteRepositories, request ) ); request.setProcessPlugins( false ); request.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); try { return projectBuilder.build( artifact, allowStubModel, request ).getProject(); } catch ( ProjectBuildingException e ) { throw transformError( e ); } }
public MavenProject buildWithDependencies( File pom, ArtifactRepository localRepository, ProfileManager profileManager, TransferListener transferListener ) throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException { ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); configuration.setLocalRepository( localRepository ); configuration.setGlobalProfileManager( profileManager ); ProjectBuildingRequest request = injectSession( toRequest( configuration ) ); request.setResolveDependencies( true ); try { return projectBuilder.build( pom, request ).getProject(); } catch ( ProjectBuildingException e ) { throw transformError( e ); } }