mirror of
https://github.com/apache/maven.git
synced 2025-02-10 03:56:01 +00:00
Further cleanup of maven project APIs.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@761112 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bd45240fe2
commit
421732b443
@ -55,6 +55,8 @@ public ProfileContext( List<Profile> profiles, ProfileContextInfo profileContext
|
|||||||
this.inactiveProfileIds = profileContextInfo.getInactiveProfileIds();
|
this.inactiveProfileIds = profileContextInfo.getInactiveProfileIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public Collection<Profile> getActiveProfilesFrom(ProfileManager manaa)
|
||||||
|
|
||||||
public Collection<Profile> getActiveProfiles()
|
public Collection<Profile> getActiveProfiles()
|
||||||
{
|
{
|
||||||
List<Profile> matchedProfiles = new ArrayList<Profile>();
|
List<Profile> matchedProfiles = new ArrayList<Profile>();
|
||||||
|
@ -123,15 +123,17 @@ public MavenProject build( File pomFile, ProjectBuilderConfiguration configurati
|
|||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
PomClassicDomainModel domainModel;
|
PomClassicDomainModel domainModel;
|
||||||
try {
|
try
|
||||||
domainModel = buildWithoutProfiles( "unknown", pomFile, configuration.getLocalRepository(), configuration.getRemoteRepositories(), configuration );
|
{
|
||||||
} catch (IOException e) {
|
domainModel = buildWithoutProfiles( "unknown", pomFile, configuration );
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
throw new ProjectBuildingException("", "", e);
|
throw new ProjectBuildingException("", "", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MavenProject project = buildWithProfiles( domainModel, configuration, pomFile );
|
||||||
|
|
||||||
MavenProject project = buildWithProfiles( domainModel, configuration, pomFile, domainModel.getParentFile() );
|
|
||||||
project.setFile( pomFile );
|
|
||||||
Build build = project.getBuild();
|
Build build = project.getBuild();
|
||||||
// NOTE: setting this script-source root before path translation, because
|
// NOTE: setting this script-source root before path translation, because
|
||||||
// the plugin tools compose basedir and scriptSourceRoot into a single file.
|
// the plugin tools compose basedir and scriptSourceRoot into a single file.
|
||||||
@ -184,13 +186,16 @@ public MavenProject buildFromRepository(Artifact artifact, ProjectBuilderConfigu
|
|||||||
throw new ProjectBuildingException( artifact.getId(), "Error resolving project artifact.", e );
|
throw new ProjectBuildingException( artifact.getId(), "Error resolving project artifact.", e );
|
||||||
}
|
}
|
||||||
PomClassicDomainModel domainModel;
|
PomClassicDomainModel domainModel;
|
||||||
try {
|
try
|
||||||
domainModel = buildWithoutProfiles( "unknown", artifact.getFile(), configuration.getLocalRepository(),
|
{
|
||||||
configuration.getRemoteRepositories(), configuration );
|
domainModel = buildWithoutProfiles( "unknown", artifact.getFile(), configuration );
|
||||||
} catch (IOException e) {
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
throw new ProjectBuildingException(artifact.getId(), "Error reading project artifact.", e);
|
throw new ProjectBuildingException(artifact.getId(), "Error reading project artifact.", e);
|
||||||
}
|
}
|
||||||
project = buildWithProfiles( domainModel, configuration, artifact.getFile(), domainModel.getParentFile() );
|
|
||||||
|
project = buildWithProfiles( domainModel, configuration, artifact.getFile() );
|
||||||
|
|
||||||
artifact.setFile( artifact.getFile() );
|
artifact.setFile( artifact.getFile() );
|
||||||
project.setVersion( artifact.getVersion() );
|
project.setVersion( artifact.getVersion() );
|
||||||
@ -200,6 +205,7 @@ public MavenProject buildFromRepository(Artifact artifact, ProjectBuilderConfigu
|
|||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Get rid of this after merge of new PluginManager code
|
||||||
public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
|
public MavenProject buildFromRepository( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
@ -284,7 +290,7 @@ public MavenProjectBuildingResult buildProjectWithDependencies( File pomFile, Pr
|
|||||||
return new MavenProjectBuildingResult( project, result );
|
return new MavenProjectBuildingResult( project, result );
|
||||||
}
|
}
|
||||||
|
|
||||||
private MavenProject buildWithProfiles( PomClassicDomainModel domainModel, ProjectBuilderConfiguration config, File projectDescriptor, File parentDescriptor )
|
private MavenProject buildWithProfiles( PomClassicDomainModel domainModel, ProjectBuilderConfiguration config, File projectDescriptor )
|
||||||
throws ProjectBuildingException
|
throws ProjectBuildingException
|
||||||
{
|
{
|
||||||
Model model;
|
Model model;
|
||||||
@ -296,6 +302,8 @@ private MavenProject buildWithProfiles( PomClassicDomainModel domainModel, Proje
|
|||||||
{
|
{
|
||||||
throw new ProjectBuildingException("", e.getMessage());
|
throw new ProjectBuildingException("", e.getMessage());
|
||||||
}
|
}
|
||||||
|
File parentDescriptor = domainModel.getParentFile();
|
||||||
|
|
||||||
String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
|
String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
|
||||||
|
|
||||||
List<Profile> projectProfiles = new ArrayList<Profile>();
|
List<Profile> projectProfiles = new ArrayList<Profile>();
|
||||||
@ -381,8 +389,7 @@ private MavenProject buildWithProfiles( PomClassicDomainModel domainModel, Proje
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private PomClassicDomainModel buildWithoutProfiles( String projectId, File pomFile, ArtifactRepository localRepository,
|
private PomClassicDomainModel buildWithoutProfiles( String projectId, File pomFile, ProjectBuilderConfiguration projectBuilderConfiguration )
|
||||||
List<ArtifactRepository> remoteRepositories, ProjectBuilderConfiguration projectBuilderConfiguration )
|
|
||||||
throws ProjectBuildingException, IOException
|
throws ProjectBuildingException, IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -393,7 +400,7 @@ private PomClassicDomainModel buildWithoutProfiles( String projectId, File pomFi
|
|||||||
.getGlobalProfileManager().getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyInactiveProfileIds()
|
.getGlobalProfileManager().getProfileActivationContext() != null ) ? projectBuilderConfiguration.getGlobalProfileManager().getProfileActivationContext().getExplicitlyInactiveProfileIds()
|
||||||
: new ArrayList<String>();
|
: new ArrayList<String>();
|
||||||
|
|
||||||
return buildModel( pomFile, new ProfileContextInfo(null, activeProfileIds, inactiveProfileIds), localRepository, remoteRepositories );
|
return buildModel( pomFile, new ProfileContextInfo(null, activeProfileIds, inactiveProfileIds), projectBuilderConfiguration );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateModel( Model model, File pomFile )
|
private void validateModel( Model model, File pomFile )
|
||||||
@ -443,7 +450,7 @@ private static void setBuildOutputDirectoryOnParent( MavenProject project )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PomClassicDomainModel buildModel( File pom, ProfileContextInfo profileInfo, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
|
private PomClassicDomainModel buildModel( File pom, ProfileContextInfo profileInfo, ProjectBuilderConfiguration config )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
if ( pom == null )
|
if ( pom == null )
|
||||||
@ -458,6 +465,8 @@ private PomClassicDomainModel buildModel( File pom, ProfileContextInfo profileIn
|
|||||||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||||
|
|
||||||
domainModels.add( domainModel );
|
domainModels.add( domainModel );
|
||||||
|
ArtifactRepository localRepository = config.getLocalRepository();
|
||||||
|
List<ArtifactRepository> remoteRepositories = config.getRemoteRepositories();
|
||||||
|
|
||||||
File parentFile = null;
|
File parentFile = null;
|
||||||
int lineageCount = 0;
|
int lineageCount = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user