Package: maven-debian-helper
Version: 1.5.1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu quantal ubuntu-patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * Make intelligent decisions about whether to install jar files
    to /usr/share/java (LP: #1052533):
    - SysInstallMojo: Automatically detect if artifact is being installed
      into a Java library package (excluding maven plugins) and set flags
      to ensure that jar files are installed to /usr/share/java IF config
      options relevant to /usr/share/java installation have not been
      explicitly specified.

Hopefully this makes m-d-h a little better in terms of trying todo the right
thing when no explicit options are provided.

Thanks for considering the patch.


- -- System Information:
Debian Release: wheezy/sid
  APT prefers quantal-updates
  APT policy: (500, 'quantal-updates'), (500, 'quantal-security'), (500, 
'quantal')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5.0-14-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJQWJqLAAoJEL/srsug59jDx00P/1lWLhHLUIJ+DSwYVLKZmmui
DX59XskH+cdrn1H41tyN0NS7pIy52gxpaQGdMYEe5vV3I94P2523Oqg4/O21q3kA
DcHAJeWh/JW7iF3aSe0/fdsBukhPUcQlvOejYQ4MHrGmiyxhVLg09h7hB75eaVYk
VdU8hpKDOvJC9U+yMZMwCLESaqqOXYDTM8mJVl25GrOJmOroDHpNXxBmnHHwZpfs
oVTYGViECtYevIPLz3k+r6edeDGZGzaIbby/9KO8m+EMZYsIkOqZhVppTvuBzK6V
8XTpGHOZazScPHCDLnfn2snncqwMXOUrkLyEN9WQHeio/4hs0w3sLpFYEj2nF+oG
wFt54vUgd+4ZgiocOY5bdR3T7tNvEix7zXAzfo9NQPZQY+RQFbAu8dvJtig+IJ4o
ynynLy22JcYAhk2O/nofqcuAGSwximdCAMAnWPzoNz0BZvNcqUsfYS35M6vhOQNO
1t+S4ze7qOSzAFBRSxaoepHHWUCLnvQIjJLrFGK7gRoC2vqoqxtXRym6w7oEFKka
2Zzlmj3IzhvjibDzu146PZChOEU5Or8mOSZWKvWmbMQs/9lRuBv0U3xTdNgSeART
jH5y6Yo8XQ9ue5v2aqIToP0IJfvLo3oiwLdkx6G7D70W8RrJZGEZSlDF0aCfjnup
jjI2d33JTg4TWM3/RWhK
=gD8u
-----END PGP SIGNATURE-----
=== modified file 'debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java'
--- debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java	2012-05-04 00:51:14 +0000
+++ debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java	2012-09-18 15:41:11 +0000
@@ -22,6 +22,8 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
 
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -177,6 +179,17 @@
 
     private String classifier;
 
+    /**
+     * Regex for detecting that package is a libXXX-java package
+     */
+    private static final String javaLibRegex = new String("lib.*-java");
+
+    /**
+     * Regex for detecting that package is a maven plugin package
+     */
+    private static final String pluginRegex =
+        new String("lib.*-maven-plugin-java|libmaven-.*-plugin-java");
+
     // ----------------------------------------------------------------------
     // Public methods
     // ----------------------------------------------------------------------
@@ -658,7 +671,19 @@
                 classifier = pomOption.getClassifier();
             }
 
-            installToUsj = pomOption.isJavaLib();
+            // If package is a java libary (lib.*-java)and is not a maven plugin
+            // (lib.*-plugin-java) potentially install to /usr/share/java
+            boolean packageIsJavaLib =
+                  Pattern.matches(javaLibRegex, destPackage) &&
+                ! Pattern.matches(pluginRegex, destPackage);
+
+            // Its also possible to configure USJ install using 
+            // DEB_MAVEN_INSTALL_TO_USJ which we should honour
+            // over auto-detection if its set to 'false'.
+            // This is stored in 'installToUsj' on class instance
+            // creation
+            installToUsj = pomOption.isJavaLib() ||
+                           (packageIsJavaLib && installToUsj);
         }
 
         List params = new ArrayList();

__
This is the maintainer address of Debian's Java team
<http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-maintainers>. 
Please use
debian-j...@lists.debian.org for discussions and questions.

Reply via email to