maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pschnei...@apache.org
Subject svn commit: r552182 - in /maven/components/trunk: maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ maven-project/src/test/java/org/apache/maven/project/inheritance/t11/ maven-project/src/test/resources/inheritance-repo/t11/ maven-projec...
Date Sat, 30 Jun 2007 17:31:47 GMT
Author: pschneider
Date: Sat Jun 30 10:31:45 2007
New Revision: 552182

URL: http://svn.apache.org/viewvc?view=rev&rev=552182
Log:
[MNG-2919] Add fix for depMan scope overwriting to the trunk.

Added:
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/inheritance/t11/
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
  (with props)
    maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/
    maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/
    maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/p1/
    maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml
  (with props)
    maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/pom.xml
  (with props)
Modified:
    maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java

Modified: maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java?view=diff&rev=552182&r1=552181&r2=552182
==============================================================================
--- maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
(original)
+++ maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
Sat Jun 30 10:31:45 2007
@@ -127,19 +127,14 @@
         Artifact managedOriginatingArtifact = (Artifact) versionMap.get( originatingArtifact.getDependencyConflictId()
);
         if ( managedOriginatingArtifact != null )
         {
-            String managedVersion = managedOriginatingArtifact.getVersion();
-            String version = originatingArtifact.getVersion();
-            if ( !managedVersion.equals( version ) )
+            // TODO we probably want to warn the user that he is building an artifact with
+            // different values than in dependencyManagement
+            if ( managedVersions instanceof ManagedVersionMap )
             {
-                // TODO we probably want to warn the user that he is building and artifact
with a
-                // different version than in dependencyManagement 
-                if ( managedVersions instanceof ManagedVersionMap )
-                {
-                    /* avoid modifying the managedVersions parameter creating a new map */
-                    versionMap = new ManagedVersionMap( managedVersions );
-                }
-                versionMap.remove( originatingArtifact.getDependencyConflictId() );
+                /* avoid modifying the managedVersions parameter creating a new map */
+                versionMap = new ManagedVersionMap( managedVersions );
             }
+            versionMap.remove( originatingArtifact.getDependencyConflictId() );
         }
 
         return versionMap;

Added: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java?view=auto&rev=552182
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
(added)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
Sat Jun 30 10:31:45 2007
@@ -0,0 +1,78 @@
+package org.apache.maven.project.inheritance.t11;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Iterator;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.MailingList;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.apache.maven.artifact.Artifact;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.logging.LoggerManager;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Verifies scope of root project is preserved regardless of parent depenedency management.
+ *
+ * @author <a href="mailto:pschneider@gmail.com">Patrick Schneider</a>
+ * @version $Id$
+ * @see <a href="http://jira.codehaus.org/browse/MNG-2919">MNG-2919</a>
+ */
+public class ProjectInheritanceTest
+    extends AbstractProjectInheritanceTestCase
+{
+    // ----------------------------------------------------------------------
+    //
+    // p1 inherits from p0
+    // p0 inhertis from super model
+    //
+    // or we can show it graphically as:
+    //
+    // p1 ---> p0 --> super model
+    //
+    // ----------------------------------------------------------------------
+
+    public void testDependencyManagementDoesNotOverrideScopeOfCurrentArtifact()
+        throws Exception
+    {
+        File localRepo = getLocalRepositoryPath();
+
+        File pom0 = new File( localRepo, "p0/pom.xml" );
+        File pom0Basedir = pom0.getParentFile();
+        File pom1 = new File( pom0Basedir, "p1/pom.xml" );
+
+        // load the child project, which inherits from p0...
+        MavenProject project0 = getProjectWithDependencies( pom0 );
+        MavenProject project1 = getProjectWithDependencies( pom1 );
+
+        assertEquals( pom0Basedir, project1.getParent().getBasedir() );
+        assertNull( "dependencyManagement has overwritten the scope of the currently building
child project",
+                    project1.getArtifact().getScope() );
+    }
+}

Propchange: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml?view=auto&rev=552182
==============================================================================
--- maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml
(added)
+++ maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml
Sat Jun 30 10:31:45 2007
@@ -0,0 +1,16 @@
+<project>
+  <parent>
+    <artifactId>p0</artifactId>
+    <groupId>maven</groupId>
+    <version>1.0</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>maven</groupId>
+  <artifactId>p1</artifactId>
+  <packaging>jar</packaging>
+  <name>p1</name>
+  <version>1.0</version>
+  <scm>
+    <url>scm-url</url>
+  </scm>
+</project>

Propchange: maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/pom.xml?view=auto&rev=552182
==============================================================================
--- maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/pom.xml
(added)
+++ maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/pom.xml
Sat Jun 30 10:31:45 2007
@@ -0,0 +1,27 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>maven</groupId>
+  <artifactId>p0</artifactId>
+  <packaging>pom</packaging>
+  <name>p0</name>
+  <version>1.0</version>
+  <organization>
+    <name>Codehaus</name>
+  </organization>
+
+  <dependencyManagement>
+
+    <dependencies>
+
+      <dependency>
+        <groupId>maven</groupId>
+        <artifactId>p1</artifactId>
+        <version>1.0</version>
+        <scope>test</scope>
+      </dependency>
+
+    </dependencies>
+
+  </dependencyManagement>
+
+</project>

Propchange: maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-project/src/test/resources/inheritance-repo/t11/p0/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message