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

Damien Raude-Morvan drazzib at alioth.debian.org
Mon Apr 5 19:52:01 UTC 2010


Author: drazzib
Date: 2010-04-05 19:51:52 +0000 (Mon, 05 Apr 2010)
New Revision: 12008

Added:
   trunk/maven-debian-helper/debian/source/
   trunk/maven-debian-helper/debian/source/format
Modified:
   trunk/maven-debian-helper/debian/changelog
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java
Log:
* SysInstallMojo: Read generated pom.properties after POMCleaner
  calls to allow changing groupId and artifactId inside maven.rules
  (trying to mimic mh_installpom/mh_installjar behavior)
* Switch to 3.0 (native) source format

Modified: trunk/maven-debian-helper/debian/changelog
===================================================================
--- trunk/maven-debian-helper/debian/changelog	2010-04-05 19:49:02 UTC (rev 12007)
+++ trunk/maven-debian-helper/debian/changelog	2010-04-05 19:51:52 UTC (rev 12008)
@@ -1,3 +1,12 @@
+maven-debian-helper (0.11) unstable; urgency=low
+
+  * SysInstallMojo: Read generated pom.properties after POMCleaner
+    calls to allow changing groupId and artifactId inside maven.rules
+    (trying to mimic mh_installpom/mh_installjar behavior)
+  * Switch to 3.0 (native) source format
+
+ -- Damien Raude-Morvan <drazzib at debian.org>  Mon, 05 Apr 2010 21:48:23 +0200
+
 maven-debian-helper (0.10) unstable; urgency=low
 
   * Add --non-interactive option to mh_lspoms and use it

Added: trunk/maven-debian-helper/debian/source/format
===================================================================
--- trunk/maven-debian-helper/debian/source/format	                        (rev 0)
+++ trunk/maven-debian-helper/debian/source/format	2010-04-05 19:51:52 UTC (rev 12008)
@@ -0,0 +1 @@
+3.0 (native)

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java	2010-04-05 19:49:02 UTC (rev 12007)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java	2010-04-05 19:51:52 UTC (rev 12008)
@@ -41,8 +41,24 @@
    * @readonly
    */
   private String artifactId;
+  
+  /**
+   * destGroupId
+   * 
+   * @parameter expression="${project.groupId}"
+   * @required
+   */
+  private String destGroupId;
 
   /**
+   * destArtifactId
+   * 
+   * @parameter expression="${project.artifactId}"
+   * @required
+   */
+  private String destArtifactId;
+
+  /**
    * version
    *
    * @parameter expression="${project.version}"
@@ -165,13 +181,21 @@
   {
     return "/" + groupId.replace( '.', '/' ) + "/" + artifactId + "/" + version + "/";
   }
+  
+  /**
+   * returns e.g. /org/debian/maven/maven-debian-plugin/0.1/
+   */
+  private String destRepoPath()
+  {
+    return "/" + destGroupId.replace( '.', '/' ) + "/" + destArtifactId + "/" + version + "/";
+  }
 
   /**
    * returns e.g. /org/debian/maven/maven-debian-plugin/debian/
    */
   private String debianRepoPath()
   {
-    return "/" + groupId.replace( '.', '/' ) + "/" + artifactId + "/" + debianVersion + "/";
+    return "/" + destGroupId.replace( '.', '/' ) + "/" + destArtifactId + "/" + debianVersion + "/";
   }
 
   /**
@@ -179,7 +203,7 @@
    */
   protected String fullRepoPath()
   {
-    return packagePath() + "/usr/share/maven-repo" + repoPath();
+    return packagePath() + "/usr/share/maven-repo" + destRepoPath();
   }
 
   /**
@@ -194,10 +218,15 @@
   {
     return artifactId + "-" + version + ".pom";
   }
+  
+  protected String destPomName()
+  {
+    return destArtifactId + "-" + version + ".pom";
+  }
 
   protected String debianPomName()
   {
-    return artifactId + "-" + debianVersion + ".pom";
+    return destArtifactId + "-" + debianVersion + ".pom";
   }
 
   private String pomSrcPath()
@@ -227,7 +256,7 @@
 
   private String pomDestPath()
   {
-    return fullRepoPath() + pomName();
+    return fullRepoPath() + destPomName();
   }
 
   private String debianPomDestPath()
@@ -239,10 +268,15 @@
   {
     return artifactId + "-" + version + ".jar";
   }
+  
+  protected String destJarName()
+  {
+    return destArtifactId + "-" + version + ".jar";
+  }
 
   protected String debianJarName()
   {
-    return artifactId + "-" + debianVersion + ".jar";
+    return destArtifactId + "-" + debianVersion + ".jar";
   }
 
   private String fullJarName()
@@ -252,12 +286,12 @@
 
   private String jarDestPath()
   {
-    return fullRepoPath() + jarName();
+    return fullRepoPath() + destJarName();
   }
 
   private String jarDestRelPath()
   {
-    return "../" + version + "/" + jarName();
+    return "../" + version + "/" + destJarName();
   }
 
   private String debianJarDestPath()
@@ -270,7 +304,7 @@
    */
   private String compatName()
   {
-    return artifactId + ".jar";
+    return destArtifactId + ".jar";
   }
 
   private String compatSharePath()
@@ -280,7 +314,7 @@
 
   private String compatRelPath()
   {
-    return "../maven-repo" + repoPath() + jarName();
+    return "../maven-repo" + destRepoPath() + destJarName();
   }
 
   protected String fullCompatPath()
@@ -290,7 +324,7 @@
 
   protected String versionedFullCompatPath()
   {
-    return compatSharePath() + jarName();
+    return compatSharePath() + destJarName();
   }
 
   /**
@@ -390,17 +424,15 @@
 
     POMCleaner.main((String[]) params.toArray(new String[params.size()]));
 
-    // read debian version
-    if (debianVersion == null)
-    {
-      Properties pomProperties = new Properties();
-      try {
-        pomProperties.load(new FileReader(cleanedPomPropertiesSrcPath()));
-      } catch (IOException ex) {
-        ex.printStackTrace();
-      }
-      debianVersion = pomProperties.getProperty("debianVersion");
+    Properties pomProperties = new Properties();
+    try {
+      pomProperties.load(new FileReader(cleanedPomPropertiesSrcPath()));
+    } catch (IOException ex) {
+      ex.printStackTrace();
     }
+    destGroupId = pomProperties.getProperty("groupId");
+    destArtifactId = pomProperties.getProperty("artifactId");
+    debianVersion = pomProperties.getProperty("debianVersion");
 
     if (debianVersion != null && !debianVersion.equals(version))
     {




More information about the pkg-java-commits mailing list