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 2009/01/05 23:02:24 UTC

svn commit: r731740 - in /maven/plugins/trunk/maven-install-plugin/src: it/jar-sources-javadoc/ main/java/org/apache/maven/plugin/install/

Author: bentmann
Date: Mon Jan  5 14:02:23 2009
New Revision: 731740

URL: http://svn.apache.org/viewvc?rev=731740&view=rev
Log:
[MINSTALL-49] install-file with javadoc and sources

Added:
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/invoker.properties   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/javadoc.jar   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/pom.xml   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/setup.bsh   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/sources.jar   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/test.jar   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/test.properties   (with props)
    maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/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/jar-sources-javadoc/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/invoker.properties?rev=731740&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/invoker.properties (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/invoker.properties Mon Jan  5 14:02:23 2009
@@ -0,0 +1 @@
+invoker.goals = install:install-file

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/javadoc.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/javadoc.jar?rev=731740&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/javadoc.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/pom.xml?rev=731740&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/pom.xml (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/pom.xml Mon Jan  5 14:02:23 2009
@@ -0,0 +1,44 @@
+<?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.jsj</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <description>
+    Tests combined installation of a JAR together with its API docs and sources (cf. MINSTALL-49).
+  </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/jar-sources-javadoc/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/setup.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/setup.bsh?rev=731740&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/setup.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/setup.bsh Mon Jan  5 14:02:23 2009
@@ -0,0 +1,10 @@
+import java.io.*;
+import java.util.*;
+
+import org.codehaus.plexus.util.*;
+
+File groupDir = new File( localRepositoryPath, "org/apache/maven/its/install/jsj" );
+System.out.println( "Deleting " + groupDir );
+FileUtils.deleteDirectory( groupDir );
+
+return true;

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/setup.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/sources.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/sources.jar?rev=731740&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/sources.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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

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

Added: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/test.properties?rev=731740&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/test.properties (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/test.properties Mon Jan  5 14:02:23 2009
@@ -0,0 +1,8 @@
+file = test.jar
+groupId = org.apache.maven.its.install.jsj
+artifactId = test
+version = 0.1
+packaging = jar
+javadoc = javadoc.jar
+sources = sources.jar
+createChecksum = true

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/test.properties
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh?rev=731740&view=auto
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh (added)
+++ maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh Mon Jan  5 14:02:23 2009
@@ -0,0 +1,40 @@
+import java.io.*;
+import java.util.*;
+
+import org.apache.maven.plugin.install.*;
+
+String[] paths =
+{
+    "org/apache/maven/its/install/jsj/test/maven-metadata-local.xml",
+    "org/apache/maven/its/install/jsj/test/maven-metadata-local.xml.md5",
+    "org/apache/maven/its/install/jsj/test/maven-metadata-local.xml.sha1",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1.jar",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1.jar.md5",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1.jar.sha1",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1.pom",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1.pom.md5",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1.pom.sha1",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1-sources.jar",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1-sources.jar.md5",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1-sources.jar.sha1",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1-javadoc.jar",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1-javadoc.jar.md5",
+    "org/apache/maven/its/install/jsj/test/0.1/test-0.1-javadoc.jar.sha1",
+};
+
+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() );
+    }
+    if ( file.getName().endsWith( ".md5" ) || file.getName().endsWith( ".sha1" ) )
+    {
+        System.out.println( "Verifying " + file );
+        Utils.verifyChecksum( file );
+    }
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-install-plugin/src/it/jar-sources-javadoc/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=731740&r1=731739&r2=731740&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 Mon Jan  5 14:02:23 2009
@@ -103,6 +103,22 @@
     private File file;
 
     /**
+     * The bundled API docs for the artifact.
+     * 
+     * @parameter expression="${javadoc}"
+     * @since 2.3
+     */
+    private File javadoc;
+
+    /**
+     * The bundled sources for the artifact.
+     * 
+     * @parameter expression="${sources}"
+     * @since 2.3
+     */
+    private File sources;
+
+    /**
      * Location of an existing POM file to be installed alongside the main artifact, given by the {@link #file}
      * parameter.
      * 
@@ -244,6 +260,34 @@
                 generatedPomFile.delete();
             }
         }
+
+        if ( sources != null )
+        {
+            artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, "jar", "sources" );
+            try
+            {
+                installer.install( sources, artifact, localRepository );
+                installChecksums( artifact );
+            }
+            catch ( ArtifactInstallationException e )
+            {
+                throw new MojoExecutionException( "Error installing sources " + sources + ": " + e.getMessage(), e );
+            }
+        }
+
+        if ( javadoc != null )
+        {
+            artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, "jar", "javadoc" );
+            try
+            {
+                installer.install( javadoc, artifact, localRepository );
+                installChecksums( artifact );
+            }
+            catch ( ArtifactInstallationException e )
+            {
+                throw new MojoExecutionException( "Error installing API docs " + javadoc + ": " + e.getMessage(), e );
+            }
+        }
     }
 
     /**