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,22 +530,25 @@ public class PomTransformer
|
|||
List clearedProperties = new ArrayList<ModelProperty>();
|
||||
|
||||
//Default Dependency Scope Rule
|
||||
ModelDataSource s = new DefaultModelDataSource( tmp, Arrays.asList( new ArtifactModelContainerFactory()) );
|
||||
for(ModelContainer mc : s.queryFor(ProjectUri.Dependencies.Dependency.xUri))
|
||||
if(domainModelIndex == 0)
|
||||
{
|
||||
boolean containsScope = false;
|
||||
for(ModelProperty mp :mc.getProperties())
|
||||
{
|
||||
if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.scope)) {
|
||||
containsScope = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ModelDataSource s = new DefaultModelDataSource( tmp, Arrays.asList( new ArtifactModelContainerFactory()) );
|
||||
for(ModelContainer mc : s.queryFor(ProjectUri.Dependencies.Dependency.xUri))
|
||||
{
|
||||
boolean containsScope = false;
|
||||
for(ModelProperty mp :mc.getProperties())
|
||||
{
|
||||
if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.scope)) {
|
||||
containsScope = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!containsScope)
|
||||
{
|
||||
tmp.add(tmp.indexOf(mc.getProperties().get(0)) + 1, new ModelProperty(ProjectUri.Dependencies.Dependency.scope, "compile"));
|
||||
}
|
||||
if(!containsScope)
|
||||
{
|
||||
tmp.add(tmp.indexOf(mc.getProperties().get(0)) + 1, new ModelProperty(ProjectUri.Dependencies.Dependency.scope, "compile"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Remove Default Executions IDS (mng-3965)
|
||||
|
|
|
@ -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,7 +381,8 @@ public class DefaultProjectBuilder
|
|||
|
||||
domainModels.add( parentDomainModel );
|
||||
|
||||
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(parentDomainModel.getModelProperties(),
|
||||
//Process Profiles
|
||||
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(parentDomainModel.getModelProperties(),
|
||||
PomTransformer.MODEL_CONTAINER_FACTORIES), activeProfileIds, properties);
|
||||
Collection<ModelContainer> profileContainers = profileContext.getActiveProfiles();
|
||||
|
||||
|
@ -445,7 +447,9 @@ public class DefaultProjectBuilder
|
|||
|
||||
PomClassicDomainModel parentDomainModel = new PomClassicDomainModel( parentFile );
|
||||
parentDomainModel.setProjectDirectory( parentFile.getParentFile() );
|
||||
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(parentDomainModel.getModelProperties(),
|
||||
|
||||
//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