1 package org.apache.maven.project.inheritance.t11;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.File;
23 import java.util.Collection;
24 import java.util.List;
25 import java.util.Map;
26 import java.util.Iterator;
27
28 import org.apache.maven.model.Build;
29 import org.apache.maven.model.MailingList;
30 import org.apache.maven.model.Plugin;
31 import org.apache.maven.model.PluginExecution;
32 import org.apache.maven.model.Dependency;
33 import org.apache.maven.project.MavenProject;
34 import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
35 import org.apache.maven.artifact.Artifact;
36 import org.codehaus.plexus.util.xml.Xpp3Dom;
37 import org.codehaus.plexus.logging.LoggerManager;
38 import org.codehaus.plexus.logging.Logger;
39
40 /**
41 * Verifies scope of root project is preserved regardless of parent depenedency management. See
42 * {@link http://jira.codehaus.org/browse/MNG-2919}
43 *
44 * @author <a href="mailto:pschneider@gmail.com">Patrick Schneider</a>
45 * @version $Id: ProjectInheritanceTest.java 640549 2008-03-24 20:05:11Z bentmann $
46 */
47 public class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase
48 {
49 // ----------------------------------------------------------------------
50 //
51 // p1 inherits from p0
52 // p0 inhertis from super model
53 //
54 // or we can show it graphically as:
55 //
56 // p1 ---> p0 --> super model
57 //
58 // ----------------------------------------------------------------------
59
60 public void testDependencyManagementOverridesTransitiveDependencyVersion() throws Exception
61 {
62 File localRepo = getLocalRepositoryPath();
63
64 File pom0 = new File( localRepo, "p0/pom.xml" );
65 File pom0Basedir = pom0.getParentFile();
66 File pom1 = new File( pom0Basedir, "p1/pom.xml" );
67
68 // load the child project, which inherits from p0...
69 // MavenProject project0 = getProjectWithDependencies( pom0 );
70 MavenProject project1 = getProjectWithDependencies( pom1 );
71
72 assertEquals( pom0Basedir, project1.getParent().getBasedir() );
73 assertNull( "dependencyManagement has overwritten the scope of a child project",
74 project1.getArtifact().getScope() );
75 }
76 }