[pkg-java] r7711 - 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 16:44:21 UTC 2008
Author: twerner
Date: 2008-12-19 16:44:20 +0000 (Fri, 19 Dec 2008)
New Revision: 7711
Added:
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/SysInstallMojo.java
Modified:
trunk/maven-debian-helper/debian/changelog
trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java
Log:
Add sysinstall goal.
Modified: trunk/maven-debian-helper/debian/changelog
===================================================================
--- trunk/maven-debian-helper/debian/changelog 2008-12-19 14:53:43 UTC (rev 7710)
+++ trunk/maven-debian-helper/debian/changelog 2008-12-19 16:44:20 UTC (rev 7711)
@@ -2,8 +2,9 @@
UNRELEASED
* Refactoring.
+ * Add sysinstall goal.
- -- Torsten Werner <twerner at debian.org> Wed, 17 Dec 2008 23:19:00 +0100
+ -- Torsten Werner <twerner at debian.org> Fri, 19 Dec 2008 17:43:18 +0100
maven-debian-helper (0.1) unstable; urgency=low
Added: 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 (rev 0)
+++ 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)
@@ -0,0 +1,194 @@
+package org.debian.maven.plugin;
+
+import java.io.File;
+import java.io.IOException;
+import org.apache.maven.bootstrap.util.FileUtils;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Install pom and jar files into the right location
+ */
+abstract public class AbstractInstallMojo extends AbstractMojo
+{
+ // ----------------------------------------------------------------------
+ // Mojo parameters
+ // ----------------------------------------------------------------------
+
+ /**
+ * groupId
+ *
+ * @parameter expression="${project.groupId}"
+ * @required
+ * @readonly
+ */
+ private String groupId;
+
+ /**
+ * artifactId
+ *
+ * @parameter expression="${project.artifactId}"
+ * @required
+ * @readonly
+ */
+ private String artifactId;
+
+ /**
+ * version
+ *
+ * @parameter expression="${project.version}"
+ * @required
+ * @readonly
+ */
+ private String version;
+
+ /**
+ * directory where the current pom.xml can be found
+ *
+ * @parameter expression="${basedir}"
+ * @required
+ * @readonly
+ */
+ private File basedir;
+
+ /**
+ * directory of the jar file
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ * @readonly
+ */
+ private String jarDir;
+
+ // ----------------------------------------------------------------------
+ // Public methods
+ // ----------------------------------------------------------------------
+
+ public void execute() throws MojoExecutionException
+ {
+ try
+ {
+ copyPom();
+ copyAndSymlinkJar();
+ }
+ catch(IOException e)
+ {
+ getLog().error("installation failed", e);
+ throw new MojoExecutionException("IOException catched");
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ // Private methods
+ // ----------------------------------------------------------------------
+
+ /* optional destination prefix
+ */
+
+ abstract protected String packagePath();
+
+ /* returns e.g. /org/debian/maven/maven-debian-plugin/0.1/
+ */
+
+ private String repoPath()
+ {
+ return "/" + groupId.replace( '.', '/' ) + "/" + artifactId + "/" + version + "/";
+ }
+
+ /* absolute path to destination dir
+ */
+
+ private String fullRepoPath()
+ {
+ return packagePath() + "/usr/share/maven-repo" + repoPath();
+ }
+
+ private String pomName()
+ {
+ return artifactId + "-" + version + ".pom";
+ }
+
+ private String pomSrcPath()
+ {
+ return basedir.getAbsolutePath() + "/pom.xml";
+ }
+
+ private String pomDestPath()
+ {
+ return fullRepoPath() + pomName();
+ }
+
+ private String jarName()
+ {
+ return artifactId + "-" + version + ".jar";
+ }
+
+ private String fullJarName()
+ {
+ return jarDir + "/" + jarName();
+ }
+
+ private String jarDestPath()
+ {
+ return fullRepoPath() + jarName();
+ }
+
+ /* jar file name without version number
+ */
+
+ private String compatName()
+ {
+ return artifactId + ".jar";
+ }
+
+ private String compatSharePath()
+ {
+ return packagePath() + "/usr/share/java/";
+ }
+
+ private String compatRelPath()
+ {
+ return "../maven-repo" + repoPath() + jarName();
+ }
+
+ /* command for creating the relative symlink
+ */
+
+ private String[] linkCommand()
+ {
+ String[] command = {"ln", "-s", compatRelPath(), compatSharePath() + compatName()};
+ return command;
+ }
+
+ /* copy the pom.xml
+ */
+
+ private void copyPom() throws IOException
+ {
+ FileUtils.copyFile(new File(pomSrcPath()), new File(pomDestPath()));
+ }
+
+ private void mkdir(String path) throws IOException
+ {
+ new File(path).mkdirs();
+ }
+
+ private void run(String[] command) throws IOException
+ {
+ Runtime.getRuntime().exec(command, null);
+ }
+
+ /* if a jar exists: copy it and symlink it to the compat share dir
+ */
+
+ private void copyAndSymlinkJar() throws IOException
+ {
+ File jarFile = new File(fullJarName());
+ if (jarFile.exists())
+ {
+ FileUtils.copyFile(jarFile, new File(jarDestPath()));
+ mkdir(compatSharePath());
+ run(linkCommand());
+ }
+ }
+}
Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java 2008-12-19 14:53:43 UTC (rev 7710)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java 2008-12-19 16:44:20 UTC (rev 7711)
@@ -1,69 +1,17 @@
package org.debian.maven.plugin;
-import java.io.File;
-import java.io.IOException;
-import org.apache.maven.bootstrap.util.FileUtils;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-
/**
* Install pom and jar files into the debian/ directory
*
* @goal install
*/
-public class InstallMojo
- extends AbstractMojo
+public class InstallMojo extends AbstractInstallMojo
{
// ----------------------------------------------------------------------
// Mojo parameters
// ----------------------------------------------------------------------
/**
- * groupId
- *
- * @parameter expression="${project.groupId}"
- * @required
- * @readonly
- */
- private String groupId;
-
- /**
- * artifactId
- *
- * @parameter expression="${project.artifactId}"
- * @required
- * @readonly
- */
- private String artifactId;
-
- /**
- * version
- *
- * @parameter expression="${project.version}"
- * @required
- * @readonly
- */
- private String version;
-
- /**
- * directory where the current pom.xml can be found
- *
- * @parameter expression="${project.basedir}"
- * @required
- * @readonly
- */
- private File basedir;
-
- /**
- * directory of the jar file
- *
- * @parameter expression="${project.build.directory}"
- * @required
- * @readonly
- */
- private String jarDir;
-
- /**
* $(CURDIR)/debian - must be supplied because $(CURDIR) is not known
*
* @parameter expression="${debian.dir}"
@@ -83,20 +31,6 @@
// Public methods
// ----------------------------------------------------------------------
- public void execute() throws MojoExecutionException
- {
- try
- {
- copyPom();
- copyAndSymlinkJar();
- }
- catch(IOException e)
- {
- getLog().error("installation failed", e);
- throw new MojoExecutionException("IOException catched");
- }
- }
-
// ----------------------------------------------------------------------
// Private methods
// ----------------------------------------------------------------------
@@ -104,113 +38,8 @@
/* returns e.g. $CURDIR/debian/libfoobar-java
*/
- private String packagePath()
+ protected String packagePath()
{
return debianDir + "/" + debianPackage;
}
-
- /* returns e.g. /org/debian/maven/maven-debian-plugin/0.1/
- */
-
- private String repoPath()
- {
- return "/" + groupId.replace( '.', '/' ) + "/" + artifactId + "/" + version + "/";
- }
-
- /* absolute path to destination dir
- */
-
- private String fullRepoPath()
- {
- return packagePath() + "/usr/share/maven-repo" + repoPath();
- }
-
- private String pomName()
- {
- return artifactId + "-" + version + ".pom";
- }
-
- private String pomSrcPath()
- {
- return basedir.getAbsolutePath() + "/pom.xml";
- }
-
- private String pomDestPath()
- {
- return fullRepoPath() + pomName();
- }
-
- private String jarName()
- {
- return artifactId + "-" + version + ".jar";
- }
-
- private String fullJarName()
- {
- return jarDir + "/" + jarName();
- }
-
- private String jarDestPath()
- {
- return fullRepoPath() + jarName();
- }
-
- /* jar file name without version number
- */
-
- private String compatName()
- {
- return artifactId + ".jar";
- }
-
- private String compatSharePath()
- {
- return packagePath() + "/usr/share/java/";
- }
-
- private String compatRelPath()
- {
- return "../maven-repo" + repoPath() + jarName();
- }
-
- /* command for creating the relative symlink
- */
-
- private String[] linkCommand()
- {
- String[] command = {"ln", "-s", compatRelPath(), compatSharePath() + compatName()};
- return command;
- }
-
- /* copy the pom.xml
- */
-
- private void copyPom() throws IOException
- {
- FileUtils.copyFile(new File(pomSrcPath()), new File(pomDestPath()));
- }
-
- private void mkdir(String path) throws IOException
- {
- new File(path).mkdirs();
- }
-
- private void run(String[] command) throws IOException
- {
- Runtime.getRuntime().exec(command, null);
- }
-
- /* if a jar exists: copy it and symlink it to the compat share dir
- */
-
- private void copyAndSymlinkJar() throws IOException
- {
- File jarFile = new File(fullJarName());
- if (jarFile.exists())
- {
- FileUtils.copyFile(jarFile, new File(jarDestPath()));
- mkdir(compatSharePath());
- run(linkCommand());
- }
- }
}
Copied: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java (from rev 7709, trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java)
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java (rev 0)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java 2008-12-19 16:44:20 UTC (rev 7711)
@@ -0,0 +1,29 @@
+package org.debian.maven.plugin;
+
+/**
+ * Install pom and jar files into the /usr/share hierarchy
+ *
+ * @goal sysinstall
+ */
+public class SysInstallMojo extends AbstractInstallMojo
+{
+ // ----------------------------------------------------------------------
+ // Mojo parameters
+ // ----------------------------------------------------------------------
+
+ // ----------------------------------------------------------------------
+ // Public methods
+ // ----------------------------------------------------------------------
+
+ // ----------------------------------------------------------------------
+ // Private methods
+ // ----------------------------------------------------------------------
+
+ /* returns empty prefix
+ */
+
+ protected String packagePath()
+ {
+ return "";
+ }
+}
Property changes on: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the pkg-java-commits
mailing list