public MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories, ArtifactRepository localRepository, boolean allowStubModel ) throws ProjectBuildingException { String cacheKey = createCacheKey( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); MavenProject project = (MavenProject) processedProjectCache.get( cacheKey ); if ( project != null ) { return project; } Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository, allowStubModel ); ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ); return buildInternal( "Artifact [" + artifact + "]", model, config, remoteArtifactRepositories, null, false ); }
public MavenProject build( File projectDescriptor, ArtifactRepository localRepository, ProfileManager profileManager ) throws ProjectBuildingException { ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ).setGlobalProfileManager( profileManager ); return buildFromSourceFileInternal( projectDescriptor, config, true ); }
public MavenProject build( File projectDescriptor, ArtifactRepository localRepository, ProfileManager profileManager, boolean checkDistributionManagementStatus ) throws ProjectBuildingException { ProjectBuilderConfiguration config = new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ).setGlobalProfileManager( profileManager ); return buildFromSourceFileInternal( projectDescriptor, config, checkDistributionManagementStatus ); }
public MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository, ProfileManager profileManager ) throws ProjectBuildingException { return buildStandaloneSuperProject( new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ) .setGlobalProfileManager( profileManager ) ); }
public MavenProject buildStandaloneSuperProject( ArtifactRepository localRepository ) throws ProjectBuildingException { //TODO mkleint - use the (Container, Properties) constructor to make system properties embeddable ProfileManager profileManager = new DefaultProfileManager( container ); return buildStandaloneSuperProject( new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository ) .setGlobalProfileManager( profileManager ) ); }
/** * creates model lineage for the given pom file. * Useful to be able to locate where certain elements are defined. * * @param pom * @param embedder * @param allowStubs * @return */ public static ModelLineage createModelLineage(File pom, MavenEmbedder embedder, boolean allowStubs) throws ProjectBuildingException { try { ModelLineageBuilder bldr = (ModelLineageBuilder) embedder.getPlexusContainer().lookup(ModelLineageBuilder.class); ProfileActivationContext context = new DefaultProfileActivationContext(new Properties(), true); //TODO shall we pass some execution props in here? ProfileManager manager = new DefaultProfileManager(embedder.getPlexusContainer(), context); DefaultProjectBuilderConfiguration conf = new DefaultProjectBuilderConfiguration(); conf.setGlobalProfileManager(manager); conf.setExecutionProperties(new Properties()); conf.setLocalRepository(embedder.getLocalRepository()); conf.setUserProperties(new Properties()); return bldr.buildModelLineage(pom, conf, new ArrayList(), allowStubs, true); } catch (ComponentLookupException ex) { Exceptions.printStackTrace(ex); } return new DefaultModelLineage(); }
/** * creates model lineage for the given pom file. * Useful to be able to locate where certain elements are defined. * * @param pom * @param embedder * @param allowStubs * @return */ public static ModelLineage createModelLineage(File pom, MavenEmbedder embedder, boolean allowStubs) throws ProjectBuildingException { try { ModelLineageBuilder bldr = (ModelLineageBuilder) embedder.getPlexusContainer().lookup(ModelLineageBuilder.class); ProfileActivationContext context = new DefaultProfileActivationContext(new Properties(), true); //TODO shall we pass some execution props in here? ProfileManager manager = new DefaultProfileManager(embedder.getPlexusContainer(), context); DefaultProjectBuilderConfiguration conf = new DefaultProjectBuilderConfiguration(); conf.setGlobalProfileManager(manager); conf.setExecutionProperties(new Properties()); conf.setLocalRepository(embedder.getLocalRepository()); conf.setUserProperties(new Properties()); return bldr.buildModelLineage(pom, conf, new ArrayList(), allowStubs, true); } catch (ComponentLookupException ex) { Exceptions.printStackTrace(ex); } return new DefaultModelLineage(); }
/** * Create a minimal project when no POM is available. * * @param localRepository * @return */ protected MavenProject createMinimalProject( ArtifactRepository localRepository ) { MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE ); DefaultProjectBuilderConfiguration builderConfig = new DefaultProjectBuilderConfiguration( ); builderConfig.setLocalRepository( localRepository ); builderConfig.setGlobalProfileManager( getProfileManager() ); try { MavenProject mavenProject = projectBuilder.buildStandaloneSuperProject(builderConfig); // if we don't null out these fields then the pom that will be created is at the super-pom's // GAV coordinates and we will not be able to inherit partial GAV coordinates from a parent GAV. mavenProject.setGroupId(null); mavenProject.setArtifactId(null); mavenProject.setVersion(null); return mavenProject; } catch ( ProjectBuildingException e ) { throw new BuildException( "Unable to create dummy Pom", e ); } }