o Fixed dependency processing

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@756964 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-03-21 16:23:09 +00:00
parent 16fa8c1dbd
commit 75d79fc063
3 changed files with 34 additions and 0 deletions

View File

@ -96,6 +96,8 @@ public class DependencyManagementProcessor extends BaseProcessor
}
}
}
targetDependency.setOptional( dependency.isOptional() );
}
private static boolean containsExclusion( Exclusion exclusion, List<Exclusion> exclusions )

View File

@ -164,6 +164,8 @@ public class DependencyProcessor
}
}
}
targetDependency.setOptional( source.isOptional() );
}
private static boolean containsExclusion( Exclusion exclusion, List<Exclusion> exclusions )

View File

@ -1046,6 +1046,36 @@ public class PomConstructionTest
assertEquals( "reloc-aid", pom.getValue( "distributionManagement/relocation/artifactId" ) );
assertEquals( "reloc-version", pom.getValue( "distributionManagement/relocation/version" ) );
assertEquals( "project-reloc-msg", pom.getValue( "distributionManagement/relocation/message" ) );
assertEquals( 1, ( (List<?>) pom.getValue( "modules" ) ).size() );
assertEquals( "sub", pom.getValue( "modules[1]" ) );
assertEquals( 1, ( (Map<?, ?>) pom.getValue( "properties" ) ).size() );
assertEquals( "project-property", pom.getValue( "properties[1]/itProperty" ) );
assertEquals( 1, ( (List<?>) pom.getValue( "dependencyManagement/dependencies" ) ).size() );
assertEquals( "org.apache.maven.its", pom.getValue( "dependencyManagement/dependencies[1]/groupId" ) );
assertEquals( "managed-dep", pom.getValue( "dependencyManagement/dependencies[1]/artifactId" ) );
assertEquals( "0.1", pom.getValue( "dependencyManagement/dependencies[1]/version" ) );
assertEquals( "war", pom.getValue( "dependencyManagement/dependencies[1]/type" ) );
assertEquals( "runtime", pom.getValue( "dependencyManagement/dependencies[1]/scope" ) );
assertEquals( Boolean.FALSE, pom.getValue( "dependencyManagement/dependencies[1]/optional" ) );
assertEquals( 1, ( (List<?>) pom.getValue( "dependencyManagement/dependencies[1]/exclusions" ) ).size() );
assertEquals( "org.apache.maven.its",
pom.getValue( "dependencyManagement/dependencies[1]/exclusions[1]/groupId" ) );
assertEquals( "excluded-managed-dep",
pom.getValue( "dependencyManagement/dependencies[1]/exclusions[1]/artifactId" ) );
assertEquals( 1, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
assertEquals( "org.apache.maven.its", pom.getValue( "dependencies[1]/groupId" ) );
assertEquals( "dep", pom.getValue( "dependencies[1]/artifactId" ) );
assertEquals( "0.2", pom.getValue( "dependencies[1]/version" ) );
assertEquals( "ejb", pom.getValue( "dependencies[1]/type" ) );
assertEquals( "test", pom.getValue( "dependencies[1]/scope" ) );
assertEquals( Boolean.TRUE, pom.getValue( "dependencies[1]/optional" ) );
assertEquals( 1, ( (List<?>) pom.getValue( "dependencies[1]/exclusions" ) ).size() );
assertEquals( "org.apache.maven.its", pom.getValue( "dependencies[1]/exclusions[1]/groupId" ) );
assertEquals( "excluded-dep", pom.getValue( "dependencies[1]/exclusions[1]/artifactId" ) );
}