You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/12/31 22:47:16 UTC

svn commit: r730487 - in /maven/plugins/trunk/maven-install-plugin/src: it/minstall-55/ main/java/org/apache/maven/plugin/install/

Author: bentmann
Date: Wed Dec 31 13:47:16 2008
New Revision: 730487

URL: http://svn.apache.org/viewvc?rev=730487&view=rev
Log:
[MINSTALL-55] install-file fails to grab version inhertied from parent

Added:
    maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/
    maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/invoker.properties   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/pom.xml   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/setup.bsh   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.jar   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.pom
    maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test.properties   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/verify.bsh   (with props)
Modified:
    maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java

Added: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/invoker.properties?rev=730487&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/invoker.properties (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/invoker.properties Wed Dec 31 13:47:16 2008
@@ -0,0 +1 @@
+invoker.goals = install:install-file

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/pom.xml?rev=730487&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/pom.xml (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/pom.xml Wed Dec 31 13:47:16 2008
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.install.55</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <description>
+    Tests the manual installation of a simple release JAR with a corresponding POM whose coordinates are inherited
+    from the parent.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <version>@project.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/setup.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/setup.bsh?rev=730487&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/setup.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/setup.bsh Wed Dec 31 13:47:16 2008
@@ -0,0 +1,10 @@
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File file = new File( localRepositoryPath, "org/apache/maven/its/install/55" );
+System.out.println( "Deleting " + file );
+FileUtils.deleteDirectory( file );
+
+return true;

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/setup.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/setup.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.jar?rev=730487&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.pom?rev=730487&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.pom (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test-0.1.pom Wed Dec 31 13:47:16 2008
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.its.install.55</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <!-- NOTE: Inherit everything from the parent -->
+  <artifactId>test</artifactId>
+
+</project>

Added: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test.properties?rev=730487&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test.properties (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test.properties Wed Dec 31 13:47:16 2008
@@ -0,0 +1,2 @@
+file = test-0.1.jar
+pomFile = test-0.1.pom

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/test.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/verify.bsh?rev=730487&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/verify.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/verify.bsh Wed Dec 31 13:47:16 2008
@@ -0,0 +1,20 @@
+import java.io.*;
+import java.util.*;
+
+String[] paths =
+{
+    "org/apache/maven/its/install/55/test/maven-metadata-local.xml",
+    "org/apache/maven/its/install/55/test/1.0/test-1.0.pom",
+};
+
+for ( String path : paths )
+{
+    File file = new File( localRepositoryPath, path );
+    System.out.println( "Checking for existence of " + file );
+    if ( !file.isFile() )
+    {
+        throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
+    }
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/minstall-55/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=730487&r1=730486&r2=730487&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java (original)
+++ maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java Wed Dec 31 13:47:16 2008
@@ -189,7 +189,7 @@
 
         File pom = null;
 
-        if ( pomFile != null && pomFile.exists() )
+        if ( pomFile != null && pomFile.isFile() )
         {
             processModel( readPom( pomFile ) );
 
@@ -343,9 +343,16 @@
         {
             this.artifactId = model.getArtifactId();
         }
-        if ( this.version == null && model.getVersion() != null )
+        if ( this.version == null )
         {
-            this.version = model.getVersion();
+            if ( parent != null && parent.getVersion() != null )
+            {
+                this.version = parent.getVersion();
+            }
+            if ( model.getVersion() != null )
+            {
+                this.version = model.getVersion();
+            }
         }
         if ( this.packaging == null && model.getPackaging() != null )
         {