[pkg-java] r7712 - in trunk/maven-debian-helper: debian maven-debian-plugin/src/main/java/org/debian/maven/plugin

twerner at alioth.debian.org twerner at alioth.debian.org
Fri Dec 19 17:05:52 UTC 2008


Author: twerner
Date: 2008-12-19 17:05:52 +0000 (Fri, 19 Dec 2008)
New Revision: 7712

Added:
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysUninstallMojo.java
Modified:
   trunk/maven-debian-helper/debian/changelog
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/AbstractInstallMojo.java
Log:
Add sysinstall and sysuninstall goals.

Modified: trunk/maven-debian-helper/debian/changelog
===================================================================
--- trunk/maven-debian-helper/debian/changelog	2008-12-19 16:44:20 UTC (rev 7711)
+++ trunk/maven-debian-helper/debian/changelog	2008-12-19 17:05:52 UTC (rev 7712)
@@ -2,9 +2,9 @@
 
   UNRELEASED
   * Refactoring.
-  * Add sysinstall goal.
+  * Add sysinstall and sysuninstall goals.
 
- -- Torsten Werner <twerner at debian.org>  Fri, 19 Dec 2008 17:43:18 +0100
+ -- Torsten Werner <twerner at debian.org>  Fri, 19 Dec 2008 18:04:30 +0100
 
 maven-debian-helper (0.1) unstable; urgency=low
 

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/AbstractInstallMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/AbstractInstallMojo.java	2008-12-19 16:44:20 UTC (rev 7711)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/AbstractInstallMojo.java	2008-12-19 17:05:52 UTC (rev 7712)
@@ -98,7 +98,7 @@
   /* absolute path to destination dir
    */
 
-  private String fullRepoPath()
+  protected String fullRepoPath()
   {
     return packagePath() + "/usr/share/maven-repo" + repoPath();
   }
@@ -151,12 +151,17 @@
     return "../maven-repo" + repoPath() + jarName();
   }
 
+  protected String fullCompatPath()
+  {
+    return compatSharePath() + compatName();
+  }
+
   /* command for creating the relative symlink
    */
 
   private String[] linkCommand()
   {
-    String[] command = {"ln", "-s", compatRelPath(), compatSharePath() + compatName()};
+    String[] command = {"ln", "-s", compatRelPath(), fullCompatPath()};
     return command;
   }
 

Added: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysUninstallMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysUninstallMojo.java	                        (rev 0)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysUninstallMojo.java	2008-12-19 17:05:52 UTC (rev 7712)
@@ -0,0 +1,40 @@
+package org.debian.maven.plugin;
+
+import java.io.IOException;
+import org.apache.maven.bootstrap.util.FileUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Remove installed files and symlinks from the /usr/share hierarchy
+ *
+ * @goal sysuninstall
+ */
+public class SysUninstallMojo extends SysInstallMojo
+{
+  // ----------------------------------------------------------------------
+  // Mojo parameters
+  // ----------------------------------------------------------------------
+
+  // ----------------------------------------------------------------------
+  // Public methods
+  // ----------------------------------------------------------------------
+
+  public void execute() throws MojoExecutionException
+  {
+    try
+    {
+      FileUtils.forceDelete(fullRepoPath());
+      FileUtils.fileDelete(fullCompatPath());
+    }
+    catch(IOException e)
+    {
+      getLog().error("uninstallation failed", e);
+      throw new MojoExecutionException("IOException catched");
+    }
+  }
+
+  // ----------------------------------------------------------------------
+  // Private methods
+  // ----------------------------------------------------------------------
+
+}




More information about the pkg-java-commits mailing list