You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/11/14 05:42:29 UTC

svn commit: r713916 - in /geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src: main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java site/apt/usage/modules.apt

Author: gawor
Date: Thu Nov 13 20:42:29 2008
New Revision: 713916

URL: http://svn.apache.org/viewvc?rev=713916&view=rev
Log:
install-library goal for geronimo-maven-plugin. Patch from Michal Borowiecki (GERONIMO-4408)

Added:
    geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java   (with props)
Modified:
    geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/site/apt/usage/modules.apt

Added: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java?rev=713916&view=auto
==============================================================================
--- geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java (added)
+++ geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java Thu Nov 13 20:42:29 2008
@@ -0,0 +1,80 @@
+/**
+ *  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.
+ */
+
+package org.apache.geronimo.mavenplugins.geronimo.module;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+
+import org.apache.geronimo.deployment.plugin.GeronimoDeploymentManager;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Deploy library to a Geronimo server.
+ *
+ * @version $Rev$ $Date$
+ * @goal install-library
+ */
+public class InstallLibraryMojo extends ModuleMojoSupport {
+
+    /**
+     * A file which points to a specific library archive.
+     * 
+     * @parameter expression="${libraryFile}"
+     * @required
+     */
+    protected File libraryFile = null;
+
+    /**
+     * Parameter to specify a non-default group id for the library. Otherwise,
+     * the library file will be installed with the group id named default.
+     * 
+     * @parameter expression="${groupId}"
+     * @optional
+     */
+    protected String groupId = null;
+
+    @Override
+    public void execute() throws MojoExecutionException {
+        getLog().info("libraryFile: " + libraryFile.getAbsolutePath());
+        GeronimoDeploymentManager mgr = getGeronimoDeploymentManager();
+        try {
+            mgr.installLibrary(libraryFile, groupId);
+        } catch (IOException e) {
+            throw new MojoExecutionException("Could not install library", e);
+        }
+    }
+
+    protected GeronimoDeploymentManager getGeronimoDeploymentManager() throws MojoExecutionException {
+        try {
+            return (GeronimoDeploymentManager) getDeploymentManager();
+        } catch (IOException e) {
+            throw new MojoExecutionException("Could not communicate with server", e);
+        } catch (DeploymentManagerCreationException e) {
+            throw new MojoExecutionException("Could not create deployment manager", e);
+        }
+    }
+    
+    @Override
+    protected String getFullClassName() {
+        return this.getClass().getName();
+    }
+}

Propchange: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/InstallLibraryMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/site/apt/usage/modules.apt
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/site/apt/usage/modules.apt?rev=713916&r1=713915&r2=713916&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/site/apt/usage/modules.apt (original)
+++ geronimo/server/trunk/buildsupport/geronimo-maven-plugin/src/site/apt/usage/modules.apt Thu Nov 13 20:42:29 2008
@@ -177,3 +177,26 @@
  
  Setting this parameter will also generate an xml file in the surefire format for reporting. The file will be generated at
  <<<$\{project.build.directory\}/surefire-reports/<goalName>.xml>>>.
+
+* <install-library> configuration
+
+ Arbitrary libraries can be installed into a running Geronimo server using the <install-library> goal.
+
+ This example shows a library being installed using the <<<libraryFile>>> parameter.
+
++----------+
+<plugin>
+    <groupId>org.apache.geronimo.plugins</groupId>
+    <artifactId>geronimo-maven-plugin</artifactId>
+    <execution>
+        <id>install-library</id>
+        <goals>
+            <goal>install-library</goal>
+        </goals>
+        <configuration>
+            <libraryFile>path/to/library.jar</libraryFile>
+            <groupId>optional-groupId</groupId>
+        </configuration>
+    </execution>
+</plugin>
++----------+