Remove dup code for profile creation.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@750144 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2009-03-04 20:33:54 +00:00
parent accba53f35
commit 4af4093d4c
2 changed files with 12 additions and 45 deletions

View File

@ -340,31 +340,6 @@ public class DefaultProjectErrorReporter
registerBuildError( cause, writer.toString() );
}
public void reportBadNonDependencyProjectArtifactVersion( MavenProject project,
File pomFile,
InvalidProjectVersionException cause )
{
StringWriter writer = new StringWriter();
writer.write( NEWLINE );
writer.write( "You have an invalid version in your POM:" );
writer.write( NEWLINE );
writer.write( NEWLINE );
writer.write( "Location: " );
writer.write( cause.getLocationInPom() );
writer.write( NEWLINE );
writer.write( NEWLINE );
writer.write( "Reason: " );
writer.write( cause.getMessage() );
writer.write( NEWLINE );
addStandardInfo( project.getId(), pomFile, writer );
addTips( ProjectErrorTips.getTipsForBadNonDependencyArtifactSpec( project, pomFile, cause ),
writer );
registerBuildError( cause, writer.toString() );
}
public void reportProjectValidationFailure( MavenProject project,
File pomFile,

View File

@ -637,22 +637,7 @@ public class DefaultMavenProjectBuilder
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(domainModel.getModelProperties(),
PomTransformer.MODEL_CONTAINER_FACTORIES), activeProfileIds, inactiveProfileIds, properties);
Collection<ModelContainer> profileContainers = profileContext.getActiveProfiles();
for(ModelContainer mc : profileContainers)
{
List<ModelProperty> transformed = new ArrayList<ModelProperty>();
for(ModelProperty mp : mc.getProperties())
{
if(mp.getUri().startsWith(ProjectUri.Profiles.Profile.xUri) && !mp.getUri().equals(ProjectUri.Profiles.Profile.id)
&& !mp.getUri().startsWith(ProjectUri.Profiles.Profile.Activation.xUri) )
{
transformed.add(new ModelProperty(mp.getUri().replace(ProjectUri.Profiles.Profile.xUri, ProjectUri.xUri),
mp.getResolvedValue()));
}
}
domainModels.add(new PomClassicDomainModel(transformed, false));
}
domainModels.addAll( transformProfiles(profileContext) );
domainModels.add( domainModel );
File parentFile = null;
@ -840,6 +825,16 @@ public class DefaultMavenProjectBuilder
//Process Profiles
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(parentDomainModel.getModelProperties(),
PomTransformer.MODEL_CONTAINER_FACTORIES), activeProfileIds, inactiveProfileIds, properties);
domainModels.addAll( transformProfiles(profileContext) );
domainModels.addAll( getDomainModelParentsFromRepository( parentDomainModel, localRepository, remoteRepositories, properties,
activeProfileIds, inactiveProfileIds ) );
return domainModels;
}
private static List<DomainModel> transformProfiles( ProfileContext profileContext ) throws IOException
{
List<DomainModel> domainModels = new ArrayList<DomainModel>();
Collection<ModelContainer> profileContainers = profileContext.getActiveProfiles();
for(ModelContainer mc : profileContainers)
@ -858,9 +853,6 @@ public class DefaultMavenProjectBuilder
domainModels.add(new PomClassicDomainModel(transformed));
}
domainModels.addAll( getDomainModelParentsFromRepository( parentDomainModel, localRepository, remoteRepositories, properties,
activeProfileIds, inactiveProfileIds ) );
return domainModels;
}