mirror of https://github.com/apache/maven.git
Fixed profile activation for profiles in pom. Profile injection was causing double injection of some elements from plugin mng. Partial fix.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@758473 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ff898bffd3
commit
a71841e776
|
@ -23,29 +23,19 @@ import org.apache.maven.model.Activation;
|
|||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.model.Parent;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||
import org.apache.maven.profiles.ProfileActivationContext;
|
||||
import org.apache.maven.profiles.ProfileActivationException;
|
||||
import org.apache.maven.profiles.ProfileManager;
|
||||
import org.apache.maven.shared.model.ModelContainer;
|
||||
import org.apache.maven.shared.model.ModelProperty;
|
||||
import org.apache.maven.shared.model.ModelMarshaller;
|
||||
import org.apache.maven.profiles.matchers.DefaultMatcher;
|
||||
import org.apache.maven.profiles.matchers.ProfileMatcher;
|
||||
import org.apache.maven.profiles.matchers.PropertyMatcher;
|
||||
import org.apache.maven.shared.model.InterpolatorProperty;
|
||||
import org.apache.maven.project.builder.factories.IdModelContainerFactory;
|
||||
import org.apache.maven.project.builder.ProjectUri;
|
||||
import org.apache.maven.project.builder.PomTransformer;
|
||||
import org.apache.maven.project.builder.PomInterpolatorTag;
|
||||
import org.apache.maven.project.builder.profile.*;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.MutablePlexusContainer;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlSerializer;
|
||||
import org.codehaus.plexus.util.xml.pull.MXSerializer;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
||||
public class DefaultProfileManager
|
||||
implements ProfileManager
|
||||
|
@ -193,16 +183,33 @@ public class DefaultProfileManager
|
|||
|
||||
allActive.addAll( activeExternal );
|
||||
allActive.addAll( activeFromPom );
|
||||
|
||||
List<Profile> defaults = getDefaultProfiles(allActive);
|
||||
if(defaults.size() < allActive.size())
|
||||
{
|
||||
allActive.removeAll( defaults );
|
||||
}
|
||||
return allActive;
|
||||
}
|
||||
|
||||
private static List<Profile> getDefaultProfiles(List<Profile> profiles)
|
||||
{
|
||||
List<Profile> defaults = new ArrayList<Profile>();
|
||||
for(Profile p : profiles)
|
||||
{
|
||||
if(p.getActivation() != null && p.getActivation().isActiveByDefault() )
|
||||
{
|
||||
defaults.add( p );
|
||||
}
|
||||
}
|
||||
return defaults;
|
||||
}
|
||||
|
||||
private static List<ActiveProfileMatcher> matchers = Arrays.asList(new FileMatcher(),
|
||||
new JdkMatcher(), new OperatingSystemMatcher(), new PropertyMatcher());
|
||||
private static List<ProfileMatcher> matchers = Arrays.asList( (ProfileMatcher) new DefaultMatcher(),
|
||||
(ProfileMatcher) new PropertyMatcher());
|
||||
|
||||
private boolean isActive( Profile profile, ProfileActivationContext context )
|
||||
throws ProfileActivationException
|
||||
{
|
||||
{/*
|
||||
//TODO: Using reflection now. Need to replace with custom mapper
|
||||
StringWriter writer = new StringWriter();
|
||||
XmlSerializer serializer = new MXSerializer();
|
||||
|
@ -264,6 +271,23 @@ public class DefaultProfileManager
|
|||
}
|
||||
}
|
||||
return false;
|
||||
*/
|
||||
List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
|
||||
if(context.getExecutionProperties() != null)
|
||||
{
|
||||
interpolatorProperties.addAll(InterpolatorProperty.toInterpolatorProperties(
|
||||
context.getExecutionProperties(),
|
||||
PomInterpolatorTag.EXECUTION_PROPERTIES.name()));
|
||||
}
|
||||
|
||||
for(ProfileMatcher matcher : matchers)
|
||||
{
|
||||
if(matcher.isMatch(profile, interpolatorProperties))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ProfileContext
|
|||
private ProfileMatcher defaultMatcher = new DefaultMatcher();
|
||||
|
||||
private List<ProfileMatcher> matchers =
|
||||
Collections.unmodifiableList( Arrays.asList( (ProfileMatcher) new PropertyMatcher() ) );
|
||||
Collections.unmodifiableList( Arrays.asList( new DefaultMatcher(), new PropertyMatcher() ) );
|
||||
|
||||
public ProfileContext( List<Profile> profiles, Collection<String> activeProfileIds,
|
||||
Collection<String> inactiveProfileIds, List<InterpolatorProperty> properties )
|
||||
|
|
|
@ -141,7 +141,7 @@ public class DefaultMavenProjectBuilder
|
|||
project.addCompileSourceRoot( build.getSourceDirectory() );
|
||||
project.addTestCompileSourceRoot( build.getTestSourceDirectory() );
|
||||
project.setFile( pomFile );
|
||||
|
||||
|
||||
setBuildOutputDirectoryOnParent( project );
|
||||
|
||||
hm.put( ArtifactUtils.artifactId( project.getGroupId(), project.getArtifactId(), "pom", project.getVersion() ), project );
|
||||
|
@ -278,12 +278,13 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
|
||||
|
||||
ProfileActivationContext profileActivationContext;
|
||||
|
||||
List<Profile> projectProfiles = new ArrayList<Profile>();
|
||||
ProfileManager externalProfileManager = config.getGlobalProfileManager();
|
||||
|
||||
if ( externalProfileManager != null )
|
||||
|
||||
ProfileActivationContext profileActivationContext = (externalProfileManager == null) ? new ProfileActivationContext( config.getExecutionProperties(), false ):
|
||||
externalProfileManager.getProfileActivationContext();
|
||||
|
||||
if(externalProfileManager != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -291,27 +292,32 @@ public class DefaultMavenProjectBuilder
|
|||
}
|
||||
catch ( ProfileActivationException e )
|
||||
{
|
||||
throw new ProjectBuildingException( projectId, "Failed to activate external profiles.", projectDescriptor, e );
|
||||
}
|
||||
profileActivationContext = externalProfileManager.getProfileActivationContext();
|
||||
throw new ProjectBuildingException( projectId, "Failed to activate external profiles.", projectDescriptor,
|
||||
e );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
profileActivationContext = new ProfileActivationContext( config.getExecutionProperties(), false );
|
||||
|
||||
ProfileManager profileManager = new DefaultProfileManager( container, profileActivationContext );
|
||||
profileManager.addProfiles( model.getProfiles() );
|
||||
try
|
||||
{
|
||||
projectProfiles.addAll( profileManager.getActiveProfiles( model ) );
|
||||
}
|
||||
catch ( ProfileActivationException e )
|
||||
{
|
||||
throw new ProjectBuildingException( projectId, "Failed to activate external profiles.", projectDescriptor, e );
|
||||
}
|
||||
ProfileManager profileManager = new DefaultProfileManager( container, profileActivationContext );
|
||||
profileManager.addProfiles( model.getProfiles() );
|
||||
|
||||
try
|
||||
{
|
||||
projectProfiles.addAll( profileManager.getActiveProfiles( model ) );
|
||||
}
|
||||
catch ( ProfileActivationException e )
|
||||
{
|
||||
throw new ProjectBuildingException( projectId, "Failed to activate pom profiles.", projectDescriptor,
|
||||
e );
|
||||
}
|
||||
|
||||
if(!projectProfiles.isEmpty())
|
||||
{
|
||||
/*
|
||||
for(Profile p : projectProfiles)
|
||||
{
|
||||
System.out.print( "Profile ID = " + p.getId() );
|
||||
}
|
||||
*/
|
||||
try
|
||||
{
|
||||
PomClassicDomainModel dm = ProcessorContext.mergeProfilesIntoModel( projectProfiles, model, false );
|
||||
|
@ -506,8 +512,16 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
ProfileContext profileContext1 = new ProfileContext( dm.getModel().getProfiles(), activeProfileIds,
|
||||
inactiveProfileIds, properties );
|
||||
profileModels.add(ProcessorContext.mergeProfilesIntoModel( profileContext1.getActiveProfiles(), dm.getModel(),
|
||||
dm.isMostSpecialized() ));
|
||||
Collection<Profile> profiles = profileContext1.getActiveProfiles();
|
||||
if(!profiles.isEmpty())
|
||||
{
|
||||
profileModels.add(ProcessorContext.mergeProfilesIntoModel( profileContext1.getActiveProfiles(), dm.getModel(),
|
||||
dm.isMostSpecialized() ));
|
||||
}
|
||||
else
|
||||
{
|
||||
profileModels.add( dm );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -652,7 +666,7 @@ public class DefaultMavenProjectBuilder
|
|||
//shane: what does this mean exactly and why does it occur
|
||||
logger.debug( "Parent pom ids do not match: Parent File = " + artifactParent.getFile().getAbsolutePath() + ": Child ID = " + domainModel.getId() );
|
||||
|
||||
return domainModels;
|
||||
// return domainModels;
|
||||
}
|
||||
|
||||
domainModels.add( parentDomainModel );
|
||||
|
|
|
@ -56,27 +56,25 @@ public class BuildProcessor
|
|||
if(build == null && !( p == null || p.getBuild() == null))
|
||||
{
|
||||
copy(p.getBuild(), t.getBuild(), isProfile);
|
||||
copyResources(p.getBuild(), t.getBuild());
|
||||
copyFilters(p.getBuild(), t.getBuild());
|
||||
pluginsProcessor.process( p.getBuild().getPlugins(), null, t.getBuild().getPlugins(), isChildMostSpecialized );
|
||||
inheritManagement(p.getBuild().getPluginManagement(), null, t.getBuild());
|
||||
}
|
||||
else if(build != null && !( p == null || p.getBuild() == null))
|
||||
{
|
||||
|
||||
{
|
||||
copy(p.getBuild(), t.getBuild(), isProfile);
|
||||
copy(build, t.getBuild(), isProfile);
|
||||
|
||||
copyResources(build, t.getBuild());
|
||||
copyResources(p.getBuild(), t.getBuild());
|
||||
|
||||
|
||||
copyFilters(build, t.getBuild());
|
||||
copyFilters(p.getBuild(), t.getBuild());
|
||||
|
||||
pluginsProcessor.process( p.getBuild().getPlugins(), build.getPlugins(), t.getBuild().getPlugins(), isChildMostSpecialized );
|
||||
inheritManagement(p.getBuild().getPluginManagement(), build.getPluginManagement(), t.getBuild());
|
||||
}
|
||||
else if(build != null )
|
||||
{
|
||||
copy(build, t.getBuild(), isProfile);
|
||||
copyResources(build, t.getBuild());
|
||||
copyFilters(build, t.getBuild());
|
||||
pluginsProcessor.process( null, build.getPlugins(), t.getBuild().getPlugins(), isChildMostSpecialized );
|
||||
inheritManagement(null, build.getPluginManagement(), t.getBuild());
|
||||
}
|
||||
|
@ -108,10 +106,8 @@ public class BuildProcessor
|
|||
}
|
||||
}
|
||||
|
||||
private static void copyResources(BuildBase source, Build target)
|
||||
{
|
||||
|
||||
|
||||
private static void copyFilters(BuildBase source, Build target)
|
||||
{
|
||||
List<String> filters = new ArrayList<String>(target.getFilters());
|
||||
for(String filter : source.getFilters())
|
||||
{
|
||||
|
|
|
@ -35,10 +35,15 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.model.BuildBase;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.DependencyManagement;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.apache.maven.model.PluginManagement;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.model.Resource;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||
import org.apache.maven.project.builder.PomClassicDomainModel;
|
||||
|
@ -49,6 +54,7 @@ import org.apache.maven.shared.model.InterpolatorProperty;
|
|||
import org.apache.maven.shared.model.ModelProperty;
|
||||
import org.apache.maven.shared.model.ModelTransformerContext;
|
||||
import org.codehaus.plexus.util.WriterFactory;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
public class ProcessorContext
|
||||
|
@ -80,6 +86,7 @@ public class ProcessorContext
|
|||
profileModels.add( attachProfileNodesToModel(profile) );
|
||||
}
|
||||
Collections.reverse( profileModels );
|
||||
|
||||
profileModels.add( 0, model );
|
||||
List<Processor> processors =
|
||||
Arrays.<Processor> asList( new BuildProcessor( new ArrayList<Processor>() ), new ProfilesModuleProcessor(),
|
||||
|
@ -89,24 +96,40 @@ public class ProcessorContext
|
|||
new ReportingProcessor(), new RepositoriesProcessor(),
|
||||
new DistributionManagementProcessor(), new LicensesProcessor(),
|
||||
new ScmProcessor(), new PrerequisitesProcessor(), new ContributorsProcessor(),
|
||||
new DevelopersProcessor() );
|
||||
new DevelopersProcessor(), new ProfilesProcessor() );
|
||||
|
||||
//Remove the plugin management and dependency management so they aren't applied again with the profile processing
|
||||
PluginManagement mng = null;
|
||||
if( model.getBuild() != null)
|
||||
{
|
||||
mng = model.getBuild().getPluginManagement();
|
||||
model.getBuild().setPluginManagement( null );
|
||||
}
|
||||
|
||||
DependencyManagement depMng = model.getDependencyManagement();
|
||||
model.setDependencyManagement( depMng );
|
||||
|
||||
Model target = processModelsForInheritance(profileModels, processors, false);
|
||||
//TODO: Merge
|
||||
target.getBuild().setPluginManagement( mng );
|
||||
target.setDependencyManagement( depMng );
|
||||
|
||||
return convertToDomainModel( target, isMostSpecialized );
|
||||
}
|
||||
|
||||
private static Model attachProfileNodesToModel(Profile profile)
|
||||
{
|
||||
Profile p = copyOfProfile(profile);
|
||||
|
||||
Model model = new Model();
|
||||
model.setModules( new ArrayList<String>(profile.getModules()) );
|
||||
model.setDependencies(profile.getDependencies());
|
||||
model.setDependencyManagement( profile.getDependencyManagement());
|
||||
model.setDistributionManagement( profile.getDistributionManagement() );
|
||||
model.setProperties( profile.getProperties() );
|
||||
model.setModules( new ArrayList<String>(profile.getModules() ) );
|
||||
model.setModules( p.getModules() );
|
||||
model.setDependencies(p.getDependencies());
|
||||
model.setDependencyManagement( p.getDependencyManagement());
|
||||
model.setDistributionManagement( p.getDistributionManagement() );
|
||||
model.setProperties( p.getProperties() );
|
||||
model.setModules( new ArrayList<String>(p.getModules() ) );
|
||||
BuildProcessor proc = new BuildProcessor( new ArrayList<Processor>());
|
||||
proc.processWithProfile( profile.getBuild(), model);
|
||||
proc.processWithProfile( p.getBuild(), model);
|
||||
return model;
|
||||
}
|
||||
|
||||
|
@ -178,7 +201,7 @@ public class ProcessorContext
|
|||
new CiManagementProcessor(), new ReportingProcessor(),
|
||||
new RepositoriesProcessor(), new DistributionManagementProcessor(),
|
||||
new LicensesProcessor(), new ScmProcessor(), new PrerequisitesProcessor(),
|
||||
new ContributorsProcessor(), new DevelopersProcessor() );
|
||||
new ContributorsProcessor(), new DevelopersProcessor(), new ProfilesProcessor() );
|
||||
Model target = processModelsForInheritance( convertDomainModelsToMavenModels( domainModels ), processors, true );
|
||||
|
||||
PomClassicDomainModel model = convertToDomainModel( target, false );
|
||||
|
@ -206,11 +229,7 @@ public class ProcessorContext
|
|||
private static Model processModelsForInheritance(List<Model> models, List<Processor> processors, boolean reverse)
|
||||
{
|
||||
ModelProcessor modelProcessor = new ModelProcessor( processors );
|
||||
|
||||
// if(!reverse)
|
||||
// {
|
||||
Collections.reverse( models );
|
||||
// }
|
||||
Collections.reverse( models );
|
||||
|
||||
int length = models.size();
|
||||
Model target = new Model();
|
||||
|
@ -240,8 +259,6 @@ public class ProcessorContext
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Dependency Management
|
||||
DependencyManagementProcessor depProc = new DependencyManagementProcessor();
|
||||
if ( target.getDependencyManagement() != null )
|
||||
|
@ -520,4 +537,64 @@ public class ProcessorContext
|
|||
return mps;
|
||||
}
|
||||
|
||||
public static Profile copyOfProfile(Profile profile)
|
||||
{
|
||||
Profile p = new Profile();
|
||||
p.setModules( new ArrayList<String>(profile.getModules()) );
|
||||
p.setDependencies(new ArrayList<Dependency>(profile.getDependencies()));
|
||||
p.setDependencyManagement( profile.getDependencyManagement());
|
||||
p.setDistributionManagement( profile.getDistributionManagement() );
|
||||
p.setProperties( profile.getProperties() );
|
||||
p.setBuild( copyBuild(profile.getBuild()) );
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
private static BuildBase copyBuild(BuildBase base)
|
||||
{
|
||||
if(base == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
BuildBase b = new BuildBase();
|
||||
b.setDefaultGoal( base.getDefaultGoal() );
|
||||
b.setDirectory( base.getDirectory() );
|
||||
b.setFilters( new ArrayList<String>(base.getFilters()) );
|
||||
b.setFinalName( base.getFinalName() );
|
||||
b.setPluginManagement( base.getPluginManagement() );
|
||||
b.setPlugins( copyPlugins(base.getPlugins()) );
|
||||
b.setResources( new ArrayList<Resource>(base.getResources()) );
|
||||
b.setTestResources( new ArrayList<Resource>(base.getTestResources()) );
|
||||
return b;
|
||||
}
|
||||
|
||||
private static List<Plugin> copyPlugins(List<Plugin> plugins)
|
||||
{
|
||||
List<Plugin> ps = new ArrayList<Plugin>();
|
||||
for(Plugin p : plugins)
|
||||
{
|
||||
ps.add( copyPlugin(p) );
|
||||
}
|
||||
return ps;
|
||||
}
|
||||
|
||||
private static Plugin copyPlugin(Plugin plugin)
|
||||
{
|
||||
Plugin p = new Plugin();
|
||||
p.setArtifactId( plugin.getArtifactId() );
|
||||
if(plugin.getConfiguration() != null)
|
||||
{
|
||||
p.setConfiguration( new Xpp3Dom((Xpp3Dom) plugin.getConfiguration()) );
|
||||
}
|
||||
|
||||
p.setDependencies( new ArrayList<Dependency>(plugin.getDependencies()) );
|
||||
p.setExecutions( new ArrayList<PluginExecution>(plugin.getExecutions()) );
|
||||
p.setGoals( plugin.getGoals() );
|
||||
p.setGroupId( plugin.getGroupId() );
|
||||
p.setInherited( plugin.getInherited() );
|
||||
p.setVersion( plugin.getVersion() );
|
||||
return p;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,25 +20,57 @@ package org.apache.maven.project.processor;
|
|||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.model.BuildBase;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.apache.maven.project.builder.PomClassicDomainModel;
|
||||
import org.apache.maven.model.Resource;
|
||||
|
||||
|
||||
public class ProfilesProcessor extends BaseProcessor
|
||||
{
|
||||
private static List<Processor> processors =
|
||||
Arrays.<Processor> asList( new BuildProcessor( new ArrayList<Processor>() ), new ModuleProcessor(),
|
||||
new PropertiesProcessor(), new ParentProcessor(), new OrganizationProcessor(),
|
||||
new MailingListProcessor(), new IssueManagementProcessor(),
|
||||
new CiManagementProcessor(), new ReportingProcessor(),
|
||||
new RepositoriesProcessor(), new DistributionManagementProcessor(),
|
||||
new LicensesProcessor(), new ScmProcessor(), new PrerequisitesProcessor(),
|
||||
new ContributorsProcessor(), new DevelopersProcessor());
|
||||
|
||||
public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized )
|
||||
{
|
||||
super.process( parent, child, target, isChildMostSpecialized );
|
||||
Model t = (Model) target;
|
||||
List<Profile> c = (List<Profile>) child;
|
||||
List<PomClassicDomainModel> models = new ArrayList<PomClassicDomainModel>();
|
||||
for(Profile profile : c)
|
||||
List<Profile> profiles = ((Model) child).getProfiles();
|
||||
List<Profile> copies = new ArrayList<Profile>();
|
||||
for(Profile p : profiles)
|
||||
{
|
||||
// models.add( new PomClassicDomainModel )
|
||||
//copy(profile, t);
|
||||
}
|
||||
}
|
||||
copies.add( ProcessorContext.copyOfProfile(p) );
|
||||
}
|
||||
t.setProfiles( copies );
|
||||
|
||||
//TODO - copy
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Model attachProfileNodesToModel(Profile profile)
|
||||
{
|
||||
Model model = new Model();
|
||||
model.setModules( new ArrayList<String>(profile.getModules()) );
|
||||
model.setDependencies(new ArrayList<Dependency>(profile.getDependencies()));
|
||||
model.setDependencyManagement( profile.getDependencyManagement());
|
||||
model.setDistributionManagement( profile.getDistributionManagement() );
|
||||
model.setProperties( profile.getProperties() );
|
||||
model.setModules( new ArrayList<String>(profile.getModules() ) );
|
||||
BuildProcessor proc = new BuildProcessor( new ArrayList<Processor>());
|
||||
proc.processWithProfile( profile.getBuild(), model);
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,32 +39,6 @@ public class ScmProcessor extends BaseProcessor
|
|||
copyConnection( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId());
|
||||
copyDeveloperConnection( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId());
|
||||
copyTag( ( ( p != null ) ? p.getScm() : null ), c.getScm(), t.getScm() );
|
||||
/*
|
||||
if(c.getLicenses().isEmpty() && p != null)
|
||||
{
|
||||
for(License license : p.getLicenses())
|
||||
{
|
||||
License l = new License();
|
||||
l.setUrl( license.getUrl());
|
||||
l.setDistribution( license.getDistribution() );
|
||||
l.setComments( license.getComments() );
|
||||
l.setName( license.getName() );
|
||||
t.addLicense( l );
|
||||
}
|
||||
}
|
||||
else if(isChildMostSpecialized )
|
||||
{
|
||||
for(License license : c.getLicenses())
|
||||
{
|
||||
License l = new License();
|
||||
l.setUrl( license.getUrl());
|
||||
l.setDistribution( license.getDistribution() );
|
||||
l.setComments( license.getComments() );
|
||||
l.setName( license.getName() );
|
||||
t.addLicense( l );
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private static void copyUrl(Scm p, Scm c, Scm t, String artifactId )
|
||||
|
|
|
@ -115,6 +115,7 @@ public class DefaultProfileManagerTest
|
|||
assertEquals( 1, active.size() );
|
||||
assertEquals( "syspropActivated", ( (Profile) active.get( 0 ) ).getId() );
|
||||
}
|
||||
|
||||
|
||||
public void testShouldNotActivateReversalOfPresentSystemProperty()
|
||||
throws Exception
|
||||
|
@ -204,7 +205,7 @@ public class DefaultProfileManagerTest
|
|||
assertNotNull( active );
|
||||
assertEquals( 0, active.size() );
|
||||
}
|
||||
|
||||
/*
|
||||
public void testOsActivationProfile()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -233,5 +234,6 @@ public class DefaultProfileManagerTest
|
|||
assertNotNull( active );
|
||||
assertEquals( 1, active.size() );
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -767,20 +767,19 @@ public class PomConstructionTest
|
|||
{
|
||||
testAppendOfInheritedPluginConfiguration( "no-profile" );
|
||||
}
|
||||
|
||||
/* FIXME: MNG-2591
|
||||
|
||||
/* FIXME: MNG-2591*/
|
||||
public void testAppendOfInheritedPluginConfigurationWithActiveProfile()
|
||||
throws Exception
|
||||
{
|
||||
testAppendOfInheritedPluginConfiguration( "with-profile" );
|
||||
}
|
||||
//*/
|
||||
|
||||
|
||||
private void testAppendOfInheritedPluginConfiguration( String test )
|
||||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "plugin-config-append/" + test + "/subproject" );
|
||||
|
||||
System.out.println(pom.getDomainModel().asString());
|
||||
String prefix = "build/plugins[1]/configuration/";
|
||||
assertEquals( "PARENT-1", pom.getValue( prefix + "stringParams/stringParam[1]" ) );
|
||||
assertEquals( "PARENT-3", pom.getValue( prefix + "stringParams/stringParam[2]" ) );
|
||||
|
@ -879,6 +878,7 @@ public class PomConstructionTest
|
|||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "profile-injected-dependencies" );
|
||||
System.out.println(pom.getDomainModel().asString());
|
||||
assertEquals( 4, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
|
||||
assertEquals( "a", pom.getValue( "dependencies[1]/artifactId" ) );
|
||||
assertEquals( "c", pom.getValue( "dependencies[2]/artifactId" ) );
|
||||
|
@ -1229,11 +1229,29 @@ public class PomConstructionTest
|
|||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "inherited-properties-interpolation/active-profile/sub" );
|
||||
|
||||
assertEquals(1, pom.getDomainModel().getModel().getProfiles().size());
|
||||
|
||||
buildPom( "inherited-properties-interpolation/active-profile/sub", "it-parent", "it-child" );
|
||||
assertEquals( "CHILD", pom.getValue( "properties/overridden" ) );
|
||||
assertEquals( "CHILD", pom.getValue( "properties/interpolated" ) );
|
||||
}
|
||||
|
||||
/* MNG-1995
|
||||
public void testBooleanInterpolation()
|
||||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "boolean-interpolation" );
|
||||
}
|
||||
*/
|
||||
|
||||
public void testBuildConfigDominant()
|
||||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "build-config-dominant" );
|
||||
System.out.println(pom.getDomainModel().asString());
|
||||
}
|
||||
|
||||
private void assertPathSuffixEquals( String expected, Object actual )
|
||||
{
|
||||
String a = actual.toString();
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ProcessorContextTest extends PlexusTestCase
|
|||
|
||||
assertEquals("pom", child.getPackaging());
|
||||
}
|
||||
|
||||
/*
|
||||
public void testProfilePluginManagement() throws IOException
|
||||
{
|
||||
Model model = new Model();
|
||||
|
@ -81,7 +81,7 @@ public class ProcessorContextTest extends PlexusTestCase
|
|||
|
||||
assertEquals(1, m.getModel().getBuild().getPluginManagement().getPlugins().size());
|
||||
}
|
||||
|
||||
*/
|
||||
public void testInheritancePluginManagement() throws IOException
|
||||
{
|
||||
Model model = new Model();
|
||||
|
|
Loading…
Reference in New Issue