| Method from org.apache.maven.project.DefaultMavenProjectBuilder Detail: |
public MavenProject build(File pom,
ProjectBuilderConfiguration config) throws ProjectBuildingException {
return buildFromSourceFileInternal( pom, config, true );
}
|
public MavenProject build(File pom,
ProjectBuilderConfiguration config,
boolean checkDistributionManagementStatus) throws ProjectBuildingException {
return buildFromSourceFileInternal( pom, config, checkDistributionManagementStatus );
}
|
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 buildFromRepository(Artifact artifact,
List remoteArtifactRepositories,
ArtifactRepository localRepository) throws ProjectBuildingException {
return buildFromRepository( artifact, remoteArtifactRepositories, localRepository, true );
}
|
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 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 ) );
}
|
public MavenProject buildStandaloneSuperProject(ProjectBuilderConfiguration config) throws ProjectBuildingException {
Model superModel = getSuperModel();
superModel.setGroupId( STANDALONE_SUPERPOM_GROUPID );
superModel.setArtifactId( STANDALONE_SUPERPOM_ARTIFACTID );
superModel.setVersion( STANDALONE_SUPERPOM_VERSION );
List activeProfiles;
ProfileManager profileManager = config.getGlobalProfileManager();
if ( profileManager == null )
{
profileManager = new DefaultProfileManager( container );
}
profileManager.addProfiles( superModel.getProfiles() );
String projectId = safeVersionlessKey( STANDALONE_SUPERPOM_GROUPID, STANDALONE_SUPERPOM_ARTIFACTID );
activeProfiles = injectActiveProfiles( profileManager, superModel );
MavenProject project = new MavenProject( superModel );
project.setManagedVersionMap(
createManagedVersionMap( projectId, superModel.getDependencyManagement(), null ) );
project.setActiveProfiles( activeProfiles );
project.setOriginalModel( superModel );
try
{
project = processProjectLogic( "< Super-POM >", project, config, null, null, true, true );
project.setExecutionRoot( true );
return project;
}
catch ( ModelInterpolationException e )
{
throw new ProjectBuildingException( projectId, e.getMessage(), e );
}
catch ( InvalidRepositoryException e )
{
throw new ProjectBuildingException( projectId, e.getMessage(), e );
}
}
|
public MavenProject buildStandaloneSuperProject(ArtifactRepository localRepository,
ProfileManager profileManager) throws ProjectBuildingException {
return buildStandaloneSuperProject( new DefaultProjectBuilderConfiguration().setLocalRepository( localRepository )
.setGlobalProfileManager( profileManager ) );
}
|
public MavenProject buildWithDependencies(File projectDescriptor,
ArtifactRepository localRepository,
ProfileManager profileManager) throws ArtifactResolutionException, ArtifactNotFoundException, ProjectBuildingException {
return buildWithDependencies( projectDescriptor, localRepository, profileManager, null );
}
|
public MavenProject buildWithDependencies(File projectDescriptor,
ArtifactRepository localRepository,
ProfileManager profileManager,
TransferListener transferListener) throws ArtifactResolutionException, ArtifactNotFoundException, ProjectBuildingException {
MavenProject project = build( projectDescriptor, localRepository, profileManager, false );
// ----------------------------------------------------------------------
// Typically when the project builder is being used from maven proper
// the transitive dependencies will not be resolved here because this
// requires a lot of work when we may only be interested in running
// something simple like 'm2 clean'. So the artifact collector is used
// in the dependency resolution phase if it is required by any of the
// goals being executed. But when used as a component in another piece
// of code people may just want to build maven projects and have the
// dependencies resolved for whatever reason: this is why we keep
// this snippet of code here.
// ----------------------------------------------------------------------
// TODO: such a call in MavenMetadataSource too - packaging not really the intention of type
Artifact projectArtifact = project.getArtifact();
String projectId = safeVersionlessKey( project.getGroupId(), project.getArtifactId() );
// Map managedVersions = createManagedVersionMap( projectId, project.getDependencyManagement() );
Map managedVersions = project.getManagedVersionMap();
ensureMetadataSourceIsInitialized();
try
{
project.setDependencyArtifacts( project.createArtifacts( artifactFactory, null, null ) );
}
catch ( InvalidDependencyVersionException e )
{
throw new ProjectBuildingException( projectId,
"Unable to build project due to an invalid dependency version: " +
e.getMessage(), e );
}
if ( transferListener != null )
{
wagonManager.setDownloadMonitor( transferListener );
}
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getDependencyArtifacts(),
projectArtifact, managedVersions,
localRepository,
project.getRemoteArtifactRepositories(),
artifactMetadataSource );
project.setArtifacts( result.getArtifacts() );
return project;
}
|
public void contextualize(Context context) throws ContextException {
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
|
protected Set createExtensionArtifacts(String projectId,
List extensions) throws ProjectBuildingException {
Set extensionArtifacts = new HashSet();
if ( extensions != null )
{
for ( Iterator i = extensions.iterator(); i.hasNext(); )
{
Extension ext = (Extension) i.next();
String version;
if ( StringUtils.isEmpty( ext.getVersion() ) )
{
version = "RELEASE";
}
else
{
version = ext.getVersion();
}
Artifact artifact;
try
{
VersionRange versionRange = VersionRange.createFromVersionSpec( version );
artifact =
artifactFactory.createExtensionArtifact( ext.getGroupId(), ext.getArtifactId(), versionRange );
}
catch ( InvalidVersionSpecificationException e )
{
throw new ProjectBuildingException( projectId, "Unable to parse version '" + version +
"' for extension '" + ArtifactUtils.versionlessKey( ext.getGroupId(), ext.getArtifactId() ) +
"': " + e.getMessage(), e );
}
if ( artifact != null )
{
extensionArtifacts.add( artifact );
}
}
}
return extensionArtifacts;
}
|
protected Set createPluginArtifacts(String projectId,
List plugins) throws ProjectBuildingException {
Set pluginArtifacts = new HashSet();
for ( Iterator i = plugins.iterator(); i.hasNext(); )
{
Plugin p = (Plugin) i.next();
String version;
if ( StringUtils.isEmpty( p.getVersion() ) )
{
version = "RELEASE";
}
else
{
version = p.getVersion();
}
Artifact artifact;
try
{
artifact = artifactFactory.createPluginArtifact( p.getGroupId(), p.getArtifactId(),
VersionRange.createFromVersionSpec( version ) );
}
catch ( InvalidVersionSpecificationException e )
{
throw new ProjectBuildingException( projectId, "Unable to parse version '" + version +
"' for plugin '" + ArtifactUtils.versionlessKey( p.getGroupId(), p.getArtifactId() ) + "': " +
e.getMessage(), e );
}
if ( artifact != null )
{
pluginArtifacts.add( artifact );
}
}
return pluginArtifacts;
}
|
protected Set createReportArtifacts(String projectId,
List reports) throws ProjectBuildingException {
Set pluginArtifacts = new HashSet();
if ( reports != null )
{
for ( Iterator i = reports.iterator(); i.hasNext(); )
{
ReportPlugin p = (ReportPlugin) i.next();
String version;
if ( StringUtils.isEmpty( p.getVersion() ) )
{
version = "RELEASE";
}
else
{
version = p.getVersion();
}
Artifact artifact;
try
{
artifact = artifactFactory.createPluginArtifact( p.getGroupId(), p.getArtifactId(),
VersionRange.createFromVersionSpec( version ) );
}
catch ( InvalidVersionSpecificationException e )
{
throw new ProjectBuildingException( projectId, "Unable to parse version '" + version +
"' for report '" + ArtifactUtils.versionlessKey( p.getGroupId(), p.getArtifactId() ) + "': " +
e.getMessage(), e );
}
if ( artifact != null )
{
pluginArtifacts.add( artifact );
}
}
}
return pluginArtifacts;
}
|
public void initialize() {
modelReader = new MavenXpp3Reader();
}
|