[pkg-java] r14512 - in trunk/maven-repo-helper: . debian doc doc/ref src/main/bin src/main/java/org/debian/maven/repo src/main/resources src/main/resources/META-INF

Ludovic Claude ludovicc-guest at alioth.debian.org
Sat Aug 27 23:00:20 UTC 2011


Author: ludovicc-guest
Date: 2011-08-27 23:00:20 +0000 (Sat, 27 Aug 2011)
New Revision: 14512

Added:
   trunk/maven-repo-helper/doc/
   trunk/maven-repo-helper/doc/ref/
   trunk/maven-repo-helper/doc/ref/mh_cleanpom.txt
   trunk/maven-repo-helper/doc/ref/mh_installjar.txt
   trunk/maven-repo-helper/doc/ref/mh_installpom.txt
   trunk/maven-repo-helper/doc/ref/mh_installpoms.txt
   trunk/maven-repo-helper/doc/ref/mh_linkjar.txt
   trunk/maven-repo-helper/doc/ref/mh_patchpom.txt
   trunk/maven-repo-helper/doc/ref/mh_patchpoms.txt
   trunk/maven-repo-helper/doc/ref/mh_unpatchpoms.txt
   trunk/maven-repo-helper/doc/reference-footer.html
   trunk/maven-repo-helper/doc/reference-header.html
   trunk/maven-repo-helper/doc/reference.txt
   trunk/maven-repo-helper/doc/reference2.txt
   trunk/maven-repo-helper/doc/reference3.txt
   trunk/maven-repo-helper/doc/repository-footer.html
   trunk/maven-repo-helper/doc/repository-header.html
   trunk/maven-repo-helper/doc/repository.txt
   trunk/maven-repo-helper/doc/tutorial-footer.html
   trunk/maven-repo-helper/doc/tutorial-header.html
   trunk/maven-repo-helper/doc/tutorial.txt
   trunk/maven-repo-helper/src/main/bin/mh_linkjars
   trunk/maven-repo-helper/src/main/resources/META-INF/
   trunk/maven-repo-helper/src/main/resources/META-INF/MANIFEST.MF
Modified:
   trunk/maven-repo-helper/debian/README.Debian
   trunk/maven-repo-helper/debian/build.xml
   trunk/maven-repo-helper/debian/changelog
   trunk/maven-repo-helper/debian/control
   trunk/maven-repo-helper/debian/rules
   trunk/maven-repo-helper/src/main/bin/mh_cleanpom
   trunk/maven-repo-helper/src/main/bin/mh_installjar
   trunk/maven-repo-helper/src/main/bin/mh_installpom
   trunk/maven-repo-helper/src/main/bin/mh_installpoms
   trunk/maven-repo-helper/src/main/bin/mh_linkjar
   trunk/maven-repo-helper/src/main/bin/mh_patchpom
   trunk/maven-repo-helper/src/main/bin/mh_patchpoms
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/ListOfPOMs.java
Log:
* Add tutorial, reference and repository specification in documentation
* Update options on mh_installpom and mh_installpoms, to use the new arguments
  added to mh_cleanpom
* Add Build-Depend on markdown to build the doc
   dh $@ --with javahelper --with jh_maven_repo_helper
* Add mh_linkjars to link the jars listed in the .poms file, this is used by
  the jh_maven_repo_helper plugin for dh 7.
* Match jar with bundle as they are equivalent
   dh $@ --with ant --with maven_repo_helper

Modified: trunk/maven-repo-helper/debian/README.Debian
===================================================================
--- trunk/maven-repo-helper/debian/README.Debian	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/debian/README.Debian	2011-08-27 23:00:20 UTC (rev 14512)
@@ -4,265 +4,5 @@
 at /usr/share/maven-repo with the necessary metadata - in Maven terms, POM files - and make them available to other
 projects.
 
-== The Debian Maven repository ==
+A tutorial is available at /usr/share/doc/maven-repo/tutorial.html
 
-/usr/share/maven-repo contains a Maven-compatible repository but entirely managed by Debian.
-
-One differentiating feature of this repository is that you will find for most artifacts only 2 versions: one current version, and a
-symbolic version, usually named 'debian'. The reason for this is simple: the Debian project tries to keep the number of versions
-for its libraries to its minimum, that's in order to ease the maintenance burden and make upgrades of shared libraries easier.
-So that's why there is usually one current version of the library. The symbolic (or debian) version of the library is there in
-order to minimize the amount of change when one library is updated.
-
-This leads to another feature of the repository: the POM files are stripped of some elements, like <build> tags with the details
-of the build process - this is similar to what is done in Maven Central, but if you look at the versions in the <dependency> section,
-you will notice that most of them point to a symbolic 'debian' version (or 2.x or similar). The reason for this is simple:
-if the dependency is updated, its symbolic version will stay the same but the jar itself will be updated. As we point already
-to this symbolic version, then we see no change and that means that upgrading one package will not force upgrades of the packages
-using it. 
-Note: In Maven 3.0, the support for version ranges should start to work well, so it will be possible to replace the version in the
-dependency by a version range to achieve a similar effect (easy upgrades) and be even more compatible with upstream Maven.
-
-There are other changes made to the POM files. For example, some properties are inserted in the POM:
-  - debian.originalVersion: to keep track of the original version of the artifact
-  - debian.package: the name of the Debian package containing the artifact. Used by mh_make
-  - debian.mavenRules: the substitution rules applied on the groupId, artifactId and version of this artifact. Used by mh_make
-
-A tool is provided, mh_checkrepo, which checks the consistency of the Maven repository and it's useful to run it from time to time
-when you are packaging software, the goal is to keep the number of errors and warnings low.
-
-== Installing artifacts in the Debian Maven repository ==
-
-mh_installjar and mh_installpoms are the main tools to use when you want to install an artifact and its metadata in the repository.
-They take care of putting the files at the correct locations, maintain the integrity of the repository and cleanup the POM files
-before their inclusion in the repository.
-mh_install does the job of mh_installpoms and mh_installjar in one go, but requires additional information in the .poms file
-to work (--artifact=<path> option for each jar to install)
-mh_installpom, mh_linkjar, mh_linkrepojar are also available for some special needs when installing an artifact in the repository.
-The maven.mk CDBS script provided by maven-debian-helper can also install artifacts with the correct transformations to the repository.
-
-To use those tools in your package, use the following templates, or try mh_make (provided by maven-debian-helper) which can build
-most of the packaging control files from the upstream sources with either Maven or Ant as the build system, provided that the POM
-files are present.
-
-* Template debian/rules for installing a single artifact into the Maven repository: 
-=======================
-
-#!/usr/bin/make -f
-
-include /usr/share/cdbs/1/rules/debhelper.mk
-
-PACKAGE := $(DEB_SOURCE_PACKAGE)
-VERSION := $(DEB_UPSTREAM_VERSION)
-
-binary-post-install/lib$(PACKAGE)-java::
-	# Install all POM files registered in debian/$package.pom into /usr/share/maven-repo,
-        mh_installpoms -plib$(PACKAGE)-java
-	# Install the jar file associated with the POM into /usr/share/maven-repo,
-	# The -l option tells it to also add a link to the jar into /usr/share/java, with and without the version (to comply with
-	# the Debian Java packaging guidelines)
-        mh_installjar -plib$(PACKAGE)-java -l pom.xml build/$(PACKAGE)-$(VERSION).jar 
-
-# Cleanup temporary files
-clean::
-        -mh_clean
-=======================
-
-You will need also at least a file called debian/<package>.poms (where <package> is the name of the binary package) and containing:
-=======================
-pom.xml
-=======================
-
-* Template debian/rules for installing a single artifact into the Maven repository using dh 7: 
-=======================
-
-#!/usr/bin/make -f
-
-%:
-	dh $@ --with maven_repo_helper
-=======================
-
-You will need also at least a file called debian/<package>.poms (where <package> is the name of the binary package) and containing:
-=======================
-pom.xml --java-lib --artifact=build/module-*.jar
-=======================
-
-* Template debian/rules for installing multiple artifacts into the Maven repository: 
-=======================
-
-#!/usr/bin/make -f
-
-include /usr/share/cdbs/1/rules/debhelper.mk
-
-PACKAGE := $(DEB_SOURCE_PACKAGE)
-VERSION := $(DEB_UPSTREAM_VERSION)
-
-binary-post-install/lib$(PACKAGE)-java::
-	# Install all POM files registered in debian/$package.pom into /usr/share/maven-repo,
-        mh_installpoms -plib$(PACKAGE)-java
-	# Install the jar file associated with the POM into /usr/share/maven-repo,
-	# The -l option tells it to also add a link to the jar into /usr/share/java, with and without the version (to comply with
-	# the Debian Java packaging guidelines)
-        mh_installjar -plib$(PACKAGE)-java -l module1/pom.xml module1/target/module1-$(VERSION).jar 
-        mh_installjar -plib$(PACKAGE)-java -l module2/pom.xml module2/target/module2-$(VERSION).jar 
-
-# Cleanup temporary files
-clean::
-        -mh_clean
-=======================
-
-You will need also at least a file called debian/<package>.poms (where <package> is the name of the binary package) and containing:
-=======================
-# Remove the <parent> tag from the multiproject POM
-pom.xml --no-parent
-module1/pom.xml
-module2/pom.xml
-=======================
-
-* Template debian/rules for installing multiple artifacts into the Maven repository using dh 7:
-
-#!/usr/bin/make -f
-
-%:
-	dh $@ --with maven_repo_helper
-=======================
-
-You will need also at least a file called debian/<package>.poms (where <package> is the name of the binary package) and containing:
-=======================
-# Remove the <parent> tag from the multiproject POM
-pom.xml --no-parent
-module1/pom.xml --java-lib --artifact=module1/target/module1-*.jar
-module2/pom.xml --java-lib --artifact=module2/target/module2-*.jar
-=======================
-
-* debian/<package>.poms (where <package> is the name of the binary package):
-
-This file lists the POM files in the source tree which need to be installed in the repository, and you provide options for each POMs:
---ignore: to ignore the module built with this POM, and to not install the POM and its artifacts in the repository
---no-parent: if the POM inherits from a parent POM, then this inheritance relationship will be removed in the cleaned POM.
-  Removing the parent inheritance can often simplify the packaging, as quite often the parent POM does not contain any
-  useful information - we need only the list of dependencies in our repository, the other details for the build are irrelevant.
-  But do take care of the configuration for plugins or properties defined in the parent POM, as they can be useful when the
-  package uses Maven for its build and will be a motivating factor to keep the parent POM.
---package=<package>: to install the POM and its artifacts in a different Debian package than the first package
-  defined in debian/control
---has-package-version: to indicate that the original version of the POM is the same as the upstream part
-  of the version for the package. This will indicate that version constraints are possible on the packages
-  that depend on the current package. For example, the POM for junit:junit:3.8.1 is packaged in the
-  junit package which has the Debian version 3.8.1-1. This POM will be registered in the Debian repository
-  with the version 3.x, but if a package depends on junit, then we can automatically
-  insert in its Depends: or Build-Depends: junit (>= 3.8.1). This can be done using the substitution var
-  ${maven:Depends} or using mh_make to generate the control file for the package, or both.
-  See maven-debian-helper package for more details.
---keep-elements=<elem1,elem2>: a list of XML elements to keep in the POM during a clean operation with mh_cleanpom or mh_installpom
-  Typical elements are amongst build,reports,reporting,prerequisites,profiles.
---artifact=<path>: path to the build artifact associated with this POM, it will be installed when using the command mh_install.
-  A good practice is to use paths with wildcards to work around changing versions, for example --artifact=target/junit-*.jar
---java-lib: install the jar into /usr/share/java to comply with Debian packaging guidelines
---usj-name=<name>: name to use when installing the library in /usr/share/java
---usj-version=<version>: version to use when installing the library in /usr/share/java
---no-usj-versionless: don't install the versionless link in /usr/share/java
---dest-jar=<path>: the destination for the real jar
---classifier=<classifier>: the classifier for the jar, empty by default.
---ignore-pom: don't install the POM with mh_install or mh_installpoms. To use with POM files that are created temporarily
-  for certain artifacts such as Javadoc jars.
-
-Other configuration files are used by mh_installjar and mh_installpoms. All those files are optional.
-
-* debian/maven.rules:
-
-This file contains the substitution rules to apply on any reference to an artifact present on the original POM during the cleanup phase, that is before adding the POM to the Debian Maven repository.
-
-Its syntax is:
-<rule for artifact groupId> <rule for artifact id> <rule for artifact type> <rule for artifact version> [optional rule for artifact classifier] [optional rule for artifact scope]
-
-where a rule can be:
-  * - to match any element and leave it unchanged
-  <a word> - to match that element only and leave it unchanged
-  s/regexp/replacement/ - to match an element with a regexp and replace it. The regexp is in the Java format which is similar to Perl
-       for most cases.
-
-And the following elements of the POM can be affected by those rules:
-- the groupId, artifactId and version for the current POM
-- the <parent> element
-- any <dependency>, <plugin> or <extension> element
-
-For example, this is the content of debian/maven.rules from the modello package:
-
-junit junit jar s/3\..*/3.x/
-
-It specifies that the dependency on junit will use the version '3.x' instead of the default 'debian' version if the native version starts with '3.'. If the group id of the dependency is 'junit, the artifact id of the dependency is 'junit', the type of the dependency is 'jar' and the version starts with '3.', then this rule is used. 's/3\..*/3.x/' performs the replacement for the version, the syntax should be obvious to any sed user.
-
-This example from the commons-configuration package shows a few more possibilities: here, the version for commons-collections is converted to '2.x' if it starts with '2.' or '3.x' if it starts with '3.'. The line with ant is more interesting: if the group id is 'ant', then it is converted to 'org.apache.ant' - great trick for dealing with artifacts which are coming from Maven 1. Any artifact id or type will be matched and left unchanged, while the version will be converted to 'debian'. There is also the line with javax.servlet: this line keeps the version number used by this dependency, so if 2.4 is used, then 2.4 is also used in the cleaned POM.
-
-junit junit jar s/3\..*/3.x/
-commons-collections commons-collections jar s/2\..*/2.x/
-commons-collections commons-collections jar s/3\..*/3.x/
-s/ant/org.apache.ant/ * * s/.*/debian/
-log4j log4j jar s/1\.2\..*/1.2.x/
-javax.servlet servlet-api jar *
-
-* debian/maven.publishedRules:
-
-This file complements debian/maven.rules. The rules defined here are of no immediate use to the package, but they can be useful when
-packaging other libraries related to the current package. The rules listed here will be added to the <debian.mavenRules> property added
-to the cleaned POM stored in the repository. mh_make will read those additional rules, and use them when you are building the Debian
-packaging for an upstream project.
-Typically, those rules are used to help migrate POM files built with the Maven 1 conventions to use the Maven 2 conventions.
-
-For example, in the ant package, debian/maven.publishedRules contains:
-
-s/ant/org.apache.ant/ * * s/.*/debian/
-
-Ant used to have the identifier ant:ant in the Maven 1 repository, instead of org.apache.ant:ant.
-A project B may still use as a dependency on Ant the following:
-
-  <dependency>
-    <groupId>ant</groupId>
-    <artifactId>ant</artifactId>
-    <version>1.2</version>
-  </dependency>
-
-When building the Debian packaging for project B, mh_make will read the published rule
-  s/ant/org.apache.ant/ * * s/.*/debian/
-from the repository (assuming that the ant package is installed). It will then be able to match B's dependency and transform it into:
-
-  <dependency>
-    <groupId>org.apache.ant</groupId>
-    <artifactId>ant</artifactId>
-    <version>debian</version>
-  </dependency>
-
-So now project B can use the version of Ant packaged for Debian.
-
-* debian/maven.ignoreRules:
-
-This file lists the rules which are used to ignore certain dependencies, plugins or extensions present in the upstream POM but that you
-want to ignore in a Debian context. The <parent> element is not affected, but can be removed anyway with the --no-parent option.
-
-The syntax of this file is similar to debian/maven.rules, but more relaxed as we are interested here only in elements that match:
-
-<rule for artifact groupId> [rule for artifact id] [rule for artifact type] [rule for artifact version] [rule for artifact classifier] [rule for artifact scope]
-
-Any element, except the first is optional and replaced automatically by * to match anything, but if it omitted then all following
-elements must also be omitted.
-
-For example, debian/maven.ignoreRules from the wagon package contains:
-
-junit junit
-org.apache.maven.wagon wagon-provider-test
-
-It will instruct the mh_* utilities to remove all references to junit and wagon-provider-test from the POM files in the wagon package.
-
-== Typical workflow when using this package ==
-
-   1. sudo apt-get install maven-repo-helper maven-debian-helper
-   2. Get the original sources and unpack them, copy the debian/ folder if you are working on an existing package.
-   3. [optional] mh_lspoms
-   4. [optional] edit debian/$package.poms to check that only the POM that are needed are present, and maybe to fix the --no-parent options
-   5. mh_make --ant
-   6. edit debian/rules (to fix the last remaining packaging details)
-   7. edit debian/control (to add maven-repo-helper to Build-Depends: ) 
-
-
-

Modified: trunk/maven-repo-helper/debian/build.xml
===================================================================
--- trunk/maven-repo-helper/debian/build.xml	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/debian/build.xml	2011-08-27 23:00:20 UTC (rev 14512)
@@ -86,7 +86,7 @@
 
     <target name="package" depends="test">
         <jar jarfile="${build.directory}/${artifactId}-${version}.jar"
-            basedir="${build.outputDirectory}"/>
+            basedir="${build.outputDirectory}" manifest="src/main/resources/META-INF/MANIFEST.MF"/>
     </target>
 
 

Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/debian/changelog	2011-08-27 23:00:20 UTC (rev 14512)
@@ -1,14 +1,25 @@
-maven-repo-helper (1.5.2) unstable; urgency=low
+maven-repo-helper (1.5.3) UNRELEASED; urgency=low
 
-  [ Ludovic Claude ]
-  * Match jar with bundle as they are equivalent
+  * Add tutorial, reference and repository specification in documentation
+  * Update options on mh_installpom and mh_installpoms, to use the new arguments
+    added to mh_cleanpom
+  * Add Build-Depend on markdown to build the doc
   * Add support for packages built with dh 7 and javahelper: use
     the following line in your rules file:
-     dh $@ --with javahelper --with jh_mavenrepohelper
+     dh $@ --with javahelper --with jh_maven_repo_helper
     This will build the package with javahelper, and the resulting
     jar will be installed in the Maven repository (you need of course the
     <package>.poms file and the POM files in your package).
+  * Add mh_linkjars to link the jars listed in the .poms file, this is used by
+    the jh_maven_repo_helper plugin for dh 7.
 
+ -- Ludovic Claude <ludovic.claude at laposte.net>  Wed, 03 Aug 2011 00:31:08 +0100
+
+maven-repo-helper (1.5.2) unstable; urgency=low
+
+  [ Ludovic Claude ]
+  * Match jar with bundle as they are equivalent
+
   [ Damien Raude-Morvan ]
   * Keep relativePath attribute on parent pom.
   * d/control: Fix typo in package description (Closes: #617438).
@@ -35,7 +46,7 @@
     does.
   * add support for dh 7 and ant builds: use the following line in your
     rules file:
-     dh $@ --with ant --with mavenrepohelper
+     dh $@ --with ant --with maven_repo_helper
 
  -- Ludovic Claude <ludovic.claude at laposte.net>  Thu, 11 Nov 2010 18:49:49 +0100
 

Modified: trunk/maven-repo-helper/debian/control
===================================================================
--- trunk/maven-repo-helper/debian/control	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/debian/control	2011-08-27 23:00:20 UTC (rev 14512)
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: Ludovic Claude <ludovic.claude at laposte.net>, Damien Raude-Morvan <drazzib at debian.org>
-Build-Depends: debhelper (>= 7), cdbs, default-jdk, ant, help2man, libstax-java
+Build-Depends: debhelper (>= 7), cdbs, default-jdk, ant, help2man, markdown, libstax-java
 Standards-Version: 3.9.2
 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/maven-repo-helper/
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/maven-repo-helper/

Modified: trunk/maven-repo-helper/debian/rules
===================================================================
--- trunk/maven-repo-helper/debian/rules	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/debian/rules	2011-08-27 23:00:20 UTC (rev 14512)
@@ -25,8 +25,9 @@
 mh_installpom_description = "Installs a POM file into /usr/share/maven-repo."
 mh_installpoms_description = "Installs all POMs for the package into /usr/share/maven-repo."
 mh_installsite_description = "Installs site.xml into /usr/share/maven-repo."
-mh_linkjar_description = "Installs a link to the jar into /usr/share/maven-repo."
-mh_linkrepojar_description = "Installs a link from the jar in /usr/share/maven-repo."
+mh_linkjar_description = "Creates a link in /usr/share/maven-repo for an existing jar."
+mh_linkjars_description = "Creates links in /usr/share/maven-repo for all jars."
+mh_linkrepojar_description = "Creates a link from a jar already installed in /usr/share/maven-repo."
 mh_lspoms_description = "Generates a list of POMs for the package."
 mh_patchpom_description = "Patches one POM file using the Maven dependency rules."
 mh_patchpoms_description = "Patches the POM files using the Maven dependency rules."
@@ -39,10 +40,22 @@
 	cp $< $@
 	perl -i -pe 's,\. /usr/share/maven-repo-helper/mh_lib.sh,\. debian/.mh/mh_lib.sh,' $@
 	chmod +x $@
+debian/.mh/doc:
+	mkdir -p debian/.mh/doc
+	markdown --html4tags doc/tutorial.txt | \
+		cat doc/tutorial-header.html - doc/tutorial-footer.html > debian/.mh/doc/tutorial.html
+	cp doc/reference.txt + doc/ref/mh_cleanpom.txt + doc/ref/mh_installpom.txt + doc/ref/mh_installpoms.txt + doc/ref/mh_patchpom.txt \
+		+ doc/ref/mh_patchpoms.txt + doc/ref/mh_unpatchpoms.txt + doc/reference2.txt + doc/ref/mh_installjar.txt \
+		+ doc/ref/mh_linkjar.txt + doc/reference3.txt > debian/.mh/doc/reference.txt
+	markdown --html4tags debian/.mh/doc/reference.txt | \
+		cat doc/reference-header.html - doc/reference-footer.html > debian/.mh/doc/reference.html
+	markdown --html4tags doc/repository.txt | \
+		cat doc/repository-header.html - doc/repository-footer.html > debian/.mh/doc/repository.html
+
 debian/.mh/doc/mh_%.1 : debian/.mh/mh_% 
-	mkdir -p debian/.mh/doc
 	help2man -N -n $(mh_$*_description) -o $@ $<
-man-pages: $(MAN_PAGES)
+man-pages: debian/.mh/doc $(MAN_PAGES)
+
 build/$(PACKAGE):: man-pages
 
 binary-post-install/$(PACKAGE)::
@@ -50,13 +63,15 @@
 	dh_install -p$(PACKAGE) build/$(PACKAGE)-debian.jar /usr/share/maven-repo/org/debian/maven/$(PACKAGE)/debian
 	dh_install -p$(PACKAGE) src/main/bin/mh_* /usr/bin
 	dh_install -p$(PACKAGE) src/main/share/mh_* /usr/share/$(PACKAGE)
-	dh_install -p$(PACKAGE) src/main/share/maven_repo_helper.pm /usr/share/perl5/Debian/Debhelper/Sequence
+	dh_install -p$(PACKAGE) src/main/share/*.pm /usr/share/perl5/Debian/Debhelper/Sequence
 	dh_link -p$(PACKAGE) /usr/share/maven-repo/org/debian/maven/$(PACKAGE)/debian/$(PACKAGE)-debian.jar /usr/share/java/$(PACKAGE).jar
 	dh_installman $(MAN_PAGES)
 	mkdir -p debian/.mh
-	java -cp $(CLASSPATH) $(JAVA_OPTIONS) org.debian.maven.repo.POMCleaner --no-parent --has-package-version --rules=debian/maven.rules pom.xml debian/.mh/$(PACKAGE)-debian.pom debian/.mh/pom.properties 
+	java -cp $(CLASSPATH) $(JAVA_OPTIONS) org.debian.maven.repo.POMCleaner --no-parent --has-package-version --rules=debian/maven.rules pom.xml \
+		debian/.mh/$(PACKAGE)-debian.pom debian/.mh/pom.properties 
 	dh_install -p$(PACKAGE) --sourcedir=debian/.mh $(PACKAGE)-debian.pom \
 		usr/share/maven-repo/org/debian/maven/$(PACKAGE)/debian
+	dh_install -p$(PACKAGE) --sourcedir=debian/.mh/doc tutorial.html reference.html repository.html usr/share/doc/maven-repo-helper
 
 clean::
 	-rm -rf debian/.mh

Added: trunk/maven-repo-helper/doc/ref/mh_cleanpom.txt
===================================================================
--- trunk/maven-repo-helper/doc/ref/mh_cleanpom.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/ref/mh_cleanpom.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,81 @@
+### mh\_cleanpom:
+
+Usage:
+
+    mh_cleanpom [option]... [pom] [target] [pom-props]
+
+Cleans the POM and prepare it for inclusion in the Maven repository.
+Also extracts some information from the POM.
+
+Where:
+
+    [pom] is the location of the POM file to clean.
+      Default to pom.xml or debian/pom.xml
+    [target] is where the cleaned POM is written to.
+      Default to debian/tmp/pom.xml
+    [pom-props] is where the POM properties file will be written.
+      Default to debian/tmp/pom.properties
+
+Options:
+
+    -h --help: show this text
+    -V --version: show the version
+    -p<package> --package=<package>: name of the Debian package which will contain this POM file
+    -h --has-package-version: flag that indicates that this POM has the same version as the package, this helps packagers of depending packages
+    -o --no-parent: don't inherit from a parent POM
+    -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins.
+      If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository
+    -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file.
+    -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM.
+      Optional, the default location is debian/maven.rules
+    -R<rule>, --extra-rule=<rule>: additional rule to apply when cleaning the POM. May occur multiple times, instead of or in addition to -r
+    -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM.
+      Optional, the default location is debian/maven.publishedRules
+    -U<rule>, --extra-published-rule=<rule>: extra rule to publish. May occur multiple times, instead of or in addition to -u
+    -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM.
+      Optional, the default location is debian/maven.ignoreRules
+    -I<rule>, --extra-ignore-rule=<rule>: additional rule used to remove dependencies from the transformed POM May occur multiple times, instead of or in addition to -i
+    -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously.
+      This is useful in  situations such as when the Maven clean target requires more  dependencies or plugins to ignore than the build target.
+      Optional, it is ignored by default
+    -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version
+    --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules
+    --keep-elements=<elem1,elem2>: keep the elements listed here even if they are normally removed by the clean operation. Such elements are build,reports,reporting,prerequisites,profiles.
+    -m<repo root>--maven-repo=<repo root>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository
+    -v --verbose: show more information while running
+    -n --no-act: don't actually do anything, just print the results
+
+Cleans a Maven POM and prepare it for inclusion in the Debian repository for Maven.
+
+The  POM  will  be normalised, and its parent tag removed if the option --no-parent is given. The version will be replaced by 'debian', unless a special  rule  applies  (see below the discussion about rules).  Build, profiles and other build time only sections of the POM will be stripped.
+
+If versions are given for a dependency, this version will be replaced by the 'debian' version, or a rule can be given to use a custom version.
+
+You  can  modify those defaults with the help of the rules file. This file should contain the lines with the format:
+    <groupId> [artifactId] [type]  [version]  [classifier] [scope]
+where  groupId,  artifactId,  type,  version, classifier and scope can be the explicit attribute to match, or can contain a wildcard (*) for generic matches.
+
+Each one of those elements can also be a replace rule, of the form s/<regex>/<replace>/ where regex is a regular expression, and replace is the replacement. Substitution groups $1 $2... can be used in the replacement if capture groups () have been used in the regex.
+
+The first element is mandatory (groupId), but you can ignore the elements on the right hand side. If the scope is missing, then any scope is matched and left unchanged. If the version missing, then any version will be replaced with 'debian'. If type is missing, then any type is matched and left unchanged. If artifactId is missing, then any artifactId is matched and left unchanged.
+
+You can also have comments in this file, it should be a line starting with #
+
+Example of a rules file:
+
+    s/commons-(.*)/org.apache.commons.commons$1/  org.itext * * s/1\..*/1.x/ org.itext * *
+    s/2\..*/2.x/ # use the alpha version of  plexus-container-default  org.codehaus.plexus
+    plexus-container-default jar s/1\.0-alpha.*/1.0-alpha/
+
+This  rules file does the following:
+ - all groupIds starting with commons- will have org.apache.commons. prefixed to them
+ - any artifact in the org.itext group with a version number starting with 1. will use the 1.x version
+ - any artifact in the org.itext group with a version number starting with 2. will use the 2.x version
+ - the jar with groupId=org.codehaus.plexus and artifactId=plexus-container-default and a version starting with 1.0-alpha- will use the 1.0-alpha version
+
+The default rule (* * * s/.*/debian/ *) replaces any version number with the 'debian' version and always applies last if there was no other matches. Another default rule (* * maven-plugin * *) keep the version for all plugins  as the plugin mechanism requires a version in Maven.
+
+Any rules given on the command line (using -R/--extra-rule, -U/--extra-published-rule or -I/--extra-ignore-rule) are applied in the order given, in between the rules given in the rules file (if any) and the default rules.
+
+This script is used by mh\_installpom, normally you don't need to use it directly, except if you need to investigate an issue with the cleaning process for a POM file.
+

Added: trunk/maven-repo-helper/doc/ref/mh_installjar.txt
===================================================================
--- trunk/maven-repo-helper/doc/ref/mh_installjar.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/ref/mh_installjar.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,49 @@
+### mh\_installjar:
+
+Usage:
+ 
+    mh_installjar [option]... [pom] [jar] [link]...
+
+Installs the jar file in /usr/share/maven-repo, at the correct location for
+Maven. Both the native version and the Debian version of the jar are installed.
+It can also create additional links to the jar, usually placed in /usr/share/java.
+
+Where:
+
+    [pom] is the location of the POM associated with the jar to install.
+      GroupId, artifactId and version will be extracted from this file.
+    [jar] is the path to the jar to install, usually located in the build
+      folder.
+    [link] is an additional link to the jar to install, usually there should
+      be a link to usr/share/java/.jar and
+      usr/share/java/-.jar to comply with the Java packaging
+      guidelines. Note that there is no need to specify those particular
+      links if the --java-lib option is used.
+
+Options:
+
+    -h --help: show this text
+    -V --version: show the version
+    -p<package> --package=<package>: name of the Debian package which will contain this jar file
+    -e<version>, --set-version=<version>: set the version for the jar, do not use the version declared in the POM file.
+    -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM.
+      Optional, the default location is debian/maven.rules
+      Maven rules are used here to extract the groupId, artifactId and version from the POM file.
+    -l --java-lib: Optional, if given it will install the jar into /usr/share/java to comply with the Debian Java specification.
+      The jar will be installed as /usr/share/java/\$name-\$version.jar and a versionless link /usr/share/java/\$name.jar will point to it, as well as the links installed in /usr/share/maven-repo
+    -n<name> --usj-name=<name>: Optional, the name to use when installing the library in /usr/share/java when --java-lib is used.
+      Defaults to the artifact id found in the POM.
+    -i<version> --usj-version=<version>: Optional, the version to use when installing the library in /usr/share/java when --java-lib is used.
+      Defaults to the version found in the POM.
+    -s --no-usj-versionless: Optional, don't install the versionless link in /usr/share/java.
+      This flag is used only when the -l or --java-lib option is given.
+    -d<path> --dest-jar=<path>: Optional, the destination for the real jar.
+      The other places where the jar appears, in the repository or in the list of links, will be symlinks to this jar.
+      Defaults  to  /usr/share/java/$name-$version.jar if --java-lib is used, otherwise the jar is installed in the versioned path in the Maven repository.
+    -c<classifier> --classifier=<classifier>: Optional, the classifier for the jar. Empty by default.
+    -v --verbose: show more information while running
+    -n --no-act: don't actually do anything, just print the results
+    --skip-clean-pom: don't clean the pom, assume that a previous action ran mh_cleanpom with the correct options.
+      mh_cleanpom is run only to extract the groupId, artifactId and version of the jar
+
+

Added: trunk/maven-repo-helper/doc/ref/mh_installpom.txt
===================================================================
--- trunk/maven-repo-helper/doc/ref/mh_installpom.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/ref/mh_installpom.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,48 @@
+### mh\_installpom:
+
+Usage:
+
+    mh_installpom [option]... [pom]
+
+Installs the POM file in /usr/share/maven-repo, at the correct location for Maven.
+Before installing the POM, it prepares it with mh\_cleanpom.
+
+Where:
+
+    [pom] is the location of the POM file to install.
+      GroupId, artifactId and version will be extracted from this file.
+
+Options:
+
+    -h --help: show this text
+    -V --version: show the version
+    -p<package> --package=<package>: name of the Debian package which will contain this POM file
+    -h --has-package-version: flag that indicates that this POM has the same version as the package, this helps packagers of depending packages
+    -o --no-parent: don't inherit from a parent POM
+    -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins.
+      If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository
+    -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file.
+    -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM.
+      Optional, the default location is debian/maven.rules
+    -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM.
+      Optional, the default location is debian/maven.publishedRules
+    -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM.
+      Optional, the default location is debian/maven.ignoreRules
+    -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously.
+      This is useful in  situations such as when the Maven clean target requires more  dependencies or plugins to ignore than the build target.
+      Optional, it is ignored by default
+    -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version
+    --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules
+    --keep-elements=<elem1,elem2>: keep the elements listed here even if they are normally removed by the clean operation. Such elements are build,reports,reporting,prerequisites,profiles.
+    -m<repo root>--maven-repo=<repo root>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository
+    -v --verbose: show more information while running
+    -n --no-act: don't actually do anything, just print the results
+    -ignore-pom: read the POM but don't install it
+
+This script installs the POM file in /usr/share/maven-repo, at the correct location for Maven. Before installing the POM, it prepares it with mh\_cleanpom.
+
+debian/maven.rules is used to alter the version properties for the library and its dependencies.
+
+Prefer to use mh\_installpoms as it reuses the information defined in debian/$package.poms and avoids repetition.
+
+

Added: trunk/maven-repo-helper/doc/ref/mh_installpoms.txt
===================================================================
--- trunk/maven-repo-helper/doc/ref/mh_installpoms.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/ref/mh_installpoms.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,58 @@
+### mh\_installpoms:
+
+Usage:
+ 
+    mh_installpoms [option]...
+
+Reads the file debian/$package.poms and installs each POM file
+listed in the .poms file.
+Options:
+
+    -h --help: show this text
+    -V --version: show the version
+    -p<package> --package=<package>: name of the Debian package which will contain this POM file
+    -h --has-package-version: flag that indicates that this POM has the same version as the package, this helps packagers of depending packages
+    -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins.
+      If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository
+    -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file.
+    -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM.
+      Optional, the default location is debian/maven.rules
+    -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM.
+      Optional, the default location is debian/maven.publishedRules
+    -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM.
+      Optional, the default location is debian/maven.ignoreRules
+    -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously.
+      This is useful in  situations such as when the Maven clean target requires more  dependencies or plugins to ignore than the build target.
+      Optional, it is ignored by default
+    -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version
+    --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules
+    --keep-elements=<elem1,elem2>: keep the elements listed here even if they are normally removed by the clean operation. Such elements are build,reports,reporting,prerequisites,profiles.
+    -m<repo root>--maven-repo=<repo root>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository
+    -v --verbose: show more information while running
+    -n --no-act: don't actually do anything, just print the results
+
+debian/maven.rules is used to alter the version properties for the library and its dependencies.
+
+The file debian/$package.poms should contain the relative paths to the POM files to install, each POM file in a separate line.
+After the path to the POM file, you can add options which will influence the cleaning of the POM file:
+
+    --ignore: ignore this POM and its artifact if any
+    --no-parent: remove the <parent> tag from the POM
+    --package=<package>: an alternative package to use when installing this POM and its artifact
+    --has-package-version: to indicate that the original version of the POM is the same as the upstream part of the version for the package.
+    --keep-elements=<elem1,elem2>: a list of XML elements to keep in the POM during a clean operation with mh_cleanpom or mh\_installpom
+    --artifact=<path>: path to the build artifact associated with this POM, it will be installed when using the command mh_install
+    --java-lib: install the jar into /usr/share/java to comply with Debian packaging guidelines
+    --usj-name=<name>: name to use when installing the library in /usr/share/java
+    --usj-version=<version>: version to use when installing the library in /usr/share/java
+    --no-usj-versionless: don't install the versionless link in /usr/share/java
+    --dest-jar=<path>: the destination for the real jar it will be installed with mh_install.
+    --classifier=<classifier>: Optional, the classifier for the jar. Empty by default.
+    --ignore-pom: don't install the POM with mh\_install or mh\_installpoms. To use with POM files that are created temporarily for certain artifacts such as Javadoc jars.
+
+For example, debian/$package.poms could contain:
+    
+    pom.xml --no-parent --has-package-version
+    module1/pom.xml --has-package-version --keep-elements=profiles,reporting // keep the profiles and reporting elements in the POM, as in this case they can be used from another place
+    module2/pom.xml --package=mypackage-doc // package this POM and associated items into mypackage-doc package
+

Added: trunk/maven-repo-helper/doc/ref/mh_linkjar.txt
===================================================================
--- trunk/maven-repo-helper/doc/ref/mh_linkjar.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/ref/mh_linkjar.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,41 @@
+### mh_linkjar:
+
+Usage:
+
+    mh_linkjar [option]... [pom] [dest_jar] [link]...
+
+Create symlinks for a jar installed by other means. The symlinks created include links to the jar in /usr/share/maven-repo, at the correct location for Maven.
+It can also create additional links to the jar, usually located in /usr/share/java.
+
+Where:
+
+    [pom] is the location of the POM associated with the jar to install.
+      GroupId, artifactId and version will be extracted from this file.
+    [dest_jar] is the path of the installed jar, usually located in the usr/share/java folder.
+    [link] is an additional link to the jar to install, usually there should be a link to usr/share/java/\$jar.jar and usr/share/java/\$jar-\$version.jar to comply with the Java packaging guidelines.
+      Note that there is no need to specify those particular links if the --java-lib option is used.
+
+Options:
+
+    -h --help: show this text
+    -V --version: show the version
+    -p<package> --package=<package>: name of the Debian package which will contain this jar file
+    -e<version>, --set-version=<version>: set the version for the jar, do not use the version declared in the POM file.
+    -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM.
+      Optional, the default location is debian/maven.rules
+      Maven rules are used here to extract the groupId, artifactId and version from the POM file.
+    -l --java-lib: Optional, if given it will install the jar into /usr/share/java to comply with the Debian Java specification.
+      The jar will be installed as /usr/share/java/\$name-\$version.jar and a versionless link /usr/share/java/\$name.jar will point to it, as well as the links installed in /usr/share/maven-repo
+    -n<name> --usj-name=<name>: Optional, the name to use when installing the library in /usr/share/java when --java-lib is used.
+      Defaults to the artifact id found in the POM.
+    -i<version> --usj-version=<version>: Optional, the version to use when installing the library in /usr/share/java when --java-lib is used.
+      Defaults to the version found in the POM.
+    -s --no-usj-versionless: Optional, don't install the versionless link in /usr/share/java.
+      This flag is used only when the -l or --java-lib option is given.
+    -c<classifier> --classifier=<classifier>: Optional, the classifier for the jar. Empty by default.
+    -v --verbose: show more information while running
+    -n --no-act: don't actually do anything, just print the results
+    --skip-clean-pom: don't clean the pom, assume that a previous action ran mh_cleanpom with the correct options.
+      mh_cleanpom is run only to extract the groupId, artifactId and version of the jar
+
+

Added: trunk/maven-repo-helper/doc/ref/mh_patchpom.txt
===================================================================
--- trunk/maven-repo-helper/doc/ref/mh_patchpom.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/ref/mh_patchpom.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,39 @@
+### mh\_patchpom:
+
+Usage:
+    mh_patchpom [option]... [pom] [backup]
+
+Patches one POM file using the Maven dependency rules.
+
+Where:
+    [pom] is the location of the POM file to transform. Default to pom.xml
+    [backup] is the backup file for the pom. Default to pom.xml.save
+
+Options:
+    -h --help: show this text
+    -V --version: show the version
+    -p<package> --package=<package>: name of the Debian package containing this library
+    -o --no-parent: don't inherit from a parent POM
+    -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins.
+      If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository
+    -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file.
+    -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM.
+      Optional, the default location is debian/maven.rules
+    -R<rule>, --extra-rule=<rule>: additional rule to apply when cleaning the POM. May occur multiple times, instead of or in addition to -r
+    -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM.
+      Optional, the default location is debian/maven.publishedRules
+    -U<rule>, --extra-published-rule=<rule>: extra rule to publish. May occur multiple times, instead of or in addition to -u
+    -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM.
+      Optional, the default location is debian/maven.ignoreRules
+    -I<rule>, --extra-ignore-rule=<rule>: additional rule used to remove dependencies from the transformed POM May occur multiple times, instead of or in addition to -i
+    -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously.
+      This is useful in  situations such as when the Maven clean target requires more  dependencies or plugins to ignore than the build target.
+      Optional, it is ignored by default
+    -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version
+    --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules
+    -d --debian-build: transform during a Debian build, which means that some POM elements will be removed
+    -b --build-no-docs: if the build doesn't need to build documentation, use this option to remove some POM elements (in particular plugins) which are useless here and may require extra dependencies and make the packaging harder.
+    -m<repo root>--maven-repo=<repo root>: location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository
+    -v --verbose: show more information while running
+    -n --no-act: don't actually do anything, just print the results
+

Added: trunk/maven-repo-helper/doc/ref/mh_patchpoms.txt
===================================================================
--- trunk/maven-repo-helper/doc/ref/mh_patchpoms.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/ref/mh_patchpoms.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,41 @@
+### mh_patchpoms:
+
+Usage: 
+
+    mh_patchpoms [option]...
+
+Reads the file debian/$package.poms and tranform each POM file
+listed in the .poms file into a POM file using the Debian versions
+of the libraries. Also keeps a backup of each POM file which can
+be restored with mh_unpatchpoms
+
+Options:
+
+    -h --help: show this text
+    -V --version: show the version
+    -p<package> --package=<package>: package to act on 
+    -k --keep-pom-version: keep the original version of the POM but convert all other versions in dependencies and plugins.
+      If there is a parent POM, keeps its version except when the parent is already registered in the Maven repository
+    -e<version>, --set-version=<version>: set the version for the POM, do not use the version declared in the POM file.
+    -r<rules> --rules=<rules>: path to the file containing the rules to apply when cleaning the POM.
+      Optional, the default location is debian/maven.rules
+    -R<rule>, --extra-rule=<rule>: additional rule to apply when cleaning the POM. May occur multiple times, instead of or in addition to -r
+    -u<rules> --published-rules=<rules>: path to the file containing the extra rules to publish in the property debian.mavenRules in the cleaned POM.
+      Optional, the default location is debian/maven.publishedRules
+    -U<rule>, --extra-published-rule=<rule>: extra rule to publish. May occur multiple times, instead of or in addition to -u
+    -i<rules> --ignore-rules=<rules>: path to the file containing the rules used to remove certain dependencies from the cleaned POM.
+      Optional, the default location is debian/maven.ignoreRules
+    -I<rule>, --extra-ignore-rule=<rule>: additional rule used to remove dependencies from the transformed POM May occur multiple times, instead of or in addition to -i
+    -c<rules> --clean-ignore-rules=<rules>: path to the file containing the rules use to remove certain dependencies from the cleaned POM, in addition to the ignore rules specified previously.
+      This is useful in  situations such as when the Maven clean target requires more  dependencies or plugins to ignore than the build target.
+      Optional, it is ignored by default
+    -s --no-rules: don't apply any rules for converting versions, do not even convert versions to the default 'debian' version
+    --no-publish-used-rule: don't publish the rule used to transform a POM's own attributes in debian.mavenRules
+    -d --debian-build: transform during a Debian build, which means that some POM elements will be removed
+    -b --build-no-docs: if the build doesn't need to build documentation, use this option to remove some POM elements (in particular plugins) which are useless here and may require extra dependencies and make the packaging harder.
+    -m\<repo root\>--maven-repo=\<repo root\>:  location of the Maven repository, used to force the versions of the Maven plugins used in the current POM file with the versions found in the repository
+    -v --verbose: show more information while running
+    -n --no-act: don't actually do anything, just print the results
+
+This script is used internally by maven-repo-helper when building packages with Maven. It is not usually used when Ant is used for the build.
+

Added: trunk/maven-repo-helper/doc/ref/mh_unpatchpoms.txt
===================================================================
--- trunk/maven-repo-helper/doc/ref/mh_unpatchpoms.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/ref/mh_unpatchpoms.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,16 @@
+### mh_unpatchpoms:
+
+Usage: 
+
+    mh_unpatchpoms [option]...
+
+Restore the POM files that have been patched to their original content.
+
+Options:
+
+    -h --help: show this text
+    -V --version: show the version
+    -p<package> --package=<package>: package to act on 
+    -v --verbose: show more information while running
+    -n --no-act: don't actually do anything, just print the results
+

Added: trunk/maven-repo-helper/doc/reference-footer.html
===================================================================
--- trunk/maven-repo-helper/doc/reference-footer.html	                        (rev 0)
+++ trunk/maven-repo-helper/doc/reference-footer.html	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1 @@
+</body>

Added: trunk/maven-repo-helper/doc/reference-header.html
===================================================================
--- trunk/maven-repo-helper/doc/reference-header.html	                        (rev 0)
+++ trunk/maven-repo-helper/doc/reference-header.html	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,22 @@
+<html>
+<head>
+  <title>Maven Repo Helper Reference</title>
+  <style TYPE="text/css">
+     <!-- 
+pre { /* the pre makes the border */
+    margin: 0.5em 0;
+    padding: 10pt;
+    border: 1pt solid #AEBDCC;
+    background-color: #F3F5F7;
+    color: black;
+}
+
+pre code { /* the code has no border and is inside the pre */
+    margin: 0;
+    padding: 0;
+    border: none;
+}
+     -->
+  </style>
+</head>
+<body>

Added: trunk/maven-repo-helper/doc/reference.txt
===================================================================
--- trunk/maven-repo-helper/doc/reference.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/reference.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,13 @@
+[repository specification](repository.html) | [reference](reference.html) | [tutorial](tutorial.html)
+
+Reference for Maven Repo Helper
+===============================
+
+Working with POM files
+----------------------
+
+In Maven, POM files are xml files containing the full definition of a project and how to build it.
+maven-repo-helper can manipulate them in order to clean unecessary cruft and integrate seamlessly in
+a Debian environment.
+
+

Added: trunk/maven-repo-helper/doc/reference2.txt
===================================================================
--- trunk/maven-repo-helper/doc/reference2.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/reference2.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,7 @@
+Working with jar files:
+-----------------------
+
+maven-repo-helper provides tools to install a freshly built jar file into /usr/share/maven-repo,
+or to install a link into /usr/share/maven-repo for a jar installed into /usr/share/java or another
+location by another tool.
+

Added: trunk/maven-repo-helper/doc/reference3.txt
===================================================================
--- trunk/maven-repo-helper/doc/reference3.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/reference3.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,78 @@
+### mh_linkjars:
+
+TODO
+
+### mh_linkrepojar:
+
+TODO
+
+Working with the build:
+-----------------------
+
+### mh_clean:
+
+Cleans the temporary files created by the other mh_* utilities.
+Add it to the clean: target in debian/rules
+
+### mh_installsite:
+
+TODO
+
+### mh_install:
+
+TODO
+
+Working with the repository:
+----------------------------
+
+### mh_checkrepo:
+
+TODO
+
+Debhelper 7 plugins:
+--------------------
+
+### --with maven_repo_helper:
+
+TODO
+
+### --with jh_maven_repo_helper:
+
+TODO
+
+-----------
+
+A more complex example from the modello package is:
+{{{
+pom.xml --no-parent
+modello-core/pom.xml
+modello-plugins/pom.xml
+modello-plugins/modello-plugin-converters/pom.xml
+modello-plugins/modello-plugin-dom4j/pom.xml
+modello-plugins/modello-plugin-java/pom.xml
+modello-plugins/modello-plugin-jdom/pom.xml
+modello-plugins/modello-plugin-stax/pom.xml
+modello-plugins/modello-plugin-xdoc/pom.xml
+modello-plugins/modello-plugin-xml/pom.xml
+modello-plugins/modello-plugin-xpp3/pom.xml
+modello-plugins/modello-plugin-xsd/pom.xml
+}}}
+
+debian/maven.rules:
+{{{
+junit junit jar s/3\..*/3.x/
+}}}
+This file is taken from the modello package. It specifies that the dependency on junit will use the version '3.x' instead of the default 'debian' version if the native version starts with '3.'. If the group id of the dependency is 'junit, the artifact id of the dependency is 'junit', the type of the dependency is 'jar' and the version starts with '3.', then this rule is used. 's/3\..*/3.x/' performs the replacement for the version, the syntax should be obvious to any sed user.
+
+This example from the commons-configuration package shows a few more possibilities: here, the version for commons-collections is converted to '2.x' if it starts with '2.' or '3.x' if it starts with '3.'.
+The line with ant is more interesting: if the group id is 'ant', then it is converted to 'org.apache.ant' - great trick for dealing with artifacts which are coming from Maven 1. Any artifact id or type will be matched and left unchanged, while the version will be converted to 'debian'.
+There is also the line with javax.servlet: this line keeps the version number used by this dependency, so if 2.4 is used, then 2.4 is also used in the cleaned POM.
+
+{{{
+junit junit jar s/3\..*/3.x/
+commons-collections commons-collections jar s/2\..*/2.x/
+commons-collections commons-collections jar s/3\..*/3.x/
+s/ant/org.apache.ant/ * * s/.*/debian/
+log4j log4j jar s/1\.2\..*/1.2.x/
+javax.servlet servlet-api jar *}}}
+

Added: trunk/maven-repo-helper/doc/repository-footer.html
===================================================================
--- trunk/maven-repo-helper/doc/repository-footer.html	                        (rev 0)
+++ trunk/maven-repo-helper/doc/repository-footer.html	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1 @@
+</body>

Added: trunk/maven-repo-helper/doc/repository-header.html
===================================================================
--- trunk/maven-repo-helper/doc/repository-header.html	                        (rev 0)
+++ trunk/maven-repo-helper/doc/repository-header.html	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,22 @@
+<html>
+<head>
+  <title>Maven Repo Helper Repository specification</title>
+  <style TYPE="text/css">
+     <!-- 
+pre { /* the pre makes the border */
+    margin: 0.5em 0;
+    padding: 10pt;
+    border: 1pt solid #AEBDCC;
+    background-color: #F3F5F7;
+    color: black;
+}
+
+pre code { /* the code has no border and is inside the pre */
+    margin: 0;
+    padding: 0;
+    border: none;
+}
+     -->
+  </style>
+</head>
+<body>

Added: trunk/maven-repo-helper/doc/repository.txt
===================================================================
--- trunk/maven-repo-helper/doc/repository.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/repository.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,326 @@
+[repository specification](repository.html) | [reference](reference.html) | [tutorial](tutorial.html)
+
+Maven Repository Specification
+==============================
+
+This page specifies how to install Java libraries in Maven compatible way which makes it possible to use Maven for Debian packaging. This specification is intended to be
+
+ * as short as possible,
+ * easy to understand,
+ * easy to use, and
+ * compatible with the Debian Java policy.
+
+Status
+------
+
+The specification is in use and implemented by maven-repo-helper and maven-debian-helper packages.
+
+Motivation: advantages of using Maven
+-------------------------------------
+
+Maven has advantages for the upstream developers that won't be repeated here. That is the reason why more and more projects are switching to Maven as their primary build tool. Detailed information about maven can be found at [Maven's homepage](http://maven.apache.org) and in the book [Maven: The Definitive Guide](http://books.sonatype.com/maven-book/).
+
+Maven maintains a model of a project in a file __pom.xml__: the developer can assign attributes to a project such as:
+
+ * name
+ * description
+ * URL
+ * information about developers and contributors
+ * license
+ * mailing lists
+ * issue tracker
+ * source code management (like subversion)
+ * dependencies
+
+Most of those attributes can directly be used for Debian packaging but the most interesting ones are the dependencies.
+
+Imagine a project 'a' that depends on 2 other projects 'b' and 'c' where 'b' itself depends on 'd', 'e', 'f' and 'c' depends on 'f', 'g', 'h'.
+
+
+    a ---> b ---> d
+       |      |
+       |      |-> e
+       |      |
+       |       -> f
+       |
+        -> c ---> f
+              |
+              |-> g
+              |
+               -> h
+
+In a later upstream version 'c' adds another depends 'i' and that means that we have to change all reverse depends of 'c' including 'a' (like adding __i.jar__ to __DEB_JARS__ in __debian/rules__). But Maven will do this automatically for us and we do not have to touch reverse depends of any package when the dependencies change.
+
+Problems with upstream's repository (central)
+---------------------------------------------
+
+There is one central repository for Maven artifacts at http://repo2.maven.org/maven2/ that ships '''all''' releases of an artifact. The artifact log4j:log4j has 12 different versions at http://repo2.maven.org/maven2/log4j/log4j/ and maven downloads one of them during building a package that declares log4j:log4j as a dependency. Sometimes it is difficult to predict which version gets downloaded by maven and that is why it is hard to use maven in offline mode but for building Debian packages the offline mode is essential. All dependencies must be available as Debian packages and it is not acceptable to download artifacts during the build process from the central Maven repository.
+
+The package maven-repo-helper tries to solve this problem by providing a local repository below the following directory:
+
+    REPO=/usr/share/maven-repo
+
+We will reference this location as __$REPO__ in the specification.
+
+In Maven Central repository, there is one policy which mandates that projects upload a cleaned version of their POM files (see [http://maven.apache.org/guides/mini/guide-central-repository-upload.html](Guide to uploading artifacts to the Central Repository)). In particular, the <build> tag in a POM files should be removed, as well as <repositories> or <pluginRepositories> tags as all dependencies should be already in Central. We will use similar rules for the Debian repository.
+
+Versions in Maven POM files and smooth updates of Debian packages
+-----------------------------------------------------------------
+
+The Maven repository should support smooth upgrades of Java libraries. When a new version of a library is installed in a Debian system, this is what should happend:
+
+ 1. Files in __$REPO/$GROUPID/$ARTIFACTID/$OLD\_VERSION/__ are deleted
+ 2. The new POM file and link to the jar are installed under __$REPO/$GROUPID/$ARTIFACTID/$NEW\_VERSION/__
+ 3. Other POMs which have a dependency on __$GROUPID:$ARTIFACTID:$OLD\_VERSION__ should see their dependencies updated to __$GROUPID:$ARTIFACTID:$NEW\_VERSION__
+
+Steps 1. and 2. are simple file operations, but 3. implies that dpkg should somehow parse all POM files installed under $REPO, and update the dependency version where necessary.
+This would imply changing files outside of the package affected by the update, and those files may belong to other packages. This is difficult and against the Debian guidelines.
+
+We are using a solution which keeps the amount of effort to a minimum, keeps $REPO consistent and useable at all times and works well with Maven.
+
+The idea is to maintain 2 versions of each artifact under the Maven repository. The first version uses the native version from Maven, to keep compatibility.
+
+The second version is more interesting: its version is converted to a Debian managed version, usually 'debian', but it could be '1.x' to represent any version compatible with the version 1 of the API.
+
+The Maven repository will look like this:
+
+    /usr/share/java/
+      commons-beanutils-1.8.0.jar
+      commons-beanutils.jar -> commons-beanutils-1.8.0.jar
+      junit-3.8.2.jar
+      junit.jar -> junit-3.8.2.jar
+    /usr/share/maven-repo/
+       commons-beanutils/commons-beanutils/1.8.0/
+         commons-beanutils-1.8.0.jar -> ../../../../java/commons-beanutils-1.8.0.jar
+         commons-beanutils-1.8.0.pom
+       commons-beanutils/commons-beanutils/debian/
+         commons-beanutils-debian.jar -> ../../../../java/commons-beanutils-1.8.0.jar
+         commons-beanutils-debian.pom
+       junit/junit/3.8.2/
+         junit-3.8.2.jar -> ../../../../java/junit-3.8.2.jar
+         junit-3.8.2.pom
+       junit/junit/3.x/
+         junit-3.x.jar -> ../../../../java/junit-3.8.2.jar
+         junit-3.x.pom
+
+The jar for each package (here libcommons-beanutils-java and junit) are installed in /usr/share/java to comply with the Debian Java policy, then we
+create symlinks to those jars in the places where we need them.
+So we have a link for the jar under the current version folder in /usr/share/maven-repo, and there is a link to the jar under the Debian version in the Maven repository.
+
+Upgrading the jar is now a simple matter of deleting the jars, symlinks and folders used by the old version, creating the jars, symlinks and folders for the new version,
+and updating the symlinks for the versionless links in /usr/share/java (commons-beanutils.jar, junit.jar) and updating the symlinks for the Debian versioned symlinks
+(/usr/share/maven-repo/commons-beanutils/commons-beanutils/debian/commons-beanutils-debian.jar and /usr/share/maven-repo/junit/junit/3.x/junit-3.x.jar). Don't worry, the scripts provided by maven-repo-helper will do this for you.
+
+This layout makes it easy to upgrade libraries independenly of each others, it keeps some compatibility with the Maven central repository so that you can mix and match Debian-controlled parts of the repository with downloads from the Internet if you wish.
+
+Now the real trick is in how dependencies are versioned in each POM: we replace all native versions with Debian versions.
+
+This is the (simplified) content of commons-beanutils-1.8.0.pom:
+
+    <project>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>commons-beanutils</groupId>
+    <artifactId>commons-beanutils</artifactId>
+    <version>1.8.0</version>
+    <packaging>jar</packaging>
+    <dependencies>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>debian</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.x</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections-testframework</artifactId>
+            <version>debian</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.x</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    </project>
+
+commons-beanutils-debian.pom has the same content, except that <version> is now 'debian':
+
+    <project>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>commons-beanutils</groupId>
+    <artifactId>commons-beanutils</artifactId>
+    <version>debian</version> <!-- 'debian' version here ! -->
+    <packaging>jar</packaging>
+    <dependencies>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>debian</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.x</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections-testframework</artifactId>
+            <version>debian</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.x</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    </project>
+
+Note that all dependencies have also their versions replaced with the symbolic versions from Debian. For example, there is a dependency on version 3.x of junit.
+3.x is a symbolic version for junit that we have defined earlier. 
+
+If we need to update junit to a new version, let's suppose that the version 3.8.3 comes out, then junit 3.8.2 will be removed from the Maven repository and replaced by
+junit 3.8.3. But junit 3.x will not be affected by the change, except that the target for the symlink of junit-3.x.jar will now point to junit-3.8.3.jar.
+More importantly, the POM file for junit 3.x will not change, which means that we can keep pointing to it from other packages, like in this case libcommons-beanutils-java.
+
+Alternatives
+------------
+
+ * JPackage
+
+The documentation of JPackage can be found at http://www.jpackage.org/cgi-bin/viewvc.cgi/src/jpackage-utils/doc/jpackage-1.5-policy.xhtml?root=jpackage&view=co. There is no information there on how to use maven. JPackage uses a patched Maven that understands the package layout in /usr/share/java. As a maintainer you have to learn the toolset - and that is why JPackage fails the 'easy to use' requirement.
+
+JPackage cheats on version numbers - whenever a pom requests a specific version like 1.2.3 its Maven just delivers what is has in /usr/share/java without considering the requested version all. They obviously did not solved the problem of having multiple versions of an artifact installed at the same time but we have various versions of asm, commons-collections, junit, and more in Debian and we must have a solution for that.
+
+ * Version ranges
+
+Maven supports version ranges - see the [version ranges specification](http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution).
+We could use replace strict versions in dependencies by version ranges, to allow smooth upgrades when a library is updated.
+For example, in the commons-beanutils POM we could replace the version for the junit dependency by a version range:
+
+    <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>[3.8.2,4.0)</version>
+        <scope>test</scope>
+    </dependency>
+ 
+With this new POM definition, we could easily update junit from version 3.8.2 to version 3.8.3 without breaking commons-beanutils.
+
+That's a neet solution, unfortunately Maven 2 had quite a few issues with version ranges. To enable a reliable resolution of versions with version ranges, we need first to
+enforce a reliable numbering scheme for Java libraries. Some Java libraries in Debian have some really strange version schemes, some use for example dates, others -ALPHA, -BETA, -RC suffixes, others not. It looks like Maven 3.1 will adopt OSGi numering scheme, but nothing is written in stone at the moment. When things will have settled, we will probably update the Maven repository for Debian to use version ranges instead of symbolic versions.
+
+Targets
+=======
+
+The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this document are to be interpreted as described in [[http://www.ietf.org/rfc/rfc2119.txt|RFC 2119]].
+
+This specification is targeted at the following types of packages:
+
+ 1. Packages that use Maven for building SHALL install their artifacts into __$REPO__. Those packages SHOULD use maven-repo-helper or maven-debian-helper which will do most of the work automatically.
+ 1. Packages that don't use Maven (yet) but their upstream developers are using Maven: they SHALL install their artifacts into __$REPO__ after making sure they follow the specification. Patching of the pom.xml files might be necessary. Maven-repo-helper or maven-debian-helper MAY be used to check the conformance to the spec.
+ 1. Package where the upstream developers don't use Maven but pom.xml are provided for Maven users: the artifacts SHOULD be installed into __$REPO__ after making sure they follow the specification. Patching of the pom.xml files might be necessary. Maven-repo-helper MAY be used to check the conformance to the spec.
+ 1. All other packages: pom.xml files from other sources (central, mvnrepository.com or hand written) MAY be installed into __$REPO__ after making sure the artifacts follow the specification. Patching of the pom.xml files might be necessary. Maven-repo-helper MAY be used to check the conformance to the spec.
+For packages that are used very often by Maven based packages (example: junit) the MAY or SHOULD used above SHOULD be upgraded to a SHALL.
+
+Specification
+=============
+
+Artifacts MUST be installed into __$REPO/$GROUPID/$ARTIFACTID/$VERSION/__ where $GROUPID is the result of __groupId.replace( '.', '/' )__ and $VERSION is the current version of the artifact. The pom.xml files MUST be installed as __$ARTIFACTID-$VERSION.pom__ and the symlink to the jar file as __$ARTIFACTID-$VERSION.jar__. Following the Debian Java policy, the jar file itself SHOULD be installed as __$ARTIFACTID.jar__ into __/usr/share/java/__, but the name of the jar MAY be different.
+
+Artifacts SHOULD also be installed into __$REPO/$GROUPID/$ARTIFACTID/$DEBIAN\_VERSION/__, where $DEBIAN\_VERSION is the symbolic version used to facilitate updates of the artifact in Debian. As we need to guaranty that the new version of the package will keep running and won't break dependant packages, it is advised to use a symbolic version which will exclude API breaking changes in the library. A well behaved library will use the symbolic versions 1.x, 2.x, 3.x and so on to indicate that all versions starting with 1. will be mapped to the symbolic version 1.x and that minor updates in this version range will not break other packages, but version 2.0 onwards will contain breaking changes and require a bigger upgrade including updating the symbolic version 2.x for this library and for all dependant packages. It is expected that such a major change MAY require a new packaging for the library, for example libcommons-collections-java contains the version 2.<something> of commons-collection and uses the symbolic version 2.x in the Maven repository, but libcommons-collections3-java contains the version 3.<something> of commons-collections and uses the symbolic version 3.x in the Maven repository.
+
+Maven plugins cannot use symbolic versions, so when the artifact is a Maven plugin, then the symbolic version SHOULD NOT be used for that artifact.
+
+All compile and run time dependencies including parents and plugins MUST be resolved by packages that are available in Debian. Test dependencies need not be resolvable except if you want to build and run the test code.
+
+For all dependencies already packaged in Debian with the accompanying Maven metadata, hard coded version numbers for those dependencies SHOULD be replaced by their symbolic version. Example:
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.0.9</version>
+    </dependency>
+
+should be changed to
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.x</version>
+    </dependency>
+
+When the POM contains also a reference to a parent, then the version for this parent SHOULD also be replaced by a symbolic version. Example:
+
+    <parent>
+        <groupId>asm</groupId>
+        <artifactId>asm-parent</artifactId>
+        <version>2.2.3</version>
+    </parent>
+
+    <parent>
+        <groupId>asm</groupId>
+        <artifactId>asm-parent</artifactId>
+        <version>2.x</version>
+    </parent>
+
+Dependencies that are not yet following this specification can be referred with __<scope>system</scope>__ and __<systemPath>/usr/share/java/$ARTIFACTID.jar</systemPath>__ but this SHOULD be avoided if possible. Example:
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.0.9</version>
+    </dependency>
+
+could be changed to
+
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.0.9</version>
+      <scope>system</scope>
+      <systemPath>/usr/share/java/maven2.jar</systemPath>
+    </dependency>
+
+as long as the Debian package maven2 does not ship its pom files. The hardcoded version number is ignored by Maven if the __<systemPath>__ element is specified.
+
+The helper scripts provided by maven-repo-helper (in particular mh\_cleanpom and mh\_installpom) and maven-debian-helper (integrated in Maven as Maven plugins) will assist you to install the jar files and the POM descriptors in the repository, and replace the versions in the POM files by symbolic versions where needed. They perform further operations such as removing unecessary tags in the XML (<build>, <repository> and <pluginRepository> in particular are removed), and they insert some useful additional information in the POM file as properties. Those additional properties provide guidance for those automatic tools when working on the package or on packages dependent upon this package.
+
+For example:
+
+    <properties>
+        <debian.originalVersion>2.2.3</debian.originalVersion>
+        <debian.package>libasm2-java</debian.package>
+        <debian.mavenRules><![CDATA[asm * * s/2\..*/2.x/ * *]]></debian.mavenRules>
+    </properties>
+
+ * debian.originalVersion: Indicates the current version for the library. Used in particular to manage updates.
+ * debian.package: Name of the binary Debian package containing this POM file. It speeds up packaging, as launching dpkg--search is not really efficient from Java.
+ * debian.mavenRules: Lists the rules used for this package. It simplifies handling dependencies. For example, if the dependency asm:asm:2.4.5 is found in a POM file, then we try to apply the rule 'asm * * s/2\..*/2.x/ * *'. It will match and return 'asm asm jar 2.x compile' after dependency resolution, and the tool will replace version 2.4.5 by 2.x in the POM file.
+ * debian.hasPackageVersion: Indicates that there is a match between the version in Maven and the Debian version of the package. For example if the Maven version is 2.2.3 for asm, and the debian version of libasm2-java is 2.2.3-1, then we can add this property flag to the POM. For consumers of the package, it means that if they have a dependency on asm with the version 2.2 for example, then they can use a version constraint on their Depends and Build-Depends for the libasm2-java package, like so: 
+
+    Depends: ${misc:Depends}, libasm2-java ( >= 2.2 )
+
+
+Glossary
+========
+
+Some of Maven's concept are explained here but do not expect an exact reference, please.
+
+ - __Artifact__: An artifact is a module in a Maven project. Every artifact has one pom.xml file (called the POM) and has zero or one binary jar files. An artifact can be uniquely addressed by the __<artifactId>__, __<groupId>__, and __<version>__ elements. 
+ - __Dependency__: A reference to another artifact that is needed for building, testing, or during runtime. It is specified by the __<dependency>__ element.
+ - __Parent__: Every artifact can have zero or one dependency specified by the __<parent>__ element. Parent are somewhat similar to dependencies but not identical.
+ - __Plugin__: Maven uses plugins to carry out most of the work of build process like the ''maven-clean-plugin'', ''maven-compile-plugin'', and ''maven-jar-plugin'' - just to name a few. Specialized plugins can be used to customize the build process and they are specified by the __<plugin>__ element.
+ - __POM__: The ''project object model'' that describes the artifact and its build process. It is represented as a file pom.xml in the source code which gets renamed to $ARTIFACTID-$VERSION.pom during installation. It is also designed as Maven metadata as it contains data about an artifact.
+ - __Project__: One or more modules can be built in one build process and they usually share the same version number. In a multimodule project the modules are specified by the __<module>__ element. That is why every maven project is best packaged as one Debian source package.
+
+

Added: trunk/maven-repo-helper/doc/tutorial-footer.html
===================================================================
--- trunk/maven-repo-helper/doc/tutorial-footer.html	                        (rev 0)
+++ trunk/maven-repo-helper/doc/tutorial-footer.html	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1 @@
+</body>

Added: trunk/maven-repo-helper/doc/tutorial-header.html
===================================================================
--- trunk/maven-repo-helper/doc/tutorial-header.html	                        (rev 0)
+++ trunk/maven-repo-helper/doc/tutorial-header.html	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,22 @@
+<html>
+<head>
+  <title>Maven Repo Helper Tutorial</title>
+  <style TYPE="text/css">
+     <!-- 
+pre { /* the pre makes the border */
+    margin: 0.5em 0;
+    padding: 10pt;
+    border: 1pt solid #AEBDCC;
+    background-color: #F3F5F7;
+    color: black;
+}
+
+pre code { /* the code has no border and is inside the pre */
+    margin: 0;
+    padding: 0;
+    border: none;
+}
+     -->
+  </style>
+</head>
+<body>

Added: trunk/maven-repo-helper/doc/tutorial.txt
===================================================================
--- trunk/maven-repo-helper/doc/tutorial.txt	                        (rev 0)
+++ trunk/maven-repo-helper/doc/tutorial.txt	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,364 @@
+[repository specification](repository.html) | [reference](reference.html) | [tutorial](tutorial.html)
+
+Packaging Java and Maven projects with Maven Repo Helper
+========================================================
+
+The maven-repo-helper package provides tools for installing and maintaining Maven POMs and jars installed in /usr/share/maven-repo.
+
+Maven is a comprehensive build tool for Java and other languages based around the concept of plugins and a repository accessible normally from internet (a la CPAN), and providing access to the libraries used by a project.
+
+To satisfy the requirement that all software must be built from the Debian repository and that no access to Internet is allowed during a build, we have re-created a Maven repository for Debian. This repository is located in /usr/share/maven-repo and Maven POM files installed there must follow some special requirements.
+
+The Debian policy mandates that Java libraries are installed in /usr/share/java, so we have many Java libraries have already been packaged in Debian, but they don't have any Maven descriptors (POMs) associated with them. maven-repo-helper can help by installing those libraries also in /usr/share/maven-repo with their POM files.
+
+The Maven repository maintained by Debian has some special characteristics which make it difficult to use directly upstream POM files without any changes. To allow a smooth upgrade of Java libraries, we create both native and Debian versions of the artifacts, and replace all versions in the dependencies with Debian versions - see the [repository specification](repository.html) document for more informations about this process. In addition, entries in the POM file which are not needed anymore, such as build information, are removed. mh\_make provides the scripts mh\_patchpom and mh\_cleanpom which patch dependencies versions and clean up the POM file respectively. Other scripts often make use of those two scripts to provide more advanced functionality.
+
+maven-repo-helper has no dependency on Maven, so it can be used for any library, including libraries used by Maven itself. It provides the foundations for maven-debian-helper. Its goal is to manage the /usr/share/maven-repo folder properly, and cannot be used alone to build a Java library from source. You will normally use it either with Ant (started by a cdbs rule or dh 7 rule or anything you like), or with javahelper which will take care of building the binaries for your project.
+
+**Important:** If you want your build to use Maven itself, then run mh\_make from the maven-debian-helper package on the upstream sources. mh\_make will guide you for that process and generate all necessary debian files for you.
+You can also use mh\_make --ant to speed up the packaging of a project which uses Ant as the build tool and needs to install its artifacts into the Maven repository.
+
+Quick start
+===========
+
+This section presents some of the recommanded packaging styles:
+
+DH 7 + Ant + maven-repo-helper
+------------------------------
+The build uses dh 7 style, it runs Ant for the build and uses maven-repo-helper to install all jars both in /usr/share/java and in /usr/share/maven-repo with the POM files.
+
+debian/control:
+
+	Source: bnd
+	Section: java
+	Priority: optional
+	Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
+	Uploaders: Ludovic Claude <ludovicc at debian.org>
+	Build-Depends: debhelper (>= 8), maven-repo-helper (>= 1.6), default-jdk
+	Build-Depends-Indep: junit, libosgi-ee-minimum-api-java (>= 1.2.1)
+	Standards-Version: 3.9.2
+	Homepage: http://www.aqute.biz/Code/Bnd
+	
+	Package: bnd
+	Architecture: all
+	Depends: ${misc:Depends}
+	Description: A tool to create and diagnose OSGi R4 bundles
+	 [...]
+
+Note the Build-Depends on debhelper and maven-repo-helper
+
+debian/rules:
+
+	#!/usr/bin/make -f
+	export JAVA_HOME=/usr/lib/jvm/default-java
+	%:
+		dh $@ --buildsystem=ant --with maven_repo_helper
+
+We use here dh 7 for the build, with ant as the build system, and the maven_repo_helper plugin which will install all generated artifacts in the Maven repository.
+Ant is run with the upstream build.xml file and the default target.
+
+bnd.poms:
+
+	biz.aQute.bndlib/tmp/pom.xml --has-package-version --artifact=biz.aQute.bndlib/tmp/biz.aQute.bndlib.jar --java-lib --usj-name=bndlib
+
+Deploy the jar built in biz.aQute.bndlib/tmp folder (--artifact option) as bndlib.jar (--usj-name option) in /usr/share/java (--java-lib option) and deploy it as well in the Maven repository. We use the POM file created by the build (biz.aQute.bndlib/tmp/pom.xml) as it contains the metadata for the bndlib jar.
+The option --has-package-version tells maven-repo-helper that the version of the POM matches the version of the Debian package, which is a useful hint for 
+mh\_make when packaging another project which uses this library.
+
+maven.rules:
+
+	biz.aQute s/bnd/bndlib/
+
+Change the name of the artifact from bnd to bndlib in the Maven POM. The current version of bndlib will be replaced by a generic 'debian' version.
+
+You can use mh\_lspoms from the maven-debian-helper package to help you locate POM files in your sources and generate both the .poms and maven.rules files.
+
+DH 7 + Ant + maven-ant-helper + maven-repo-helper
+-------------------------------------------------
+A variant of the previous solution, where we don't use the upstream build script, but an Ant script which works on something which looks like a Maven project and tries to emulate Maven as best as it can. This is quite handy when you are working on a package used by Maven itself and cannot use Maven during the build. 
+
+debian/control:
+
+	Source: plexus-utils2
+	Section: java
+	Priority: optional
+	Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
+	Uploaders: Ludovic Claude <ludovic.claude at laposte.net>
+	Build-Depends: debhelper (>= 7), default-jdk, maven-repo-helper (>= 1.6), ant-optional, maven-ant-helper (>> 6.7) 
+	Build-Depends-Indep: libplexus-parent-java (>= 2.0.6), junit (>= 3.8.2), default-jdk-doc 
+	Standards-Version: 3.9.2
+	Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/plexus-utils2
+	Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/plexus-utils2
+	Homepage: http://plexus.codehaus.org/plexus-utils 
+
+	Package: libplexus-utils2-java
+	Architecture: all
+	Depends: ${misc:Depends}, libplexus-parent-java (>= 2.0.6)
+	Suggests: libplexus-utils2-java-doc
+	Description: Plexus Common Utilities
+	 [...]
+
+	Package: libplexus-utils2-java-doc
+	Architecture: all
+	Section: doc
+	Depends: ${misc:Depends}, default-jdk-doc
+	Suggests: libplexus-utils2-java
+	Description: Documentation for Plexus Common Utilities
+	 [...]
+
+We define a binary package which will contain the jars and the fragment of the Maven repository for this package (libplexus-utils2-java),
+and a documentation package containing the Javadoc folder (installed in /usr/share/doc) and the Javadoc jar installed in the Maven repository (libplexus-utils2-java-doc).
+
+Note the Build-Depends on debhelper, maven-repo-helper and maven-ant-helper.
+
+debian/rules:
+
+	#!/usr/bin/make -f
+	
+	DEB_SOURCE_PACKAGE   := $(shell dpkg-parsechangelog | grep '^Source:' | cut -f 2 -d ' ')
+	DEB_UPSTREAM_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | cut -d: -f2- | sed 's/-[^-]*$$//')
+
+	export JAVA_HOME=/usr/lib/jvm/default-java
+	export CLASSPATH=$(shell for jar in `cat debian/build-classpath`; do if [ -f "$$jar" ]; then echo -n "$${jar}:"; fi; done)
+	export ANT_ARGS=-Dbasedir=$(realpath .) -Dpackage=$(DEB_SOURCE_PACKAGE) -f /usr/share/maven-ant-helper/maven-build.xml
+	
+	%:
+		dh $@ --buildsystem=ant --with maven_repo_helper
+
+We use here dh 7 for the build, with ant as the build system, and the maven\_repo\_helper plugin which will install all generated artifacts in the Maven repository
+We configure ant to use the maven-ant-helper build script (/usr/share/maven-ant-helper/maven-build.xml) and the classpath defined in debian/build-classpath
+
+libplexus-utils2-java.poms:
+
+	pom.xml --has-package-version --artifact=target/plexus-utils-*.jar --java-lib --usj-name=plexus-utils2
+
+Install the jar as plexus-utils2.jar (--usj-name option) in /usr/share/java (--java-lib option) and install it as well in /usr/share/maven-repo with its POM file.
+The jar is coming from the target/ folder used by Maven (and the maven-repo-helper script) for its builds, and we use a glob pattern (*) to match any version of the jar (--artifact option).
+The option --has-package-version tells maven-repo-helper that the version of the POM matches the version of the Debian package, which is a useful hint for 
+mh\_make when packaging another project which uses this library.
+
+libplexus-utils2-java-doc.poms:
+
+	target/plexus-utils.javadoc.pom --has-package-version --artifact=target/plexus-utils.javadoc.jar --classifier=javadoc --ignore-pom
+
+Install the javadoc jar into /usr/share/maven-repo, without a POM file (--ignore-pom option) because that's the way Maven works - javadoc jars have no dedicated POM files for them. Instead, there is a classifier which tells Maven that this jar contains Javadoc (--classifier option).
+The javadoc jar is packaged in libplexus-utils2-java-doc package.
+
+libplexus-utils2-java-doc.install:
+
+	target/apidocs/* usr/share/doc/libplexus-utils2-java/api
+
+Install the javadoc folder into /usr/share/doc/libplexus-utils2-java/api.
+This folder is packaged in libplexus-utils2-java-doc package.
+
+maven.rules:
+
+	junit junit jar s/3\..*/3.x/ * *
+	org.codehaus.plexus plexus-utils jar s/2\..*/2.x/ * *
+	org.codehaus.plexus plexus pom s/2\..*/2.x/ * *
+
+Adapt versions for Debian in the Maven POMs, as it ease small upgrades.
+
+-    junit:junit jar dependencies with a version starting with 3. will use version 3.x instead (and libjunit-java contains a similar rule which install version 3.x in the Maven repository)
+-    org.codehaus.plexus:plexus-utils jar dependencies with a version starting with 2. will use version 2.x instead
+-    org.codehaus.plexus:plexus pom dependencies with a version starting with 2. will use version 2.x instead
+
+DH 7 + javahelper + maven-repo-helper
+-------------------------------------
+
+debian/control:
+
+	Source: httpunit
+	Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
+	Uploaders: Miguel Landaeta <miguel at miguel.cc>, Michael Koch <konqueror at gmx.de>
+	Section: java
+	Priority: optional
+	Build-Depends: default-jdk, ant (>= 1.7.0-6), javahelper (>= 0.28),
+	 debhelper (>= 7.0.50~), rhino (>= 1.7R1-2), libjtidy-java (>= 7+svn20070309-2),
+	 libgnujaf-java (>= 1.1.1-4), junit (>= 3.8.2), libgnumail-java (>= 1.1.2-2),
+	 libservlet2.4-java (>= 5.0.30-8), libxerces2-java (>= 2.9.1-2),
+	 libnekohtml-java (>= 0.9.5+dfsg-1.1), maven-repo-helper (>= 1.6)
+	Standards-Version: 3.9.2
+	Homepage: http://httpunit.org/
+	Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/httpunit/
+	Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/httpunit
+
+	Package: libhttpunit-java
+	Architecture: all
+	Section: java
+	Priority: optional
+	Depends: ${java:Depends}, libxerces2-java (>= 2.9.1-2), libnekohtml-java (>= 0.9.5+dfsg-1.1),
+	 rhino (>= 1.7R1-2), libjtidy-java (>= 7+svn20070309-2), libservlet2.4-java
+	 (>= 5.0.30-8), ${misc:Depends}
+	Recommends: junit (>= 3.8.2)
+	Suggests: libhttpunit-java-doc (= ${binary:Version})
+	Description: automated web site testing toolkit
+		[...]
+
+Note the Build-Depends on debhelper, javahelper, ant and maven-repo-helper
+
+debian/rules:
+
+	#!/usr/bin/make -f
+	%:
+		dh --with javahelper --with jh_maven_repo_helper $@
+
+We use here dh 7 for the build, with javahelper as the build system (which in turn will launch Ant because build.xml exists),
+and the jh\_maven\_repo\_helper plugin which is adapted to work with javahelper and will install all generated artifacts in the Maven repository.
+
+libhttpunit-java.jlibs:
+
+	lib/httpunit.jar
+
+We tell javahelper to install the httpunit.jar file located in lib into /usr/share/java
+
+libhttpunit-java.poms:
+
+	debian/pom.xml --usj-name=httpunit
+
+Create a link for the jar /usr/share/java/httpunit.jar into the Maven repository
+and use debian/pom.xml as its companion metadata file
+
+CDBS + maven-repo-helper using mh\_install
+-----------------------------------------
+
+debian/control:
+
+    Source: maven-debian-helper
+    Section: java
+    Priority: optional
+    Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
+    Uploaders: Torsten Werner <twerner at debian.org>, Ludovic Claude <ludovic.claude at laposte.net>,
+     Michael Koch <konqueror at gmx.de>, Damien Raude-Morvan <drazzib at debian.org>
+    Build-Depends: cdbs, debhelper (>= 7), default-jdk, maven-ant-helper (>> 6.7), maven-repo-helper (>= 1.5), ant-optional, help2man
+    Build-Depends-Indep: junit, libmaven-plugin-tools-java, libplexus-velocity-java
+    Standards-Version: 3.9.2
+    Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/maven-debian-helper
+    Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/maven-debian-helper/
+    Homepage: http://wiki.debian.org/Java/MavenBuilder
+
+    Package: maven-debian-helper
+    Architecture: all
+    Depends: ${misc:Depends}, default-jdk, maven-repo-helper (>= 1.5), maven2 (>= 2.2.1-5),
+     libmaven-clean-plugin-java, libmaven-resources-plugin-java,
+     libmaven-compiler-plugin-java, libmaven-jar-plugin-java, libmaven-site-plugin-java,
+     libsurefire-java, velocity, libplexus-velocity-java
+    Suggests: libmaven-javadoc-plugin-java, apt-file, devscripts, subversion
+    Description: Helper tools for building Debian packages with Maven
+     [...]
+
+Note the Build-Depends on cdbs and maven-repo-helper. maven-ant-helper and ant-optional are also needed for this package, as it's quite complex
+but this is not important for this tutorial.
+
+debian/rules:
+
+    #!/usr/bin/make -f
+    include /usr/share/cdbs/1/rules/debhelper.mk
+    include /usr/share/cdbs/1/class/ant.mk
+    
+    PACKAGE              := $(DEB_SOURCE_PACKAGE)
+    VERSION              := $(shell echo ${DEB_UPSTREAM_VERSION} | sed -r 's/([0-9\.]+).*/\1/')
+    JAVA_HOME            := /usr/lib/jvm/default-java
+    DEB_JARS             := ant-nodeps classworlds maven-core maven-artifact maven-artifact-manager maven-model \
+     maven-compat maven-plugin-api maven-project maven-scm-api velocity file-management plexus-utils \
+     plexus-container-default-alpha maven-repo-helper
+    DEB_ANT_BUILD_TARGET := package
+    DEB_ANT_BUILDFILE    := debian/build.xml
+    DEB_ANT_ARGS         := -Dpackage=$(PACKAGE) -Dbin.package=$(PACKAGE)
+    API_DOCS             := target/api
+    
+    install/$(PACKAGE)::
+        mh_install -p$(PACKAGE)
+        
+    clean::
+        mh_clean
+
+This is a simplified version of debian/rules, which shows how to use the mh\_install and mh\_clean scripts from maven-repo-helper
+with CDBS and Ant.
+mh\_install performs the installation of the built jars into /usr/share/maven-repo and /usr/share/java. It uses the configuration defined
+in maven-debian-helper.poms.
+mh\_clean does the clean up of files left behind during the execution of mh\_install.
+
+maven-debian-helper.poms:
+
+    pom.xml --no-parent --has-package-version
+    maven-debian-helper/pom.xml --has-package-version --artifact=maven-debian-helper/target/maven-debian-helper-*.jar --java-lib
+    maven-debian-plugin/pom.xml --has-package-version --artifact=maven-debian-plugin/target/maven-debian-plugin-*.jar --java-lib
+    maven-build-nodocs/pom.xml --has-package-version --artifact=maven-build-nodocs/target/maven-build-nodocs-*.jar --java-lib
+    maven-packager-utils/pom.xml --has-package-version --artifact=maven-packager-utils/target/maven-packager-utils-*.jar --java-lib
+
+Here we tell mh\_install to deploy the maven-debian-helper project and its sub projects into /usr/share/maven-repo,
+and to deploy all jars also into /usr/share/java (--java-lib option)
+
+CDBS + maven-repo-helper using mh\_installpoms and mh\_installjar
+-----------------------------------------------------------------
+
+debian/control:
+
+    Source: plexus-io
+    Section: java
+    Priority: optional
+    Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
+    Uploaders: Torsten Werner <twerner at debian.org>, Ludovic Claude <ludovic.claude at laposte.net>
+    Build-Depends: debhelper (>= 5), cdbs (>= 0.4.5.3), default-jdk
+    Build-Depends-Indep: maven-repo-helper (>> 0.5), maven-ant-helper (>> 4), ant, ant-optional, 
+     libplexus-utils-java, libplexus-containers-java
+    Standards-Version: 3.8.1
+    Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/plexus-io
+    Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/plexus-io/
+    Homepage: http://plexus.codehaus.org/plexus-components/plexus-io/
+
+    Package: libplexus-io-java
+    Architecture: all
+    Depends: ${misc:Depends}, libplexus-utils-java, libplexus-containers-java
+    Description: Plexus IO Components
+     [...]
+
+Note the Build-Depends on cdbs and maven-repo-helper.
+
+debian/rules:
+
+    #!/usr/bin/make -f
+    include /usr/share/cdbs/1/rules/debhelper.mk
+    include /usr/share/cdbs/1/class/ant.mk
+    
+    PACKAGE              := $(DEB_SOURCE_PACKAGE)
+    VERSION              := $(DEB_UPSTREAM_VERSION)
+    JAVA_HOME            := /usr/lib/jvm/default-java
+    DEB_JARS             := ant-nodeps plexus-utils plexus-container-default
+    DEB_ANT_BUILD_TARGET := package #javadoc
+    DEB_ANT_BUILDFILE    := /usr/share/maven-ant-helper/maven-build.xml
+    DEB_ANT_ARGS         := -Dbasedir=$(realpath .) -Dpackage=$(PACKAGE) -Dversion=$(VERSION)
+    API_DOCS             := build/api
+
+    binary-post-install/lib$(PACKAGE)-java::
+        mh_installpoms -plib$(PACKAGE)-java
+        mh_installjar -plib$(PACKAGE)-java -l pom.xml build/$(PACKAGE)-$(VERSION).jar
+
+    clean::
+        mh_clean
+
+No patches for the POM files are needed, all is taken care of by the mh\_installpom script (which uses mh\_cleanpom)
+
+mh\_installpoms will install all POM files registered in debian/lib$package-java.pom into /usr/share/maven-repo,
+
+mh\_installjar will install the jar file associated with the POM into /usr/share/maven-repo and also add a link to the jar in /usr/share/java, with and without the version
+
+debian/libplexus-io-java.pom
+
+    pom.xml --no-parent
+
+It simply lists the pom files in the source tree which need to be installed in the repository, and indicates with the --no-parent option that if the POM inherits
+from a parent POM, then this inheritance relationship will be removed in the cleaned POM. Removing the parent inheritence can often simplify the packaging, as 
+the parent POM mostly does not contain any useful information - we need only the list of dependencies in our repository, the other details for the build are irrelevant.
+
+There is less configuration here because we are using the low-level mh_installpoms and mh_installjar scripts which place the configuration on their command line options.
+
+Typical workflow for packaging a project from source
+----------------------------------------------------
+
+1. Get the original sources and unpack them, copy the debian/ folder if you are working on an existing package.
+1. mh\_make --ant
+1. edit debian/rules (to fix the last remaining packaging details)
+1. edit debian/control (to add maven-repo-helper to Build-Depends: )
+

Modified: trunk/maven-repo-helper/src/main/bin/mh_cleanpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2011-08-27 23:00:20 UTC (rev 14512)
@@ -24,6 +24,9 @@
    echo -e "Cleans the POM and prepare it for inclusion in the Maven repository."
    echo -e "Also extracts some information from the POM."
    echo -e ""
+   echo -e "debian/maven.rules is used to alter the version properties for the library and"
+   echo -e "its dependencies."
+   echo -e ""
    echo -e "Where"
    echo -e "\t[pom] is the location of the POM file to clean."
    echo -e "\t  Default to pom.xml or debian/pom.xml"
@@ -34,17 +37,19 @@
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
-   echo -e "\t-p<package> --package=<package>: name of the Debian package containing"
-   echo -e "\t  this library"
+   echo -e "\t-p<package> --package=<package>: name of the Debian package which"
+   echo -e "\t  will contain this POM file"
    echo -e "\t-h --has-package-version: flag that indicates that this POM has the"
    echo -e "\t  same version as the package, this helps packagers of depending packages"
    echo -e "\t-o --no-parent: don't inherit from a parent POM"
-   echo -e "\t-k --keep-pom-version: keep the original version of the POM but,"
-   echo -e "\t  convert all other versions in dependencies and plugins"
+   echo -e "\t-k --keep-pom-version: keep the original version of the POM but"
+   echo -e "\t  convert all other versions in dependencies and plugins."
+   echo -e "\t  If there is a parent POM, keeps its version except when the parent is already"
+   echo -e "\t  registered in the Maven repository"
    echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
    echo -e "\t  do not use the version declared in the POM file."
    echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules to apply when cleaning the POM."
+   echo -e "\t  rules to apply when cleaning the POM."
    echo -e "\t  Optional, the default location is debian/maven.rules"
    echo -e "\t-R<rule>, --extra-rule=<rule>: extra rule to apply when cleaning the POM"
    echo -e "\t  May occur multiple times, instead of or in addition to -r"
@@ -55,7 +60,7 @@
    echo -e "\t-U<rule>, --extra-published-rule=<rule>: extra rule to publish"
    echo -e "\t  May occur multiple times, instead of or in addition to -u"
    echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules use to remove certain dependencies from the cleaned POM"
+   echo -e "\t  rules used to remove certain dependencies from the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
    echo -e "\t-I<rule>, --extra-ignore-rule=<rule>: extra rule used to remove dependencies"
    echo -e "\t  from the transformed POM"
@@ -72,12 +77,12 @@
    echo -e "\t  do not even convert versions to the default 'debian' version"
    echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
    echo -e "\t  a POM's own attributes in debian.mavenRules"
+   echo -e "\t--keep-elements=<elem1,elem2>: keep the elements listed here"
+   echo -e "\t  even if they are normally removed by the clean operation."
+   echo -e "\t  Such elements are build,reports,reporting,prerequisites,profiles."
    echo -e "\t-m<repo root>--maven-repo=<repo root>: location of the Maven repository,"
    echo -e "\t  used to force the versions of the Maven plugins used in the current"
    echo -e "\t  POM file with the versions found in the repository"
-   echo -e "\t--keep-elements=<elem1,elem2>: keep the elements listed here"
-   echo -e "\t  even if they are normally removed by the clean operation."
-   echo -e "\t  Such elements are build,reports,reporting,prerequisites,profiles."
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
    echo -e ""
@@ -160,7 +165,7 @@
 fi
 
 NOPARENT=$(getarg o no-parent)
-KEEPVERSION=$(getarg k keep-pom-version)
+KEEP_POM_VERSION=$(getarg k keep-pom-version)
 SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
 eval EXTRA_RULES=$(getargs R extra-rule)
@@ -215,9 +220,10 @@
     fi
 fi
 
-CLEAN_ARGS=(--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${HAS_PACKAGE_VERSION:+--has-package-version} ${KEEPVERSION:+--keep-pom-version} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}" ${KEEP_ELEMENTS:+--keep-elements=$KEEP_ELEMENTS})
+DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
+CLEAN_ARGS=(--package=${PACKAGE} ${NOPARENT:+--no-parent} ${NORULES:+--no-rules} ${KEEP_POM_VERSION:+--keep-pom-version} ${HAS_PACKAGE_VERSION:+--has-package-version} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--clean-ignore-rules=$CLEAN_IGNORE_RULES} ${KEEP_ELEMENTS:+--keep-elements=$KEEP_ELEMENTS} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
 
 if [ -z "$NOACT" ]; then
-	java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMCleaner "${CLEAN_ARGS[@]}" $POM $TARGET $POM_PROPS
+	java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMCleaner $DH_OPTS "${CLEAN_ARGS[@]}" $POM $TARGET $POM_PROPS
 fi
 

Modified: trunk/maven-repo-helper/src/main/bin/mh_installjar
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_installjar	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/src/main/bin/mh_installjar	2011-08-27 23:00:20 UTC (rev 14512)
@@ -39,12 +39,15 @@
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
-   echo -e "\t-p<package> --package=<package>: package to act on "
-   echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
+   echo -e "\t-p<package> --package=<package>: name of the Debian package which"
+   echo -e "\t  will contain this jar file"
+   echo -e "\t-e<version>, --set-version=<version>: set the version for the jar,"
    echo -e "\t  do not use the version declared in the POM file."
-   echo -e "\t-r<rules> --rules=<rules>: gives the location of the rules file for"
-   echo -e "\t  special properties. Optional, the default location is"
-   echo -e "\t  debian/maven.rules"
+   echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
+   echo -e "\t  rules to apply when cleaning the POM."
+   echo -e "\t  Optional, the default location is debian/maven.rules"
+   echo -e "\t  Maven rules are used here to extract the groupId, artifactId"
+   echo -e "\t  and version from the POM file."
    echo -e "\t-l --java-lib: Optional, if given it will install the jar into"
    echo -e "\t  /usr/share/java to comply with the Debian Java specification."
    echo -e "\t  The jar will be installed as /usr/share/java/\$name-\$version.jar and"
@@ -63,27 +66,28 @@
    echo -e "\t  The other places where the jar appears, in the repository or in the"
    echo -e "\t  list of links, will be symlinks to this jar."
    echo -e "\t  Defaults to /usr/share/java/\$name-\$version.jar if --java-lib is used,"
-   echo -e "\t  otherwise it goes to the versioned path in the Maven repository."
+   echo -e "\t  otherwise the jar is installed in the versioned path in the Maven repository."
    echo -e "\t-c<classifier> --classifier=<classifier>: Optional, the classifier for"
    echo -e "\t  the jar. Empty by default."
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
    echo -e "\t--skip-clean-pom: don't clean the pom, assume that a previous action ran"
-   echo -e "\t  mh_cleanpom with the correct options."
+   echo -e "\t  mh_cleanpom with the correct options. mh_cleanpom is run only to extract"
+   echo -e "\t  the groupId, artifactId and version of the jar"
    exit 1
 }
 
 # The following elements are options which just need to be ignored: no-parent has-package-version keep-elements ignore-pom
-ARGS="p package r rules l java-lib n usj-name i usj-version s no-usj-versionless d dest-jar c classifier v verbose n no-act skip-clean-pom no-parent has-package-version keep-elements ignore-pom" parseargs "$@"
+ARGS="p package e set-version r rules l java-lib n usj-name i usj-version s no-usj-versionless d dest-jar c classifier v verbose n no-act skip-clean-pom no-parent has-package-version keep-elements ignore-pom" parseargs "$@"
 
 if [ "$ARGC" -lt "2" ]; then
    syntax
 fi
 
+SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
-SETVERSION=$(getarg e set-version)
 JAVALIB=$(getarg l java-lib)
 USJ_JAR_NAME=$(getarg n usj-name)
 NO_USJ_VERSIONLESS=$(getarg s no-usj-versionless)

Modified: trunk/maven-repo-helper/src/main/bin/mh_installpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_installpom	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/src/main/bin/mh_installpom	2011-08-27 23:00:20 UTC (rev 14512)
@@ -32,31 +32,50 @@
    echo -e "debian/\$package.poms and avoids repetition."
    echo -e ""
    echo -e "Where"
-   echo -e "\t[pom] is the location of the POM associated with the jar to install."
+   echo -e "\t[pom] is the location of the POM file to install."
    echo -e "\t  GroupId, artifactId and version will be extracted from this file."
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
-   echo -e "\t-p<package> --package=<package>: package to act on "
+   echo -e "\t-p<package> --package=<package>: name of the Debian package which"
+   echo -e "\t  will contain this POM file"
    echo -e "\t-h --has-package-version: flag that indicates that this POM has the"
    echo -e "\t  same version as the package, this helps packagers of depending packages"
    echo -e "\t-o --no-parent: don't inherit from a parent POM"
-   echo -e "\t--keep-elements=<elem1,elem2>: keep the elements listed here"
-   echo -e "\t  even if they are normally removed by the clean operation."
-   echo -e "\t  Such elements are build,reports,reporting,prerequisites,profiles."
-   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
-   echo -e "\t  a POM's own attributes in debian.mavenRules"
+   echo -e "\t-k --keep-pom-version: keep the original version of the POM but"
+   echo -e "\t  convert all other versions in dependencies and plugins."
+   echo -e "\t  If there is a parent POM, keeps its version except when the parent is already"
+   echo -e "\t  registered in the Maven repository"
    echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
    echo -e "\t  do not use the version declared in the POM file."
-   echo -e "\t-r<rules> --rules=<rules>: gives the location of the rules file for"
-   echo -e "\t  special properties. Optional, the default location is"
-   echo -e "\t  debian/maven.rules"
+   echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
+   echo -e "\t  rules to apply when cleaning the POM."
+   echo -e "\t  Optional, the default location is debian/maven.rules"
    echo -e "\t-u<rules> --published-rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules to publish in the property debian.mavenRules in the cleaned POM"
+   echo -e "\t  extra rules to publish in the property debian.mavenRules in the"
+   echo -e "\t  cleaned POM."
    echo -e "\t  Optional, the default location is debian/maven.publishedRules"
    echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules use to remove certain dependencies from the cleaned POM"
+   echo -e "\t  rules used to remove certain dependencies from the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
+   echo -e "\t-c<rules> --clean-ignore-rules=<rules>: path to the file containing the"
+   echo -e "\t  rules use to remove certain dependencies from the cleaned POM,"
+   echo -e "\t  in addition to the ignore rules specified previously. This is"
+   echo -e "\t  useful in situations such as when the Maven clean target requires more"
+   echo -e "\t  dependencies or plugins to ignore than the build target."
+   echo -e "\t  All rules defined in clean-ignore-rules will be added to the existing"
+   echo -e "\t  rules in ignore-rules."
+   echo -e "\t  Optional, the default location is debian/maven.cleanIgnoreRules"
+   echo -e "\t-s --no-rules: don't apply any rules for converting versions,"
+   echo -e "\t  do not even convert versions to the default 'debian' version"
+   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
+   echo -e "\t  a POM's own attributes in debian.mavenRules"
+   echo -e "\t--keep-elements=<elem1,elem2>: keep the elements listed here"
+   echo -e "\t  even if they are normally removed by the clean operation."
+   echo -e "\t  Such elements are build,reports,reporting,prerequisites,profiles."
+   echo -e "\t-m<repo root>--maven-repo=<repo root>: location of the Maven repository,"
+   echo -e "\t  used to force the versions of the Maven plugins used in the current"
+   echo -e "\t  POM file with the versions found in the repository"
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
    echo -e "\t-ignore-pom: read the POM but don't install it"
@@ -66,29 +85,54 @@
 }
 
 # The following elements are options which just need to be ignored: artifact java-lib usj-name usj-version no-usj-versionless dest-jar classifier
-ARGS="p package o no-parent no-publish-used-rule r rules u published-rules i ignore-rules e set-version v verbose n no-act h has-package-version keep-elements artifact java-lib usj-name usj-version no-usj-versionless dest-jar ignore-pom classifier" parseargs "$@"
+ARGS="p package o no-parent k keep-pom-version e set-version r rules u published-rules i ignore-rules c clean-ignore-rules s no-rules no-publish-used-rule v verbose n no-act m maven-repo h has-package-version keep-elements artifact java-lib usj-name usj-version no-usj-versionless dest-jar ignore-pom classifier" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
 fi
 
 NOPARENT=$(getarg o no-parent)
-NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
+KEEP_POM_VERSION=$(getarg k keep-pom-version)
+SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
 PUBLISHED_RULES=$(getarg u published-rules)
 IGNORE_RULES=$(getarg i ignore-rules)
-SETVERSION=$(getarg e set-version)
+CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
+NORULES=$(getarg s no-rules)
+NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
+MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
+POM="${ARGV[0]}"
+IGNORE_POM=$(getarg ignore-pom)
 HAS_PACKAGE_VERSION=$(getarg h has-package-version)
 KEEP_ELEMENTS=$(getarg keep-elements)
-IGNORE_POM=$(getarg ignore-pom)
-POM="${ARGV[0]}"
 
+if [ -z "$PUBLISHED_RULES" ]; then
+    if [ -f debian/maven.publishedRules ]; then
+        PUBLISHED_RULES="debian/maven.publishedRules"
+    fi
+fi
+if [ -z "$IGNORE_RULES" ]; then
+    if [ -f debian/maven.ignoreRules ]; then
+        IGNORE_RULES="debian/maven.ignoreRules"
+    fi
+fi
+if [ -z "$RULES" ]; then
+    if [ -f debian/maven.rules ]; then
+        RULES="debian/maven.rules"
+    fi
+fi
+if [ -z "$MAVEN_REPO" ]; then
+    if [ -f /usr/share/maven-repo ]; then
+        MAVEN_REPO="/usr/share/maven-repo"
+    fi
+fi
+
 DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
-CLEAN_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${HAS_PACKAGE_VERSION:+--has-package-version} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${KEEP_ELEMENTS:+--keep-elements=$KEEP_ELEMENTS}"
+CLEAN_ARGS="--package=${PACKAGE} ${NOPARENT:+--no-parent} ${NORULES:+--no-rules} ${KEEP_POM_VERSION:+--keep-pom-version} ${HAS_PACKAGE_VERSION:+--has-package-version} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--clean-ignore-rules=$CLEAN_IGNORE_RULES} ${KEEP_ELEMENTS:+--keep-elements=$KEEP_ELEMENTS} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO}"
 
 mkdir -p debian/.mh 2> /dev/null
 

Modified: trunk/maven-repo-helper/src/main/bin/mh_installpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_installpoms	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/src/main/bin/mh_installpoms	2011-08-27 23:00:20 UTC (rev 14512)
@@ -27,20 +27,42 @@
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
-   echo -e "\t-p<package> --package=<package>: package to act on "
-   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
-   echo -e "\t  a POM's own attributes in debian.mavenRules"
+   echo -e "\t-p<package> --package=<package>: name of the Debian package which"
+   echo -e "\t  will contain those POM files"
+   echo -e "\t-k --keep-pom-version: keep the original version of the POM but"
+   echo -e "\t  convert all other versions in dependencies and plugins."
+   echo -e "\t  If there is a parent POM, keeps its version except when the parent is already"
+   echo -e "\t  registered in the Maven repository"
    echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
    echo -e "\t  do not use the version declared in the POM file."
-   echo -e "\t-r<rules> --rules=<rules>: gives the location of the rules file for"
-   echo -e "\t  special properties. Optional, the default location is"
-   echo -e "\t  debian/maven.rules"
+   echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
+   echo -e "\t  rules to apply when cleaning the POM."
+   echo -e "\t  Optional, the default location is debian/maven.rules"
    echo -e "\t-u<rules> --published-rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules to publish in the property debian.mavenRules in the cleaned POM"
+   echo -e "\t  extra rules to publish in the property debian.mavenRules in the"
+   echo -e "\t  cleaned POM."
    echo -e "\t  Optional, the default location is debian/maven.publishedRules"
    echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules use to remove certain dependencies from the cleaned POM"
+   echo -e "\t  rules used to remove certain dependencies from the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
+   echo -e "\t-c<rules> --clean-ignore-rules=<rules>: path to the file containing the"
+   echo -e "\t  rules use to remove certain dependencies from the cleaned POM,"
+   echo -e "\t  in addition to the ignore rules specified previously. This is"
+   echo -e "\t  useful in situations such as when the Maven clean target requires more"
+   echo -e "\t  dependencies or plugins to ignore than the build target."
+   echo -e "\t  All rules defined in clean-ignore-rules will be added to the existing"
+   echo -e "\t  rules in ignore-rules."
+   echo -e "\t  Optional, the default location is debian/maven.cleanIgnoreRules"
+   echo -e "\t-s --no-rules: don't apply any rules for converting versions,"
+   echo -e "\t  do not even convert versions to the default 'debian' version"
+   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
+   echo -e "\t  a POM's own attributes in debian.mavenRules"
+   echo -e "\t--keep-elements=<elem1,elem2>: keep the elements listed here"
+   echo -e "\t  even if they are normally removed by the clean operation."
+   echo -e "\t  Such elements are build,reports,reporting,prerequisites,profiles."
+   echo -e "\t-m<repo root>--maven-repo=<repo root>: location of the Maven repository,"
+   echo -e "\t  used to force the versions of the Maven plugins used in the current"
+   echo -e "\t  POM file with the versions found in the repository"
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
    echo -e ""
@@ -48,32 +70,51 @@
    exit 1
 }
 
-ARGS="p package no-publish-used-rule r rules u published-rules i ignore-rules e set-version v verbose n no-act" parseargs "$@"
+ARGS="p package k keep-pom-version e set-version r rules u published-rules i ignore-rules c clean-ignore-rules s no-rules no-publish-used-rule v verbose n no-act m maven-repo keep-elements" parseargs "$@"
 
+KEEPVERSION=$(getarg k keep-pom-version)
+SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
 PUBLISHED_RULES=$(getarg u published-rules)
 IGNORE_RULES=$(getarg i ignore-rules)
-SETVERSION=$(getarg e set-version)
+CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
+NORULES=$(getarg s no-rules)
+NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
+MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
-PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
-NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
+KEEP_ELEMENTS=$(getarg keep-elements)
 
-DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
-MH_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES}"
+function installpackagepoms()
+{
+  p=$1
 
-if [ -z "$NOACT" ]; then
-    cat debian/$PACKAGE.poms | while read POM OPT1 OPT2 OPT3 OPT4 OPT5 OPT6 OPT7 OPT8 OPT9 OPT10; do
+  DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
+  MH_ARGS="--package=${p} ${VERBOSE:+--verbose} ${NORULES:+--no-rules} ${KEEPVERSION:+--keep-version} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--clean-ignore-rules=$CLEAN_IGNORE_RULES} ${KEEP_ELEMENTS:+--keep-elements=$KEEP_ELEMENTS} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO}"
+
+  if [ -z "$NOACT" ]; then
+    cat debian/$p.poms | while read POM OPT1 OPT2 OPT3 OPT4 OPT5 OPT6 OPT7 OPT8 OPT9 OPT10; do
         # Remove comments
         POM=${POM##\#*}
         if [[ ! -z "$POM" ]]; then
             if [[ ! -z "$VERBOSE" || "$DH_VERBOSE" = "1" ]]; then
-	        echo -e "\tmh_installpom $OPT1 $OPT2 $OPT3 $OPT4 $OPT5 $OPT6 $OPT7 $OPT8 $OPT9 $OPT10 $DH_OPTS $MH_ARGS $POM"
+	        echo -e "\tmh_installpom $DH_OPTS $MH_ARGS $OPT1 $OPT2 $OPT3 $OPT4 $OPT5 $OPT6 $OPT7 $OPT8 $OPT9 $OPT10 $POM"
             fi
             if [[ ! "--ignore" == "$OPT1" ]]; then
-                mh_installpom $OPT1 $OPT2 $OPT3 $OPT4 $OPT5 $OPT6 $OPT7 $OPT8 $OPT9 $OPT10 $DH_OPTS $MH_ARGS $POM
+                mh_installpom $DH_OPTS $MH_ARGS $OPT1 $OPT2 $OPT3 $OPT4 $OPT5 $OPT6 $OPT7 $OPT8 $OPT9 $OPT10 $POM
             fi
         fi
     done
+  fi
+}
+
+if [ -n "$PACKAGE" ]; then
+  installpackagepoms $PACKAGE
+else
+  for p in `findpackages`; do
+    if [ -f debian/$p.poms ]; then
+      installpackagepoms $p
+    fi
+  done
 fi

Modified: trunk/maven-repo-helper/src/main/bin/mh_linkjar
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_linkjar	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/src/main/bin/mh_linkjar	2011-08-27 23:00:20 UTC (rev 14512)
@@ -21,8 +21,9 @@
 syntax()
 {
    echo -e "Usage: mh_linkjar [option]... [pom] [dest_jar] [link]..."
-   echo -e "Create symlinks in package build directories, including links to the jar"
-   echo -e "file in /usr/share/maven-repo, at the correct location for Maven."
+   echo -e "Create symlinks for a jar installed by other means. The symlinks created"
+   echo -e "include links to the jar in /usr/share/maven-repo, at the correct"
+   echo -e "location for Maven."
    echo -e "It can also create additional links to the jar, usually located in"
    echo -e "/usr/share/java."
    echo -e ""
@@ -39,10 +40,15 @@
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
-   echo -e "\t-p<package> --package=<package>: package to act on "
-   echo -e "\t-r<rules> --rules=<rules>: gives the location of the rules file for"
-   echo -e "\t  special properties. Optional, the default location is"
-   echo -e "\t  debian/maven.rules"
+   echo -e "\t-p<package> --package=<package>: name of the Debian package which"
+   echo -e "\t  will contain this jar file"
+   echo -e "\t-e<version>, --set-version=<version>: set the version for the jar,"
+   echo -e "\t  do not use the version declared in the POM file."
+   echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
+   echo -e "\t  rules to apply when cleaning the POM."
+   echo -e "\t  Optional, the default location is debian/maven.rules"
+   echo -e "\t  Maven rules are used here to extract the groupId, artifactId"
+   echo -e "\t  and version from the POM file."
    echo -e "\t-l --java-lib: Optional, if given it will install the jar into"
    echo -e "\t  /usr/share/java to comply with the Debian Java specification."
    echo -e "\t  The jar will be installed as /usr/share/java/\$name-\$version.jar and"
@@ -61,15 +67,19 @@
    echo -e "\t  the jar. Empty by default."
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
+   echo -e "\t--skip-clean-pom: don't clean the pom, assume that a previous action ran"
+   echo -e "\t  mh_cleanpom with the correct options. mh_cleanpom is run only to extract"
+   echo -e "\t  the groupId, artifactId and version of the jar"
    exit 1
 }
 
-ARGS="p package r rules l java-lib n usj-name i usj-version s no-usj-versionless c classifier v verbose n no-act" parseargs "$@"
+ARGS="p package e set-version r rules l java-lib n usj-name i usj-version s no-usj-versionless c classifier v verbose n no-act skip-clean-pom no-parent has-package-version keep-elements ignore-pom" parseargs "$@"
 
 if [ "$ARGC" -lt "2" ]; then
    syntax
 fi
 
+SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
@@ -79,22 +89,30 @@
 CLASSIFIER=$(getarg c classifier)
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
+SKIP_CLEAN_POM=$(getarg skip-clean-pom)
 POM="${ARGV[0]}"
 JAR="${ARGV[1]}"
 
 DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
-CLEAN_ARGS="--package=${PACKAGE} ${RULES:+--rules=$RULES}"
+CLEAN_ARGS="--package=${PACKAGE} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES}"
 
 mkdir -p debian/.mh 2> /dev/null
 
-if [[ ! -z "$VERBOSE" || "$DH_VERBOSE" = "1" ]]; then
-    echo -e "\tmh_cleanpom $DH_OPTS $CLEAN_ARGS $POM debian/.mh/pom.xml debian/.mh/pom.properties"
+if [ -z "$SKIP_CLEAN_POM" ]; then
+    if [[ ! -z "$VERBOSE" || "$DH_VERBOSE" = "1" ]]; then
+        echo -e "\tmh_cleanpom $DH_OPTS $CLEAN_ARGS $POM debian/.mh/pom.xml debian/.mh/pom.properties"
+    fi
+
+    mh_cleanpom $DH_OPTS $CLEAN_ARGS $POM debian/.mh/pom.xml debian/.mh/pom.properties
 fi
 
-mh_cleanpom $DH_OPTS $CLEAN_ARGS $POM debian/.mh/pom.xml debian/.mh/pom.properties
 source debian/.mh/pom.properties
 
 groupPath=$(echo $groupId | tr . / )
+if [ -z "$CLASSIFIER" ]; then
+    # Use the classifier from the POM
+    CLASSIFIER=$classifier
+fi
 
 VERSIONED_JAR_NAME="${artifactId}-${version}.jar"
 if [ ! -z "$CLASSIFIER" ]; then

Added: trunk/maven-repo-helper/src/main/bin/mh_linkjars
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_linkjars	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/bin/mh_linkjars	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,133 @@
+#!/bin/bash --
+
+# Copyright 2011 Ludovic Claude.
+#
+# Licensed 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.
+
+set -e
+
+. /usr/share/maven-repo-helper/mh_lib.sh
+
+syntax()
+{
+   echo -e "Usage: mh_linkjars [option]..."
+   echo -e "Reads the file debian/\$package.poms and create links for each"
+   echo -e "jar file generated by a POM listed in the .poms file."
+   echo -e ""
+   echo -e "Options:"
+   echo -e "\t-h --help: show this text"
+   echo -e "\t-V --version: show the version"
+   echo -e "\t-p<package> --package=<package>: package to act on "
+   echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
+   echo -e "\t  a POM's own attributes in debian.mavenRules"
+   echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
+   echo -e "\t  do not use the version declared in the POM file."
+   echo -e "\t-r<rules> --rules=<rules>: gives the location of the rules file for"
+   echo -e "\t  special properties. Optional, the default location is"
+   echo -e "\t  debian/maven.rules"
+   echo -e "\t-u<rules> --published-rules=<rules>: path to the file containing the"
+   echo -e "\t  extra rules to publish in the property debian.mavenRules in the cleaned POM"
+   echo -e "\t  Optional, the default location is debian/maven.publishedRules"
+   echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
+   echo -e "\t  extra rules use to remove certain dependencies from the cleaned POM"
+   echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
+   echo -e "\t-v --verbose: show more information while running"
+   echo -e "\t-n --no-act: don't actually do anything, just print the results"
+   echo -e ""
+   echo -e "The <package>.poms file should contain the list of POM files associated with the"
+   echo -e "list of jars to install in the repository, and each pom file should have either"
+   echo -e "the option --usj-name, giving the name of the jar (without the extension)"
+   echo -e "to link to and located in /usr/share/java, or the option --artifact, which should"
+   echo -e "contain the full name of the source jar to link to."
+   echo -e ""
+   echo -e "See also: mh_linkjar(1)"
+   exit 1
+}
+
+ARGS="p package no-publish-used-rule r rules u published-rules i ignore-rules e set-version v verbose n no-act skip-clean-poms" parseargs "$@"
+
+RULES=$(getarg r rules)
+PUBLISHED_RULES=$(getarg u published-rules)
+IGNORE_RULES=$(getarg i ignore-rules)
+SETVERSION=$(getarg e set-version)
+PACKAGE=$(getarg p package)
+NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
+VERBOSE=$(getarg v verbose)
+NOACT=$(getarg n no-act)
+SKIP_CLEAN_POMS=$(getarg skip-clean-poms)
+
+function linkpackagejars()
+{
+  p=$1
+
+  DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
+  MH_ARGS="--package=${p} ${VERBOSE:+--verbose} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${SKIP_CLEAN_POMS:+--skip-clean-pom}"
+
+  if [ -z "$NOACT" ]; then
+    cat debian/$p.poms | while read POM OPT1 OPT2 OPT3 OPT4 OPT5 OPT6 OPT7 OPT8 OPT9 OPT10; do
+      # Remove comments
+      POM=${POM##\#*}
+      if [[ -n "$POM" ]]; then
+        POM_DIR=$(dirname $POM)
+        ARTIFACT=
+        C=1
+        _opt=$(eval echo '$OPT'$C)
+        while [ -n "$_opt" ]; do
+          if [ "--usj-name" = "${_opt%%=*}" ]; then
+            export ARTIFACT=/usr/share/java/${_opt##--usj-name=}.jar
+            # Unset the option where we found the artifact
+            eval OPT$C=
+            # shift all following options
+            while [ -n "$_opt" ]; do
+              C1=$(( $C + 1 ))
+              eval OPT$C='$OPT'$C1
+              C=$C1
+              _opt=$(eval echo '$OPT'$C)
+            done
+          elif [ "--artifact" = "${_opt%%=*}" ]; then
+            export ARTIFACT=${_opt##--artifact=}
+            # Unset the option where we found the artifact
+            eval OPT$C=
+            # shift all following options
+            while [ -n "$_opt" ]; do
+              C1=$(( $C + 1 ))
+              eval OPT$C='$OPT'$C1
+              C=$C1
+              _opt=$(eval echo '$OPT'$C)
+            done
+          fi
+          C=$(( $C + 1 ))
+          _opt=$(eval echo '$OPT'$C)
+        done
+        if [[ ! "--ignore" == "$OPT1" ]]; then
+          if [[ -n "$ARTIFACT" ]]; then
+            if [[ ! -z "$VERBOSE" || "$DH_VERBOSE" = "1" ]]; then
+              echo -e "\tmh_linkjar $OPT1 $OPT2 $OPT3 $OPT4 $OPT5 $OPT6 $OPT7 $OPT8 $OPT9 $OPT10 $DH_OPTS $MH_ARGS $POM $ARTIFACT"
+            fi
+            mh_linkjar $OPT1 $OPT2 $OPT3 $OPT4 $OPT5 $OPT6 $OPT7 $OPT8 $OPT9 $OPT10 $DH_OPTS $MH_ARGS $POM $ARTIFACT
+          fi
+        fi
+      fi
+    done
+  fi
+}
+
+if [ -n "$PACKAGE" ]; then
+  linkpackagejars $PACKAGE
+else
+  for p in `findpackages`; do
+    if [ -f debian/$p.poms ]; then
+      linkpackagejars $p
+    fi
+  done
+fi

Modified: trunk/maven-repo-helper/src/main/bin/mh_patchpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_patchpom	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/src/main/bin/mh_patchpom	2011-08-27 23:00:20 UTC (rev 14512)
@@ -31,13 +31,17 @@
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
-   echo -e "\t-p<package> --package=<package>: name of the Debian package containing"
-   echo -e "\t  this library"
+   echo -e "\t-p<package> --package=<package>: name of the Debian package which"
+   echo -e "\t  will contain this POM file"
    echo -e "\t-o --no-parent: don't inherit from a parent POM"
+   echo -e "\t-k --keep-pom-version: keep the original version of the POM but"
+   echo -e "\t  convert all other versions in dependencies and plugins."
+   echo -e "\t  If there is a parent POM, keeps its version except when the parent is already"
+   echo -e "\t  registered in the Maven repository"
    echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
    echo -e "\t  do not use the version declared in the POM file."
    echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules to apply when cleaning the POM."
+   echo -e "\t  rules to apply when cleaning the POM."
    echo -e "\t  Optional, the default location is debian/maven.rules"
    echo -e "\t-R<rule>, --extra-rule=<rule>: extra rule to apply when cleaning the POM"
    echo -e "\t  May occur multiple times, instead of or in addition to -r"
@@ -57,25 +61,26 @@
    echo -e "\t  rules use to remove certain dependencies from the cleaned POM,"
    echo -e "\t  in addition to the ignore rules specified previously. This is"
    echo -e "\t  useful in situations such as when the Maven clean target requires more"
-   echo -e "\t  dependencies or plugins to ignore than the build target"
-   echo -e "\t  Optional, it is ignored by default"
+   echo -e "\t  dependencies or plugins to ignore than the build target."
+   echo -e "\t  All rules defined in clean-ignore-rules will be added to the existing"
+   echo -e "\t  rules in ignore-rules."
+   echo -e "\t  Optional, the default location is debian/maven.cleanIgnoreRules"
    echo -e "\t-s --no-rules: don't apply any rules for converting versions,"
    echo -e "\t  do not even convert versions to the default 'debian' version"
    echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
    echo -e "\t  a POM's own attributes in debian.mavenRules"
-   echo -e "\t-k --keep-pom-version: keep the original version of the POMs but, "
-   echo -e "\t  convert all other versions in dependencies and plugins."
-   echo -e "\t  If there is a parent POM, keeps its version except when the parent is already"
-   echo -e "\t  registered in the Maven repository"
    echo -e "\t-d --debian-build: transform during a Debian build, which means that"
    echo -e "\t  some POM elements will be removed"
-   echo -e "\t-b --build-no-docs: transform during a build where no documentation is generated,"
-   echo -e "\t  which means that some POM elements will be removed"
+   echo -e "\t-b --build-no-docs: if the build doesn't need to build documentation, use this"
+   echo -e "\t  option to remove some POM elements (in particular plugins) which are useless here"
+   echo -e "\t  and may require extra dependencies and make the packaging harder."
    echo -e "\t-m<repo root>--maven-repo=<repo root>: location of the Maven repository,"
    echo -e "\t  used to force the versions of the Maven plugins used in the current"
    echo -e "\t  POM file with the versions found in the repository"
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
+   echo -e ""
+   echo -e "See also: mh_installpom(1), mh_patchpoms(1)"
    exit 1
 }
 
@@ -86,6 +91,7 @@
 fi
 
 NOPARENT=$(getarg o no-parent)
+KEEP_POM_VERSION=$(getarg k keep-pom-version)
 SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
 eval EXTRA_RULES=$(getargs R extra-rule)
@@ -96,7 +102,6 @@
 CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
 NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
-KEEP_POM_VERSION=$(getarg k keep-pom-version)
 MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
@@ -134,8 +139,8 @@
     fi
 fi
 
-DH_OPTS="${VERBOSE:+-v}"
-MH_ARGS=(--package=${PACKAGE} ${NOPARENT:+--no-parent} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
+DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
+MH_ARGS=(--package=${PACKAGE} ${NOPARENT:+--no-parent} ${NORULES:+--no-rules} ${KEEP_POM_VERSION:+--keep-pom-version} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--clean-ignore-rules=$CLEAN_IGNORE_RULES} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
 
 if [ -z "$NOACT" ]; then
 	cp $POM $BACKUP

Modified: trunk/maven-repo-helper/src/main/bin/mh_patchpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2011-08-27 23:00:20 UTC (rev 14512)
@@ -1,5 +1,19 @@
 #!/bin/bash --
 
+# Copyright 2011 Ludovic Claude.
+#
+# Licensed 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.
+
 set -e
 
 . /usr/share/maven-repo-helper/mh_lib.sh
@@ -16,8 +30,14 @@
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
    echo -e "\t-p<package> --package=<package>: package to act on "
+   echo -e "\t-k --keep-pom-version: keep the original version of the POMs but, "
+   echo -e "\t  convert all other versions in dependencies and plugins"
+   echo -e "\t  If there is a parent POM, keeps its version except when the parent is already"
+   echo -e "\t  registered in the Maven repository"
+   echo -e "\t-e<version>, --set-version=<version>: set the version for the POM,"
+   echo -e "\t  do not use the version declared in the POM file."
    echo -e "\t-r<rules> --rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules to apply when cleaning the POM."
+   echo -e "\t  rules to apply when cleaning the POM."
    echo -e "\t  Optional, the default location is debian/maven.rules"
    echo -e "\t-R<rule>, --extra-rule=<rule>: extra rule to apply when cleaning the POM"
    echo -e "\t  May occur multiple times, instead of or in addition to -r"
@@ -37,32 +57,33 @@
    echo -e "\t  rules use to remove certain dependencies from the cleaned POM,"
    echo -e "\t  in addition to the ignore rules specified previously. This is"
    echo -e "\t  useful in situations such as when the Maven clean target requires more"
-   echo -e "\t  dependencies or plugins to ignore than the build target"
-   echo -e "\t  Optional, it is ignored by default"
+   echo -e "\t  dependencies or plugins to ignore than the build target."
+   echo -e "\t  All rules defined in clean-ignore-rules will be added to the existing"
+   echo -e "\t  rules in ignore-rules."
+   echo -e "\t  Optional, the default location is debian/maven.cleanIgnoreRules"
    echo -e "\t-s --no-rules: don't apply any rules for converting versions,"
    echo -e "\t  do not even convert versions to the default 'debian' version"
    echo -e "\t--no-publish-used-rule: don't publish the rule used to transform"
    echo -e "\t  a POM's own attributes in debian.mavenRules"
-   echo -e "\t-k --keep-pom-version: keep the original version of the POMs but, "
-   echo -e "\t  convert all other versions in dependencies and plugins"
-   echo -e "\t  If there is a parent POM, keeps its version except when the parent is already"
-   echo -e "\t  registered in the Maven repository"
    echo -e "\t-d --debian-build: transform during a Debian build, which means that"
    echo -e "\t  some POM elements will be removed"
-   echo -e "\t-b --build-no-docs: transform during a build where no documentation is generated,"
-   echo -e "\t  which means that some POM elements will be removed"
+   echo -e "\t-b --build-no-docs: if the build doesn't need to build documentation, use this"
+   echo -e "\t  option to remove some POM elements (in particular plugins) which are useless here"
+   echo -e "\t  and may require extra dependencies and make the packaging harder."
    echo -e "\t-m<repo root>--maven-repo=<repo root>: location of the Maven repository,"
    echo -e "\t  used to force the versions of the Maven plugins used in the current"
    echo -e "\t  POM file with the versions found in the repository"
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
    echo -e ""
-   echo -e "See also: mh_installpoms(1)"
+   echo -e "See also: mh_installpoms(1), mh_patchpom(1)"
    exit 1
 }
 
-ARGS="p package r rules R extra-rule u published-rules U extra-published-rule i ignore-rules I extra-ignore-rule c clean-ignore-rules s no-rules no-publish-used-rule k keep-pom-version v verbose n no-act d debian-build b build-no-docs m maven-repo" parseargs "$@"
+ARGS="p package keep-pom-version e set-version r rules R extra-rule u published-rules U extra-published-rule i ignore-rules I extra-ignore-rule c clean-ignore-rules s no-rules no-publish-used-rule v verbose n no-act d debian-build b build-no-docs m maven-repo" parseargs "$@"
 
+KEEP_POM_VERSION=$(getarg k keep-pom-version)
+SETVERSION=$(getarg e set-version)
 RULES=$(getarg r rules)
 eval EXTRA_RULES=$(getargs R extra-rule)
 PUBLISHED_RULES=$(getarg u published-rules)
@@ -72,7 +93,6 @@
 CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
 NO_PUBLISH_USED_RULE=$(getarg no-publish-used-rule)
-KEEP_POM_VERSION=$(getarg k keep-pom-version)
 MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
@@ -102,8 +122,8 @@
     fi
 fi
 
-DH_OPTS="${VERBOSE:+-v}"
-MH_ARGS=(--package=${PACKAGE} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
+DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
+MH_ARGS=(--package=${PACKAGE} ${NORULES:+--no-rules} ${KEEP_POM_VERSION:+--keep-pom-version} ${NO_PUBLISH_USED_RULE:+--no-publish-used-rule} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--clean-ignore-rules=$CLEAN_IGNORE_RULES} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO} "${EXTRA_RULES[@]/#/--extra-rule=}" "${EXTRA_PUBLISHED_RULES[@]/#/--extra-published-rule=}" "${EXTRA_IGNORE_RULES[@]/#/--extra-ignore-rule=}")
 
 if [ -z "$NOACT" ]; then
     cat debian/$PACKAGE.poms | while read POM OPT1 OPT2; do

Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/ListOfPOMs.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/ListOfPOMs.java	2011-08-27 19:53:38 UTC (rev 14511)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/ListOfPOMs.java	2011-08-27 23:00:20 UTC (rev 14512)
@@ -234,7 +234,9 @@
                 out.println("# Format of this file is:");
                 out.println("# <path to pom file> [option]*");
                 out.println("# where option can be:");
-                out.println("#   --ignore: ignore this POM or");
+                out.println("#   --ignore: ignore this POM and its artifact if any");
+                out.println("#   --ignore-pom: don't install the POM with mh_install or mh_installpoms. To use with POM files that are created");
+                out.println("#     temporarily for certain artifacts such as Javadoc jars.");
                 out.println("#   --no-parent: remove the <parent> tag from the POM");
                 out.println("#   --package=<package>: an alternative package to use when installing this POM");
                 out.println("#      and its artifact");
@@ -252,8 +254,6 @@
                 out.println("#   --dest-jar=<path>: the destination for the real jar");
                 out.println("#   it will be installed with mh_install.");
                 out.println("#   --classifier=<classifier>: Optional, the classifier for the jar. Empty by default.");
-                out.println("#   --ignore-pom: don't install the POM with mh_install or mh_installpoms. To use with POM files that are created");
-                out.println("#     temporarily for certain artifacts such as Javadoc jars.");
                 out.println("#");
                 for (Iterator i = pomList.iterator(); i.hasNext();) {
                     String pomPath = (String) i.next();

Added: trunk/maven-repo-helper/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven-repo-helper/src/main/resources/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/resources/META-INF/MANIFEST.MF	2011-08-27 23:00:20 UTC (rev 14512)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: stax.jar
+




More information about the pkg-java-commits mailing list