mirror of https://github.com/apache/maven.git
[MNG-4034] - dependency version is not inherited from parent dependencyManagement
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@745110 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
759769900d
commit
fd1d9855df
|
@ -530,6 +530,8 @@ public class PomTransformer
|
|||
List clearedProperties = new ArrayList<ModelProperty>();
|
||||
|
||||
//Default Dependency Scope Rule
|
||||
if(domainModelIndex == 0)
|
||||
{
|
||||
ModelDataSource s = new DefaultModelDataSource( tmp, Arrays.asList( new ArtifactModelContainerFactory()) );
|
||||
for(ModelContainer mc : s.queryFor(ProjectUri.Dependencies.Dependency.xUri))
|
||||
{
|
||||
|
@ -547,6 +549,7 @@ public class PomTransformer
|
|||
tmp.add(tmp.indexOf(mc.getProperties().get(0)) + 1, new ModelProperty(ProjectUri.Dependencies.Dependency.scope, "compile"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Remove Default Executions IDS (mng-3965)
|
||||
List<ModelProperty> replace = new ArrayList<ModelProperty>();
|
||||
|
|
|
@ -1113,7 +1113,7 @@ public class ProjectUri
|
|||
|
||||
public static class Dependencies
|
||||
{
|
||||
public static String xUri = "http://apache.org/maven/project/profiles#collection/profile/dependencies";
|
||||
public static String xUri = "http://apache.org/maven/project/profiles#collection/profile/dependencies#collection";
|
||||
|
||||
public static class Dependency
|
||||
{
|
||||
|
|
|
@ -306,7 +306,11 @@ public final class PomClassicDomainModel
|
|||
s.add(ProjectUri.Reporting.Plugins.Plugin.ReportSets.xUri);
|
||||
s.add(ProjectUri.Reporting.Plugins.Plugin.ReportSets.ReportSet.configuration);
|
||||
s.add(ProjectUri.Build.Plugins.Plugin.Executions.Execution.configuration);
|
||||
s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.configuration);//TODO: More profile info
|
||||
//TODO: More profile info
|
||||
s.add(ProjectUri.Profiles.Profile.Dependencies.xUri);
|
||||
s.add(ProjectUri.Profiles.Profile.Dependencies.Dependency.Exclusions.xUri);
|
||||
s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.configuration);
|
||||
|
||||
modelProperties = ModelMarshaller.marshallXmlToModelProperties(
|
||||
getInputStream(), ProjectUri.baseUri, s );
|
||||
}
|
||||
|
|
|
@ -217,6 +217,7 @@ public class DefaultProjectBuilder
|
|||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||
domainModels.add( domainModel );
|
||||
|
||||
//Process Profile on most specialized child model
|
||||
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(domainModel.getModelProperties(),
|
||||
PomTransformer.MODEL_CONTAINER_FACTORIES), activeProfileIds, properties);
|
||||
|
||||
|
@ -225,7 +226,7 @@ public class DefaultProjectBuilder
|
|||
for(ModelContainer mc : profileContainers)
|
||||
{
|
||||
List<ModelProperty> transformed = new ArrayList<ModelProperty>();
|
||||
transformed.add(new ModelProperty(ProjectUri.xUri, null));
|
||||
//transformed.add(new ModelProperty(ProjectUri.xUri, null));
|
||||
for(ModelProperty mp : mc.getProperties())
|
||||
{
|
||||
if(mp.getUri().startsWith(ProjectUri.Profiles.Profile.xUri) && !mp.getUri().equals(ProjectUri.Profiles.Profile.id)
|
||||
|
@ -380,6 +381,7 @@ public class DefaultProjectBuilder
|
|||
|
||||
domainModels.add( parentDomainModel );
|
||||
|
||||
//Process Profiles
|
||||
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(parentDomainModel.getModelProperties(),
|
||||
PomTransformer.MODEL_CONTAINER_FACTORIES), activeProfileIds, properties);
|
||||
Collection<ModelContainer> profileContainers = profileContext.getActiveProfiles();
|
||||
|
@ -445,6 +447,8 @@ public class DefaultProjectBuilder
|
|||
|
||||
PomClassicDomainModel parentDomainModel = new PomClassicDomainModel( parentFile );
|
||||
parentDomainModel.setProjectDirectory( parentFile.getParentFile() );
|
||||
|
||||
//Process Profiles
|
||||
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(parentDomainModel.getModelProperties(),
|
||||
PomTransformer.MODEL_CONTAINER_FACTORIES), activeProfileIds, properties);
|
||||
Collection<ModelContainer> profileContainers = profileContext.getActiveProfiles();
|
||||
|
|
|
@ -831,11 +831,11 @@ public class PomConstructionTest
|
|||
}
|
||||
//*/
|
||||
|
||||
/** MNG-4034
|
||||
/** MNG-4034 */
|
||||
public void testManagedProfileDependency()
|
||||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "managed-profile-dependency/sub" );
|
||||
PomTestWrapper pom = this.buildPomFromMavenProject( "managed-profile-dependency/sub", "maven-core-it" );
|
||||
assertEquals( 1, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
|
||||
assertEquals( "org.apache.maven.its", pom.getValue( "dependencies[1]/groupId" ) );
|
||||
assertEquals( "maven-core-it-support", pom.getValue( "dependencies[1]/artifactId" ) );
|
||||
|
|
Loading…
Reference in New Issue