mirror of https://github.com/apache/maven.git
Fix: MNG-3978
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@733133 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9c7e082906
commit
e3bde472f9
|
@ -406,7 +406,27 @@ public class PomTransformer
|
|||
List<ModelProperty> tmp = domainModel.getModelProperties();
|
||||
|
||||
List clearedProperties = new ArrayList<ModelProperty>();
|
||||
|
||||
//Default Dependency Scope Rule
|
||||
ModelDataSource s = new DefaultModelDataSource();
|
||||
s.init( 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"));
|
||||
}
|
||||
}
|
||||
|
||||
//Missing Version Rule
|
||||
if ( getPropertyFor( ProjectUri.version, tmp ) == null )
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ProjectInheritanceTest
|
|||
assertNotNull( c );
|
||||
|
||||
// inherited from depMgmt
|
||||
assertTrue("Incorrect scope for " + a.getDependencyConflictId(), a.getScope().equals("test"));
|
||||
assertTrue("Incorrect scope for " + a.getDependencyConflictId(), a.getScope().equals("compile"));
|
||||
|
||||
// transitive dep, overridden b depMgmt
|
||||
assertTrue("Incorrect scope for " + b.getDependencyConflictId(), b.getScope().equals("runtime"));
|
||||
|
|
Loading…
Reference in New Issue