You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/05/06 08:40:03 UTC

svn commit: r400248 - in /maven/plugins/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/phase/ test/java/org/apache/maven/plugins/release/phase/ test/resources/projects/rewrite-for-development/pom-with-namespace/ test/resourc...

Author: brett
Date: Fri May  5 23:40:01 2006
New Revision: 400248

URL: http://svn.apache.org/viewcvs?rev=400248&view=rev
Log:
fix handling when POM already had a namespace

Added:
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml   (with props)
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml   (with props)
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml   (with props)
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml   (with props)
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml   (with props)
    maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml   (with props)
Modified:
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/AbstractRewritingReleasePhaseTestCase.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhaseTest.java

Modified: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java?rev=400248&r1=400247&r2=400248&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java (original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/AbstractRewritePomsPhase.java Fri May  5 23:40:01 2006
@@ -38,6 +38,7 @@
 import org.apache.maven.scm.repository.ScmRepositoryException;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
 import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.JDOMException;
@@ -376,11 +377,21 @@
 
                 try
                 {
-                    XPath xpath = XPath.newInstance( "./" + groupTagName + "/" + tagName + "[groupId='" + groupId +
-                        "' and artifactId='" + artifactId + "']" );
+                    XPath xpath = null;
+                    if ( !StringUtils.isEmpty( dependencyRoot.getNamespaceURI() ) )
+                    {
+                        xpath = XPath.newInstance( "./pom:" + groupTagName + "/pom:" + tagName + "[pom:groupId='" +
+                            groupId + "' and pom:artifactId='" + artifactId + "']" );
+                        xpath.addNamespace( "pom", dependencyRoot.getNamespaceURI() );
+                    }
+                    else
+                    {
+                        xpath = XPath.newInstance( "./" + groupTagName + "/" + tagName + "[groupId='" + groupId +
+                            "' and artifactId='" + artifactId + "']" );
+                    }
 
                     Element dependency = (Element) xpath.selectSingleNode( dependencyRoot );
-                    Element versionElement = dependency.getChild( "version" );
+                    Element versionElement = dependency.getChild( "version", dependencyRoot.getNamespace() );
 
                     // avoid if in management
                     if ( versionElement != null )

Modified: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/AbstractRewritingReleasePhaseTestCase.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/AbstractRewritingReleasePhaseTestCase.java?rev=400248&r1=400247&r2=400248&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/AbstractRewritingReleasePhaseTestCase.java (original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/AbstractRewritingReleasePhaseTestCase.java Fri May  5 23:40:01 2006
@@ -557,7 +557,7 @@
         return createConfigurationFromProjects( path, true );
     }
 
-    private ReleaseConfiguration createDefaultConfiguration( String path )
+    protected ReleaseConfiguration createDefaultConfiguration( String path )
         throws Exception
     {
         ReleaseConfiguration config = createMappedConfiguration( path );

Modified: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhaseTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhaseTest.java?rev=400248&r1=400247&r2=400248&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhaseTest.java (original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RewritePomsForDevelopmentPhaseTest.java Fri May  5 23:40:01 2006
@@ -248,4 +248,14 @@
 
         assertTrue( compareFiles( config.getReactorProjects() ) );
     }
+
+    public void testRewritePomDependenciesWithNamespace()
+        throws Exception
+    {
+        ReleaseConfiguration config = createDefaultConfiguration( "pom-with-namespace" );
+
+        phase.execute( config );
+
+        assertTrue( compareFiles( config.getReactorProjects() ) );
+    }
 }

Added: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml?rev=400248&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml (added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml Fri May  5 23:40:01 2006
@@ -0,0 +1,29 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>groupId</groupId>
+  <artifactId>artifactId</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>subproject1</module>
+    <module>subproject2</module>
+  </modules>
+</project>

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/expected-pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml?rev=400248&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml (added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml Fri May  5 23:40:01 2006
@@ -0,0 +1,29 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>groupId</groupId>
+  <artifactId>artifactId</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>subproject1</module>
+    <module>subproject2</module>
+  </modules>
+</project>

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml?rev=400248&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml (added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml Fri May  5 23:40:01 2006
@@ -0,0 +1,36 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>groupId</groupId>
+    <artifactId>artifactId</artifactId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>subproject1</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/expected-pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml?rev=400248&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml (added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml Fri May  5 23:40:01 2006
@@ -0,0 +1,36 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>groupId</groupId>
+    <artifactId>artifactId</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <artifactId>subproject1</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml?rev=400248&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml (added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml Fri May  5 23:40:01 2006
@@ -0,0 +1,35 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>groupId</groupId>
+    <artifactId>artifactId</artifactId>
+    <version>1.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>subproject2</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>groupId</groupId>
+      <artifactId>subproject1</artifactId>
+      <version>1.1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/expected-pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml?rev=400248&view=auto
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml (added)
+++ maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml Fri May  5 23:40:01 2006
@@ -0,0 +1,35 @@
+<!--
+  ~ Copyright 2005-2006 The Apache Software Foundation.
+  ~
+  ~ Licensed 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>groupId</groupId>
+    <artifactId>artifactId</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <artifactId>subproject2</artifactId>
+
+  <dependencies>
+    <dependency>
+      <groupId>groupId</groupId>
+      <artifactId>subproject1</artifactId>
+      <version>1.0</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/resources/projects/rewrite-for-development/pom-with-namespace/subproject2/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision