[pkg-java] r8319 - in trunk/maven-repo-helper: . debian src/main/bin src/main/java/org/debian/maven/repo src/main/share src/test/java/org/debian/maven/repo src/test/resources

Ludovic Claude ludovicc-guest at alioth.debian.org
Sun Jun 7 12:53:02 UTC 2009


Author: ludovicc-guest
Date: 2009-06-07 12:53:01 +0000 (Sun, 07 Jun 2009)
New Revision: 8319

Added:
   trunk/maven-repo-helper/debian/maven.rules
   trunk/maven-repo-helper/nb-configuration.xml
   trunk/maven-repo-helper/src/main/bin/mh_checkrepo
   trunk/maven-repo-helper/src/main/bin/mh_patchpoms
   trunk/maven-repo-helper/src/main/bin/mh_unpatchpoms
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRule.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMInfo.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMReader.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Repository.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java
   trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/DependencyRuleTest.java
   trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMReaderTest.java
   trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMTransformerTest.java
   trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/RuleTest.java
   trunk/maven-repo-helper/src/test/resources/commons-validator.cleaned
   trunk/maven-repo-helper/src/test/resources/commons-validator.xml
   trunk/maven-repo-helper/src/test/resources/maven-core.transformed
   trunk/maven-repo-helper/src/test/resources/maven-core.xml
   trunk/maven-repo-helper/src/test/resources/maven.rules
   trunk/maven-repo-helper/src/test/resources/maven.transformed
   trunk/maven-repo-helper/src/test/resources/modello-core.keep.cleaned
   trunk/maven-repo-helper/src/test/resources/modello-core.transformed
   trunk/maven-repo-helper/src/test/resources/plexus-container-default.cleaned
   trunk/maven-repo-helper/src/test/resources/plexus-container-default.transformed
   trunk/maven-repo-helper/src/test/resources/plexus-container-default.xml
   trunk/maven-repo-helper/src/test/resources/slf4j.cleaned
   trunk/maven-repo-helper/src/test/resources/slf4j.xml
   trunk/maven-repo-helper/src/test/resources/wagon-http-lightweight.cleaned
   trunk/maven-repo-helper/src/test/resources/wagon-http-lightweight.xml
Removed:
   trunk/maven-repo-helper/debian/maven-repo-helper.postinst
   trunk/maven-repo-helper/debian/maven-repo-helper.postrm
   trunk/maven-repo-helper/src/main/bin/mh_mavenrepo
   trunk/maven-repo-helper/src/main/bin/mvn-repo
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DebianPOM.java
   trunk/maven-repo-helper/src/main/share/postinst.tmpl
   trunk/maven-repo-helper/src/main/share/postrm.tmpl
   trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/DebianPOMTest.java
   trunk/maven-repo-helper/src/test/resources/empty.pom
   trunk/maven-repo-helper/src/test/resources/maven.spec
   trunk/maven-repo-helper/src/test/resources/new.pom
   trunk/maven-repo-helper/src/test/resources/new2.pom
   trunk/maven-repo-helper/src/test/resources/updated.pom
Modified:
   trunk/maven-repo-helper/debian/build.properties
   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/pom.xml
   trunk/maven-repo-helper/src/main/bin/mh_cleanpom
   trunk/maven-repo-helper/src/main/bin/mh_genrules
   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_lspoms
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java
   trunk/maven-repo-helper/src/main/share/mh_lib.sh
   trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMCleanerTest.java
   trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/TestBase.java
   trunk/maven-repo-helper/src/test/resources/maven.cleaned
   trunk/maven-repo-helper/src/test/resources/modello-core.cleaned
Log:
* New version 0.5, ready for use

Modified: trunk/maven-repo-helper/debian/build.properties
===================================================================
--- trunk/maven-repo-helper/debian/build.properties	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/debian/build.properties	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,2 +1,17 @@
+# Set the default Maven locations.
+# See http://maven.apache.org/ref/current/maven-model/maven.html for nams
+build.sourceDirectory=src/main/java
+build.testSourceDirectory=src/test/java
+
 build.directory=build
 build.outputDirectory=build/classes
+build.testOutputDirectory=build/test-classes
+build.javaVersion=1.4
+javadoc.dir=${build.directory}/javadoc
+classpath.compile=
+classpath.test=
+classpath.full.compile=${build.outputDirectory}:${classpath.compile}
+classpath.full.test=${build.testOutputDirectory}:${classpath.test}:${build.outputDirectory}:${classpath.compile}
+
+maven.test.excludes=
+

Modified: trunk/maven-repo-helper/debian/build.xml
===================================================================
--- trunk/maven-repo-helper/debian/build.xml	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/debian/build.xml	2009-06-07 12:53:01 UTC (rev 8319)
@@ -2,18 +2,93 @@
 
     <property file="debian/build.properties"/>
     <property name="maven.test.skip" value="true"/>
-    <property name="maven.build.xml" value="/usr/share/maven-ant-helper/maven-build.xml"/>
-    <property file="/usr/share/maven-ant-helper/maven-defaults.properties"/>
+    <property name="artifactId" value="maven-repo-helper"/>
 
+    <target name="init">
+        <available property="available.resources" file="src/main/resources"/>
+
+        <fail unless="artifactId" message="Missing required property: artifactId"/>
+        <fail unless="version" message="Missing required property: version"/>
+        <fail unless="basedir" message="Missing required property: basedir"/>
+
+        <echo message="Compile classpath: ${classpath.full.compile}"/>
+        <echo message="Test classpath: ${classpath.full.test}"/>
+    </target>
+
     <target name="clean">
-        <ant target="clean" antfile="${maven.build.xml}" dir="."/>
+        <delete dir="${build.directory}"/>
     </target>
 
-    <target name="package">
-        <ant target="package" antfile="${maven.build.xml}" dir=".">
-            <property name="artifactId" value="${package}"/>
-        </ant>
+    <!--
+     | LIFECYCLE: jar
+     |
+     | This mimics the default Maven build life-cycle: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
+     |-->
+
+     <target name="process-resources" depends="init" if="available.resources">
+        <mkdir dir="${build.outputDirectory}"/>
+        <copy todir="${build.outputDirectory}">
+            <fileset dir="src/main/resources"/>
+        </copy>
+     </target>
+
+    <target name="compile" depends="process-resources">
+        <mkdir dir="${build.outputDirectory}"/>
+        <mkdir dir="${build.directory}/generated-sources"/>
+        <javac
+            destdir="${build.outputDirectory}"
+            classpath="${classpath.compile}"
+            nowarn="true"
+            source="${build.javaVersion}" target="${build.javaVersion}"
+            debug="on">
+            <src path="${build.sourceDirectory}"/>
+            <src path="${build.directory}/generated-sources"/>
+        </javac>
     </target>
 
+    <target name="process-test-resources" depends="compile" unless="maven.test.skip">
+        <mkdir dir="${build.testOutputDirectory}"/>
+        <copy todir="${build.testOutputDirectory}">
+            <fileset dir="src/test/resources"/>
+        </copy>
+     </target>
+
+    <target name="test-compile" depends="process-test-resources" unless="maven.test.skip">
+        <mkdir dir="${build.testOutputDirectory}"/>
+        <javac
+            destdir="${build.testOutputDirectory}"
+            classpath="${classpath.full.test}"
+            nowarn="true"
+            source="${build.javaVersion}" target="${build.javaVersion}"
+            debug="on">
+            <src path="${build.testSourceDirectory}"/>
+        </javac>
+    </target>
+
+    <target name="test" depends="test-compile" unless="maven.test.skip">
+        <mkdir dir="${build.directory}/test-output"/>
+        <junit printsummary="yes" haltonfailure="no"> <!--  fork="yes" forkmode="once" -->
+            <sysproperty key="basedir" value="${basedir}"/>
+            <classpath>
+                <pathelement path="${classpath.full.test}"/>
+            </classpath>
+
+            <formatter type="plain"/>
+            <batchtest todir="${build.directory}/test-output">
+                <fileset dir="${build.testSourceDirectory}">
+                    <include name="**/*Test.java"/>
+                    <exclude name="**/Abstract*"/>
+                    <exclude name="${maven.test.exclude}"/>
+                </fileset>
+            </batchtest>
+        </junit>
+    </target>
+
+    <target name="package" depends="test">
+        <jar jarfile="${build.directory}/${artifactId}-${version}.jar"
+            basedir="${build.outputDirectory}"/>
+    </target>
+
+
 </project>
 

Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/debian/changelog	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,4 +1,4 @@
-maven-repo-helper (0.1) unstable; urgency=low
+maven-repo-helper (0.5) unstable; urgency=low
 
   * Initial release. (Closes: #521947)
 

Modified: trunk/maven-repo-helper/debian/control
===================================================================
--- trunk/maven-repo-helper/debian/control	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/debian/control	2009-06-07 12:53:01 UTC (rev 8319)
@@ -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>
-Build-Depends: debhelper (>= 5), cdbs, default-jdk, ant, maven-ant-helper, help2man
+Build-Depends: debhelper (>= 5), cdbs, default-jdk, ant, help2man
 Standards-Version: 3.8.1
 Vcs-Bzr: lp:~ludovicc/maven-packaging-support/maven-repo-helper
 Vcs-Browser: http://bazaar.launchpad.net/~ludovicc/maven-packaging-support/maven-repo-helper/files

Deleted: trunk/maven-repo-helper/debian/maven-repo-helper.postinst
===================================================================
--- trunk/maven-repo-helper/debian/maven-repo-helper.postinst	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/debian/maven-repo-helper.postinst	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,45 +0,0 @@
-#!/bin/sh -e
-
-DEBIAN_POM="/usr/share/maven-repo/org/debian/debian-parent/1.0-SNAPSHOT/debian-parent-1.0-SNAPSHOT.pom"
-
-LIBRARIES="org.debian.maven.maven-repo-helper.jar.debian 0.1"
-PACKAGE="maven-repo-helper"
-
-if [ ! -f $DEBIAN_POM ]; then
-    mkdir -p $(dirname $DEBIAN_POM)
-    echo "<?xml version="1.0" encoding="UTF-8"?>" > $DEBIAN_POM
-    echo "<project>"  >> $DEBIAN_POM
-    echo "  <groupId>org.debian</groupId>"  >> $DEBIAN_POM
-    echo "  <artifactId>debian-parent</artifactId>"  >> $DEBIAN_POM
-    echo "  <version>1.0-SNAPSHOT</version>"  >> $DEBIAN_POM
-    echo "  <properties>"  >> $DEBIAN_POM
-    echo "  </properties>"  >> $DEBIAN_POM
-    echo "</project>"  >> $DEBIAN_POM
-fi
-
-add_repo_property() {
-    VERSION_PROPERTY=$1
-    LIBVER=$2
-    if [ $(grep "<${VERSION_PROPERTY}\.version>" $DEBIAN_POM) ]; then
-        # Update version
-        cat $DEBIAN_POM | sed "s,<${VERSION_PROPERTY}\.version>.*</,<${VERSION_PROPERTY}.version>$LIBVER</," > pom.tmp
-    else
-        cat $DEBIAN_POM | grep -v "</properties>" | grep -v "</project>" > pom.tmp
-        echo "    <${VERSION_PROPERTY}.package>$PACKAGE</${VERSION_PROPERTY}.package>" >> pom.tmp
-        echo "    <${VERSION_PROPERTY}.version>$LIBVER</${VERSION_PROPERTY}.version>" >> pom.tmp
-        echo "  </properties>"  >> pom.tmp
-        echo "</project>"  >> pom.tmp
-    fi
-    rm $DEBIAN_POM
-    mv pom.tmp $DEBIAN_POM
-}
-
-if [ "$1" = "configure" ]; then
-    echo $LIBRARIES | tr ',' '\n' | while read VERSION_PROPERTY LIBVER; do
-        if [ ! -z "$VERSION_PROPERTY" ]; then
-            add_repo_property $VERSION_PROPERTY $LIBVER
-        fi
-    done
-fi
-
-#DEBHELPER#
\ No newline at end of file

Deleted: trunk/maven-repo-helper/debian/maven-repo-helper.postrm
===================================================================
--- trunk/maven-repo-helper/debian/maven-repo-helper.postrm	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/debian/maven-repo-helper.postrm	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,48 +0,0 @@
-#!/bin/sh -e
-
-DEBIAN_POM="/usr/share/maven-repo/org/debian/debian-parent/1.0-SNAPSHOT/debian-parent-1.0-SNAPSHOT.pom"
-
-LIBRARIES="org.debian.maven.maven-repo-helper.jar.debian 0.1"
-
-remove_repo_property() {
-    VERSION_PROPERTY=$1
-    cat $DEBIAN_POM | grep -v "<$VERSION_PROPERTY" > pom.tmp
-    rm $DEBIAN_POM
-    mv pom.tmp $DEBIAN_POM
-}
-
-properties_start_tag_line() {
-    grep -n "<properties>" $DEBIAN_POM | cut -d':' -f1
-}
-
-properties_end_tag_line() {
-    grep -n "</properties>" $DEBIAN_POM | cut -d':' -f1
-}
-
-case "$1" in
-  remove|purge)
-    echo $LIBRARIES | tr ',' '\n' | while read VERSION_PROPERTY LIBVER; do
-        if [ ! -z "$VERSION_PROPERTY" ]; then
-            remove_repo_property $VERSION_PROPERTY
-        fi
-    done
-    # Detect if DEBIAN_POM is empty
-    TAG_START=$(properties_start_tag_line)
-    TAG_END=$(properties_end_tag_line)
-    if [ $(($TAG_START+1)) -eq $TAG_END ]; then
-        rm $DEBIAN_POM
-        rmdir --ignore-fail-on-non-empty -p $(dirname $DEBIAN_POM)
-    fi
-    ;;
-
-  upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-    # Nothing to do here
-    ;;
-
-  *)
-    echo "$0 called with unknown argument \`$1'" >&2
-    exit 1
-  ;;
-esac
-
-#DEBHELPER#
\ No newline at end of file

Added: trunk/maven-repo-helper/debian/maven.rules
===================================================================
--- trunk/maven-repo-helper/debian/maven.rules	                        (rev 0)
+++ trunk/maven-repo-helper/debian/maven.rules	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1 @@
+junit junit jar s/3\..*/3.x/

Modified: trunk/maven-repo-helper/debian/rules
===================================================================
--- trunk/maven-repo-helper/debian/rules	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/debian/rules	2009-06-07 12:53:01 UTC (rev 8319)
@@ -24,27 +24,22 @@
 	chmod +x $@
 debian/tmp/doc/mh_%.1 : debian/tmp/mh_% 
 	mkdir -p debian/tmp/doc
-	-grep -q '^#!/bin/bash' $< && help2man -N -o $@ $<
-	-grep -q '^#!/usr/bin/perl' $< && pod2man $< > $@
+	help2man -N -o $@ $<
 man-pages: $(MAN_PAGES)
 build/$(PACKAGE):: man-pages
 
 binary-post-install/$(PACKAGE)::
-	dh_install -p$(PACKAGE) build/$(PACKAGE)-$(VERSION).jar /usr/share/maven-repo/org/debian/maven/$(PACKAGE)/$(VERSION)
+	mv build/$(PACKAGE)-$(VERSION).jar build/$(PACKAGE)-debian.jar
+	dh_install -p$(PACKAGE) build/$(PACKAGE)-debian.jar /usr/share/maven-repo/org/debian/maven/$(PACKAGE)/debian
 	dh_install -p$(PACKAGE) src/main/bin /usr
 	dh_install -p$(PACKAGE) src/main/share/* /usr/share/$(PACKAGE)
-	dh_link -p$(PACKAGE) /usr/share/maven-repo/org/debian/maven/$(PACKAGE)/$(VERSION)/$(PACKAGE)-$(VERSION).jar /usr/share/java/$(PACKAGE).jar
-	dh_link -p$(PACKAGE) /usr/share/$(PACKAGE)/postinst.tmpl /usr/share/debhelper/autoscripts/postinst-maven-repo
-	dh_link -p$(PACKAGE) /usr/share/$(PACKAGE)/postrm.tmpl /usr/share/debhelper/autoscripts/postrm-maven-repo
+	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/tmp
-	java -cp build/$(PACKAGE)-$(VERSION).jar org.debian.maven.repo.POMCleaner --debian-parent pom.xml debian/tmp/$(PACKAGE)-$(VERSION).pom debian/tmp/pom.properties debian/tmp/versions.properties
-	dh_install -p$(PACKAGE) --sourcedir=debian/tmp $(PACKAGE)-$(VERSION).pom \
-		usr/share/maven-repo/org/debian/maven/$(PACKAGE)/$(VERSION)
+	java -cp build/$(PACKAGE)-debian.jar org.debian.maven.repo.POMCleaner --debian-parent pom.xml debian/tmp/$(PACKAGE)-debian.pom debian/tmp/pom.properties 
+	dh_install -p$(PACKAGE) --sourcedir=debian/tmp $(PACKAGE)-debian.pom \
+		usr/share/maven-repo/org/debian/maven/$(PACKAGE)/debian
 
 clean::
 	-rm -r debian/tmp
 
-$(SCRIPTS):
-	help2man $(basename )
-	

Added: trunk/maven-repo-helper/nb-configuration.xml
===================================================================
--- trunk/maven-repo-helper/nb-configuration.xml	                        (rev 0)
+++ trunk/maven-repo-helper/nb-configuration.xml	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-shared-configuration>
+    <!--
+This file contains additional configuration written by modules in the NetBeans IDE.
+The configuration is intended to be shared among all the users of project and
+therefore it is assumed to be part of version control checkout.
+Without this configuration present, some functionality in the IDE may be limited or fail altogether.
+-->
+    <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
+        <!--
+Properties that influence various parts of the IDE, especially code formatting and the like. 
+You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
+That way multiple projects can share the same settings (useful for formatting rules for example).
+Any value defined here will override the pom.xml file value but is only applicable to the current project.
+-->
+        <org-netbeans-modules-editor-indent.CodeStyle.usedProfile>default</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>8</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>
+        <org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>80</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>
+    </properties>
+</project-shared-configuration>

Modified: trunk/maven-repo-helper/pom.xml
===================================================================
--- trunk/maven-repo-helper/pom.xml	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/pom.xml	2009-06-07 12:53:01 UTC (rev 8319)
@@ -5,10 +5,8 @@
     <artifactId>maven-repo-helper</artifactId>
     <name>Maven Repo helper</name>
     <packaging>jar</packaging>
-    <version>0.1</version>
-    <description>
-        Provides support for managing the Maven repository in a Debian distribution.
-    </description>
+    <version>0.5</version>
+    <description>Provides support for managing the Maven repository in a Debian distribution.</description>
 
     <inceptionYear>2009</inceptionYear>
     <url>https://code.launchpad.net/maven-packaging-support/</url>
@@ -45,8 +43,8 @@
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
+                    <source>1.4</source>
+                    <target>1.4</target>
                 </configuration>
             </plugin>
             <plugin>
@@ -64,7 +62,7 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.4</version>
+            <version>3.8.2</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -79,6 +77,12 @@
             <version>1.4</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+  <groupId>org.testng</groupId>
+  <artifactId>testng</artifactId>
+  <version>5.7</version>
+  <classifier>jdk15</classifier>
+</dependency>
     </dependencies>
 
 </project>

Added: trunk/maven-repo-helper/src/main/bin/mh_checkrepo
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_checkrepo	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/bin/mh_checkrepo	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,33 @@
+#!/bin/bash --
+
+set -e
+
+. /usr/share/maven-repo-helper/mh_lib.sh
+
+syntax()
+{
+   echo -e "Usage: mh_checkrepo <location>"
+   echo -e "Checks the Maven repository for consistency and prints a report."
+   echo -e ""
+   echo -e "Where"
+   echo -e "\t<location> is the location of the Maven repository."
+   echo -e "\t  Default to /usr/share/maven-repo"
+   echo -e ""
+   echo -e "Options:"
+   echo -e "\t-h --help: show this text"
+   echo -e "\t-V --version: show the version"
+   echo -e "\t-v --verbose: show more information while running"
+   exit 1
+}
+
+ARGS="v verbose n" parseargs "$@"
+
+VERBOSE=$(getarg v verbose)
+
+if [ "$ARGC" -gt "0" ]; then
+	REPO="${ARGV[0]}"
+else
+	REPO="/usr/share/maven-repo"
+fi
+
+java -cp /usr/share/java/maven-repo-helper.jar org.debian.maven.repo.Repository $REPO

Modified: trunk/maven-repo-helper/src/main/bin/mh_cleanpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2009-06-07 12:53:01 UTC (rev 8319)
@@ -4,7 +4,7 @@
 
 syntax()
 {
-   echo -e "Usage: mh_cleanpom [option]... [pom] [target] [pom-props] [versions-props]"
+   echo -e "Usage: mh_cleanpom [option]... [pom] [target] [pom-props]"
    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 ""
@@ -15,36 +15,100 @@
    echo -e "\t  Default to debian/tmp/pom.xml"
    echo -e "\t[pom-props] is where the POM properties file will be written."
    echo -e "\t  Default to debian/tmp/pom.properties"
-   echo -e "\t[versions-props] is where the versions properties file will be written."
-   echo -e "\t  Default to debian/tmp/versions.properties"
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
-   echo -e "\t-d --debian-parent: force the cleaned POM to inherit from"
-   echo -e "\t  org.debian:debian-parent:1.0-SNAPSHOT"
-   echo -e "\t-s<spec> --spec=<spec>: gives the location of the Maven spec file for"
-   echo -e "\t  special properties. Optional, the default location is"
-   echo -e "\t  debian/maven.spec"
+   echo -e "\t-p<package> --package=<package>: name of the Debian package containing"
+   echo -e "\t  this library"
+   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-all-elements: keep all elements in the POM, do a version"
+   echo -e "\t  transformation only, don't delete the build and other elements."
+   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  Optional, the default location is debian/maven.rules"
+   echo -e "\t-i<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-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-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 "Description:"
+   echo -e "\tCleans a Maven POM and prepare it for inclusion in the Debian"
+   echo -e "\trepository for Maven."
+   echo -e ""
+   echo -e "\tThe POM will be normalised, and its parent tag removed if the option"
+   echo -e "\t--no-parent is given. The version will be replaced by 'debian', unless"
+   echo -e "\ta special rule applies (see below the discussion about rules)."
+   echo -e "\tBuild, profiles and other build time only sections of the POM"
+   echo -e "\twill be stripped."
+   echo -e ""
+   echo -e "\tIf versions are given for a dependency, this version will be"
+   echo -e "\treplaced by the 'debian' version, or a rule can be given to"
+   echo -e "\tuse a custom version"
+   echo -e ""
+   echo -e "\tYou can modify those defaults with the help of the"
+   echo -e "\trules file. This file should contain the lines with the format:"
+   echo -e "\t<groupId> [artifactId] [type] [version]"
+   echo -e "\twhere groupId, artifactId, type and version can be the explicit attribute to"
+   echo -e "\tmatch, or can contain a wildcard (*) for generic matches."
+   echo -e ""
+   echo -e "\tEach one of those elements can also be a replace rule, of the form"
+   echo -e "\ts/<regex>/<replace>/ where regex is a regular expression, and replace"
+   echo -e "\tis the replacement. Substitution groups $1 $2... can be used in the"
+   echo -e "\treplacement if capture groups () have been used in the regex."
+   echo -e ""
+   echo -e "\tThe first element is mandatory (groupId), but you can ignore the following"
+   echo -e "\telements."
+   echo -e "\tIf the version is missing, then any version will be replaced with 'debian'."
+   echo -e "\tIf type is missing, then any type is matched."
+   echo -e "\tIf artifactId is missing, then any artifactId is matched."
+   echo -e ""
+   echo -e "\tYou can also have comments in this file, it should be a line starting with #"
+   echo -e ""
+   echo -e "Example of a rules file:"
+   echo -e ""
+   echo -e "\ts/commons-(.*)/org.apache.commons.commons$1/"
+   echo -e "\torg.itext * * s/1\\..*/1.x/"
+   echo -e "\torg.itext * * s/2\\..*/2.x/"
+   echo -e "\torg.codehaus.plexus plexus-container-default jar s/1\\.0-alpha-.*/1.0-alpha/"
+   echo -e ""
+   echo -e "\tThis rules file does the following:"
+   echo -e "\t- all groupIds starting with commons- will have org.apache.commons. prefixed to them"
+   echo -e "\t- any artifact in the org.itext group with a version number starting with 1. will"
+   echo -e "\t  use the 1.x version"
+   echo -e "\t- any artifact in the org.itext group with a version number starting with 2. will"
+   echo -e "\t  use the 2.x version"
+   echo -e "\t- the jar with groupId=org.codehaus.plexus and artifactId=plexus-container-default and a"
+   echo -e "\t  version starting with 1.0-alpha- will use the 1.0-alpha version"
+   echo -e ""
+   echo -e "\tThe default rule (* * * s/.*/debian/) replaces any version number with"
+   echo -e "\tthe 'debian' version and always applies last if there was no other matches."
+   echo -e "\tAnother default rule (* * maven-plugin *) keep the version for all plugins"
+   echo -e "\tas the plugin mechanism requires a version in Maven."
    exit 1
 }
 
-ARGS="d debian-parent s spec v verbose n no-act" parseargs "$@"
+ARGS="p package o no-parent k keep-pom-version r rules i published-rules v verbose n no-act" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
 fi
 
-DEBIANPARENT=$(getarg d debian-parent)
-SPEC=$(getarg s spec)
-SPEC=${SPEC:-debian/maven.spec}
+NOPARENT=$(getarg o no-parent)
+KEEPVERSION=$(getarg k keep-pom-version)
+RULES=$(getarg r rules)
+PUBLISHED_RULES=$(getarg i published-rules)
+PACKAGE=$(getarg p package)
+PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
 POM="${ARGV[0]}"
 TARGET="${ARGV[1]:-debian/tmp/pom.xml}"
 POM_PROPS="${ARGV[2]:-debian/tmp/pom.properties}"
-VERSIONS_PROPS="${ARGV[3]:-debian/tmp/versions.properties}"
 
 if [ -z "$POM" ]; then
     if [ -f debian/pom.xml ]; then
@@ -53,10 +117,21 @@
         POM="pom.xml"
     fi
 fi
+if [ -z "$PUBLISHED_RULES" ]; then
+    if [ -f debian/maven.publishedRules ]; then
+        RULES="debian/maven.publishedRules"
+    fi
+fi
 
-CLEAN_ARGS="${VERBOSE:+--verbose} ${DEBIANPARENT:+--debian-parent}"
+if [ -z "$RULES" ]; then
+    if [ -f debian/maven.rules ]; then
+        RULES="debian/maven.rules"
+    fi
+fi
 
+CLEAN_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${KEEPVERSION:+--keep-pom-version} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES}"
+
 if [ -z "$NOACT" ]; then
-    java -cp /usr/share/java/maven-repo-helper.jar org.debian.maven.repo.POMCleaner $CLEAN_ARGS $POM $TARGET $POM_PROPS $VERSIONS_PROPS $SPEC
+    java -cp /usr/share/java/maven-repo-helper.jar org.debian.maven.repo.POMCleaner $CLEAN_ARGS $POM $TARGET $POM_PROPS
 fi
 

Modified: trunk/maven-repo-helper/src/main/bin/mh_genrules
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_genrules	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/bin/mh_genrules	2009-06-07 12:53:01 UTC (rev 8319)
@@ -4,13 +4,13 @@
 
 syntax()
 {
-   echo -e "Usage: mh_genrules [option]... [package]"
+   echo -e "Usage: mh_genrules [option]... <package>"
    echo -e "Generate the rules file, at least partially."
-   echo -e "Also extracts some information from the POM."
    echo -e ""
    echo -e "Where"
-   echo -e "\t[package] is the name of the binary package,"
-   echo -e "\t  e.g. libcommons-lang-java"
+   echo -e "\t<package> is the name of the binary package,"
+   echo -e "\t  e.g. libcommons-lang-java. Default to the first binary"
+   echo -e "\t  found in the debian/control file"
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
@@ -20,26 +20,14 @@
 
 ARGS="a use-ant" parseargs "$@"
 
-if [ "$ARGC" -lt "1" ]; then
-   syntax
+if [ "$ARGC" -gt "0" ]; then
+	PACKAGE="${ARGV[0]}"
+else
+	PACKAGE=$(dh_listpackages | head -1)
 fi
 
-PACKAGE="${ARGV[0]}"
-
-VERSION_PROPERTIES_FILE="debian/tmp/versions.properties"
-
 mh_lspoms $PACKAGE > /dev/null
 
-# Automatic execution of mh_cleanpom to fill versions.properties
-if [ ! -f "$VERSION_PROPERTIES_FILE" ]; then
-    cat debian/$PACKAGE.poms | while read POM OPTS; do
-        if [ ! -z "$POM" ]; then
-            echo "mh_cleanpom $POM"
-            mh_cleanpom $OPTS $POM
-        fi
-    done
-fi
-
 BIN_PACKAGE="\$(PACKAGE)"
 SOURCE=$(dpkg-parsechangelog | egrep '^Source:' | cut -f2 -d' ')
 if [ "lib$SOURCE-java" = "$PACKAGE" ]; then
@@ -56,8 +44,8 @@
         echo "include /usr/share/cdbs/1/class/ant.mk"
     fi
     echo ""
-    echo "PACKAGE			   := \$(DEB_SOURCE_PACKAGE)"
-    echo "VERSION			   := \$(DEB_UPSTREAM_VERSION)"
+    echo "PACKAGE              := \$(DEB_SOURCE_PACKAGE)"
+    echo "VERSION              := \$(DEB_UPSTREAM_VERSION)"
     echo "JAVA_HOME            := /usr/lib/jvm/default-java"
     if $USE_ANT ; then
         echo "DEB_JARS             := # TODO - fill the list of jars"
@@ -69,9 +57,6 @@
     echo "binary-post-install/$BIN_PACKAGE::"
     echo -e "\tmh_installpoms -p$BIN_PACKAGE"
 
-    if [ -f debian/tmp/pom.properties ]; then
-        source debian/tmp/pom.properties
-    fi
     cat debian/$PACKAGE.poms | while read POM OPTS; do
         if [[ "$POM" = "pom.xml" || "$POM" = "debian/pom.xml" ]]; then
             grep "<packaging>\s*pom" $POM > /dev/null
@@ -87,9 +72,6 @@
         fi
     done
     echo ""
-    echo "binary-fixup/$BIN_PACKAGE::"
-    echo -e "\tmh_mavenrepo"
-    echo ""
     echo "clean::"
     echo -e "\t-rm -rf debian/tmp"
 }

Modified: trunk/maven-repo-helper/src/main/bin/mh_installjar
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_installjar	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/bin/mh_installjar	2009-06-07 12:53:01 UTC (rev 8319)
@@ -26,67 +26,125 @@
    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-s<spec> --spec=<spec>: gives the location of the Maven spec file for"
+   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.spec"
+   echo -e "\t  debian/maven.rules"
    echo -e "\t-l --java-lib: Optional, if given it will create additional links into "
    echo -e "\t  /usr/share/java to comply with the Java specification. More precisely,"
    echo -e "\t  the links created will be /usr/share/java/$name-$version.jar and"
    echo -e "\t  /usr/share/java/$name.jar"
-   echo -e "\t-n<name> --name=<name>: Optional, the name to use when installing the"
+   echo -e "\t-n<name> --usj-name=<name>: Optional, the name to use when installing the"
    echo -e "\t  library in /usr/share/java when --java-lib is used."
    echo -e "\t  Defaults to the artifact id found in the POM."
-   echo -e "\t-r<version> --version=<version>: Optional, the version to use when"
+   echo -e "\t-i<version> --usj-version=<version>: Optional, the version to use when"
    echo -e "\t  installing the library in /usr/share/java when --java-lib is used."
    echo -e "\t  Defaults to the version found in the POM."
+   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"
    exit 1
 }
 
-ARGS="s spec l java-lib n name r version v verbose n no-act" parseargs "$@"
+ARGS="p package r rules l java-lib n usj-name i usj-version c classifier v verbose n no-act" parseargs "$@"
 
 if [ "$ARGC" -lt "2" ]; then
    syntax
 fi
 
-SPEC=$(getarg s spec)
-SPEC=${SPEC:-debian/maven.spec}
+RULES=$(getarg r rules)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
 JAVALIB=$(getarg l java-lib)
 NAME=$(getarg l java-lib)
+CLASSIFIER=$(getarg c classifier)
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
 POM="${ARGV[0]}"
 JAR="${ARGV[1]}"
 
 DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
+CLEAN_ARGS="--package=${PACKAGE} ${RULES:+--rules=$RULES}"
 
 mkdir -p debian/tmp 2> /dev/null
-mh_cleanpom $CLEAN_ARGS $POM debian/tmp/pom.xml debian/tmp/pom.properties debian/tmp/notused.properties $SPEC
+
+if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+    echo -e "\tmh_cleanpom $DH_OPTS $CLEAN_ARGS $POM debian/tmp/pom.xml debian/tmp/pom.properties"
+fi
+
+mh_cleanpom $DH_OPTS $CLEAN_ARGS $POM debian/tmp/pom.xml debian/tmp/pom.properties
 source debian/tmp/pom.properties
 
-GROUP_PATH=$(echo $GROUP_ID | tr . / )
+groupPath=$(echo $groupId | tr . / )
 
+if [ ! -e $JAR ]; then
+    echo "Cannot find the jar to install: $JAR"
+    exit 2
+fi
+
+VERSIONED_JAR_NAME="${artifactId}-${version}.jar"
+if [ ! -z "$CLASSIFIER" ]; then
+    VERSIONED_JAR_NAME="${artifactId}-${version}-${CLASSIFIER}.jar"
+fi
+
 # Install the jar in the Maven repository
-cp $JAR debian/tmp/${ARTIFACT_ID}-${VERSION}.jar
-dh_install $DH_OPTS -p${PACKAGE} --sourcedir=debian/tmp ${ARTIFACT_ID}-${VERSION}.jar \
-	usr/share/maven-repo/${GROUP_PATH}/${ARTIFACT_ID}/${VERSION}
+if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+    echo -e "\tcp $JAR debian/tmp/${VERSIONED_JAR_NAME}"
+fi
 
+cp $JAR debian/tmp/${VERSIONED_JAR_NAME}
+
+if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+    echo -e "\tdh_install $DH_OPTS -p${PACKAGE} --sourcedir=debian/tmp ${VERSIONED_JAR_NAME} usr/share/maven-repo/${groupPath}/${artifactId}/${version}"
+fi
+
+dh_install $DH_OPTS -p${PACKAGE} --sourcedir=debian/tmp ${VERSIONED_JAR_NAME} \
+	usr/share/maven-repo/${groupPath}/${artifactId}/${version}
+
+if [[ "${version}" != "${debianVersion}" ]]; then
+
+    DEBIAN_JAR_NAME="${artifactId}-${debianVersion}.jar"
+    if [ ! -z "$CLASSIFIER" ]; then
+        DEBIAN_JAR_NAME="${artifactId}-${debianVersion}-${CLASSIFIER}.jar"
+    fi
+
+    if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+        echo -e "\tdh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${groupPath}/${artifactId}/${version}/${VERSIONED_JAR_NAME} usr/share/maven-repo/${groupPath}/${artifactId}/${debianVersion}/${DEBIAN_JAR_NAME}"
+    fi
+
+    dh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${groupPath}/${artifactId}/${version}/${VERSIONED_JAR_NAME} \
+        usr/share/maven-repo/${groupPath}/${artifactId}/${debianVersion}/${DEBIAN_JAR_NAME}
+
+fi
+
 # Create the additional links
 for (( i=2; i < $ARGC; i++ )); do
     LINK_JAR="${ARGV[i]}"
-	dh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${GROUP_PATH}/${ARTIFACT_ID}/${VERSION}/${ARTIFACT_ID}-${VERSION}.jar \
+
+    if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+        echo -e "\tdh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${groupPath}/${artifactId}/${version}/${VERSIONED_JAR_NAME} $LINK_JAR;"
+    fi
+
+    dh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${groupPath}/${artifactId}/${version}/${VERSIONED_JAR_NAME} \
         $LINK_JAR;
 done
 if [ -n "$JAVALIB" ]; then
-    JAR_NAME=$(getarg n name)
-    JAR_NAME=${JAR_NAME:-$ARTIFACT_ID}
-    JAR_VERSION=$(getarg r version)
-    JAR_VERSION=${JAR_VERSION:-$VERSION}
-	dh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${GROUP_PATH}/${ARTIFACT_ID}/${VERSION}/${ARTIFACT_ID}-${VERSION}.jar \
+    JAR_NAME=$(getarg n usj-name)
+    JAR_NAME=${JAR_NAME:-$artifactId}
+    JAR_VERSION=$(getarg i usj-version)
+    JAR_VERSION=${JAR_VERSION:-$version}
+
+    if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+        echo -e "\tdh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${groupPath}/${artifactId}/${version}/${VERSIONED_JAR_NAME} usr/share/java/$JAR_NAME.jar;"
+    fi
+
+    dh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${groupPath}/${artifactId}/${version}/${VERSIONED_JAR_NAME} \
         usr/share/java/$JAR_NAME.jar;
-	dh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${GROUP_PATH}/${ARTIFACT_ID}/${VERSION}/${ARTIFACT_ID}-${VERSION}.jar \
+
+    if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+        echo -e "\tdh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${groupPath}/${artifactId}/${version}/${VERSIONED_JAR_NAME} usr/share/java/$JAR_NAME-$JAR_VERSION.jar;"
+    fi
+
+    dh_link $DH_OPTS -p${PACKAGE} usr/share/maven-repo/${groupPath}/${artifactId}/${version}/${VERSIONED_JAR_NAME} \
         usr/share/java/$JAR_NAME-$JAR_VERSION.jar;
 fi

Modified: trunk/maven-repo-helper/src/main/bin/mh_installpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_installpom	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/bin/mh_installpom	2009-06-07 12:53:01 UTC (rev 8319)
@@ -11,7 +11,7 @@
    echo -e "Maven."
    echo -e "Before installing the POM, it prepares it with mh_cleanpom."
    echo -e ""
-   echo -e "debian/maven.spec is used to alter the version properties for the library and"
+   echo -e "debian/maven.rules is used to alter the version properties for the library and"
    echo -e "its dependencies."
    echo -e ""
    echo -e "Prefer to use mh_installpoms as it reuses the information in"
@@ -24,39 +24,63 @@
    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-d --debian-parent: force the cleaned POM to inherit from"
-   echo -e "\t  org.debian:debian-parent:1.0-SNAPSHOT"
-   echo -e "\t-s<spec> --spec=<spec>: gives the location of the Maven spec file for"
+   echo -e "\t-o --no-parent: don't inherit from a parent POM"
+   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.spec"
+   echo -e "\t  debian/maven.rules"
    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"
    exit 1
 }
 
-ARGS="p package d debian-parent s spec v verbose n no-act" parseargs "$@"
+ARGS="p package o no-parent r rules v verbose n no-act" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
 fi
 
-DEBIANPARENT=$(getarg d debian-parent)
-SPEC=$(getarg s spec)
-SPEC=${SPEC:-debian/maven.spec}
+NOPARENT=$(getarg o no-parent)
+RULES=$(getarg r rules)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
 POM="${ARGV[0]}"
 
-CLEAN_ARGS="${DEBIANPARENT:+--debian-parent}"
 DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
+CLEAN_ARGS="--package=${PACKAGE} ${NOPARENT:+--no-parent} ${RULES:+--rules=$RULES}"
 
 mkdir -p debian/tmp 2> /dev/null
-mh_cleanpom $DH_OPTS $CLEAN_ARGS --spec=$SPEC $POM debian/tmp/pom.xml debian/tmp/pom.properties debian/tmp/versions.properties
+
+if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+    echo -e "\tmh_cleanpom $DH_OPTS $CLEAN_ARGS $POM debian/tmp/pom.xml debian/tmp/pom.properties"
+fi
+
+mh_cleanpom $DH_OPTS $CLEAN_ARGS --keep-pom-version $POM debian/tmp/pom.xml.keep debian/tmp/pom.properties.keep
+mh_cleanpom $DH_OPTS $CLEAN_ARGS $POM debian/tmp/pom.xml debian/tmp/pom.properties
 source debian/tmp/pom.properties
 
-GROUP_PATH=$(echo $GROUP_ID | tr . / )
-mv debian/tmp/pom.xml debian/tmp/${ARTIFACT_ID}-${VERSION}.pom
-dh_install $DH_OPTS -p${PACKAGE} --sourcedir=debian/tmp ${ARTIFACT_ID}-${VERSION}.pom \
-	usr/share/maven-repo/${GROUP_PATH}/${ARTIFACT_ID}/${VERSION}
+groupPath=$(echo $groupId | tr . / )
+
+if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+    echo -e "\tmv debian/tmp/pom.xml debian/tmp/${artifactId}-${debianVersion}.pom"
+fi
+
+mv debian/tmp/pom.xml.keep debian/tmp/${artifactId}-${version}.pom
+mv debian/tmp/pom.xml debian/tmp/${artifactId}-${debianVersion}.pom
+
+if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+    echo -e "\tdh_install $DH_OPTS -p${PACKAGE} --sourcedir=debian/tmp ${artifactId}-${version}.pom usr/share/maven-repo/${groupPath}/${artifactId}/${version}"
+fi
+
+dh_install $DH_OPTS -p${PACKAGE} --sourcedir=debian/tmp ${artifactId}-${version}.pom \
+	usr/share/maven-repo/${groupPath}/${artifactId}/${version}
+
+if [[ "${version}" != "${debianVersion}" ]]; then
+    if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+        echo -e "\tdh_install $DH_OPTS -p${PACKAGE} --sourcedir=debian/tmp ${artifactId}-${debianVersion}.pom usr/share/maven-repo/${groupPath}/${artifactId}/${debianVersion}"
+    fi
+
+    dh_install $DH_OPTS -p${PACKAGE} --sourcedir=debian/tmp ${artifactId}-${debianVersion}.pom \
+        usr/share/maven-repo/${groupPath}/${artifactId}/${debianVersion}
+fi

Modified: trunk/maven-repo-helper/src/main/bin/mh_installpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_installpoms	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/bin/mh_installpoms	2009-06-07 12:53:01 UTC (rev 8319)
@@ -14,27 +14,30 @@
    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-s<spec> --spec=<spec>: gives the location of the Maven spec file for"
+   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.spec"
+   echo -e "\t  debian/maven.rules"
    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"
    exit 1
 }
 
-ARGS="p package s spec v verbose n no-act" parseargs "$@"
+ARGS="p package r rules v verbose n no-act" parseargs "$@"
 
-SPEC=$(getarg s spec)
-SPEC=${SPEC:-debian/maven.spec}
+RULES=$(getarg r rules)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
 
 DH_OPTS="${VERBOSE:+-v} ${NOACT:+-n}"
+MH_ARGS="--package=${PACKAGE} ${NOPARENT:+--no-parent} ${RULES:+--rules=$RULES}"
 
-cat debian/$PACKAGE.poms | while read POM OPTS; do
+cat debian/$PACKAGE.poms | while read POM OPT1 OPT2; do
     if [ ! -z "$POM" ]; then
-        mh_installpom $DH_OPTS $OPTS -p$PACKAGE --spec=$SPEC $POM
+        if [[ ! -z "$VERBOSE" || "$DH_VERBOSE"="1" ]]; then
+	        echo -e "\tmh_installpom $DH_OPTS $MH_OPTS $OPT1 $OPT2 $POM"
+		fi
+        mh_installpom $DH_OPTS $MH_OPTS $OPT1 $OPT2 $POM
     fi
 done

Modified: trunk/maven-repo-helper/src/main/bin/mh_lspoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_lspoms	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/bin/mh_lspoms	2009-06-07 12:53:01 UTC (rev 8319)
@@ -4,45 +4,44 @@
 
 syntax()
 {
-   echo -e "Usage: mh_lspoms [option]... [package]"
+   echo -e "Usage: mh_lspoms [option]... <package>"
    echo -e "Looks for all POM files defined in the source of the project."
    echo -e ""
    echo -e "Where"
-   echo -e "\t[package] is the name of the binary package,"
-   echo -e "\t  e.g. libcommons-lang-java"
+   echo -e "\t<package> is the name of the binary package,"
+   echo -e "\t  e.g. libcommons-lang-java. Default to the first binary"
+   echo -e "\t  found in the debian/control file"
    echo -e "Options:"
    echo -e "\t-h --help: show this text"
    echo -e "\t-V --version: show the version"
    echo -e ""
-   echo -e "You need to execute it on the unpacked origianl source tree, merged with the"
+   echo -e "You need to execute it on the unpacked origial source tree, merged with the"
    echo -e "debian/ folder. It will create the file debian/<binary package>.poms which"
    echo -e "contains all the POMs to deploy to the Maven repository and is used by"
-   echo -e "mh_mavenrepo and mh_installpoms."
+   echo -e "mh_installpoms."
    echo -e ""
    echo -e "The contents of debian/<binary package>.poms should be:"
    echo -e "\t* one POM file location per line,"
-   echo -e "\t* optionaly, the location is followed by the option --debian-parent"
-   echo -e "\t  to indicate that this POM should inherit directly from the Debian"
-   echo -e "\t  parent POM."
-   echo -e ""
-   echo -e "All POMs which are installed in the Maven repository should inherit either"
-   echo -e "directly or indirectly from org.debian:debian-parent:1.0-SNAPSHOT"
+   echo -e "\t* optionaly, the location is followed by the option --no-parent"
+   echo -e "\t  to indicate that if this POM inherits from a parent, the parent"
+   echo -e "\t  element will be removed."
    exit 1
 }
 
 ARGS="" parseargs "$@"
 
-if [ "$ARGC" -lt "1" ]; then
-   syntax
+if [ "$ARGC" -gt "0" ]; then
+	PACKAGE="${ARGV[0]}"
+else
+	PACKAGE=$(dh_listpackages | head -1)
 fi
 
-PACKAGE="${ARGV[0]}"
 
 if [ -e debian/$PACKAGE.poms ]; then
   echo debian/$PACKAGE.poms already exist. Please delete it if you want to regenerate it.
 else
   mkdir -p debian
-  find . -path '*/.*' -prune -o -path './debian/tmp' -prune -o -type f -name 'pom.xml' -print | sed s,./,, | sed -e's,^\(debian/pom\.xml\|pom\.xml\),\1 --debian-parent,' > debian/$PACKAGE.poms
+  find . -path '*/.*' -prune -o -path './debian/tmp' -prune -o -type f -name 'pom.xml' -print | sed s,./,, | sed -e's,^\(debian/pom\.xml\|pom\.xml\),\1 --no-parent,' > debian/$PACKAGE.poms
   echo The list of POM files is now in debian/$PACKAGE.poms
 fi
 

Deleted: trunk/maven-repo-helper/src/main/bin/mh_mavenrepo
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_mavenrepo	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/bin/mh_mavenrepo	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,102 +0,0 @@
-#!/usr/bin/perl -w
-
-=head1 NAME
-
-mh_mavenrepo - manage the Maven repository when installing Java libraries
-
-=cut
-
-use strict;
-use File::Find;
-use Debian::Debhelper::Dh_Lib;
-
-=head1 SYNOPSIS
-
-B<mh_mavenrepo> [S<I<debhelper options>>] [B<-n>]
-
-=head1 DESCRIPTION
-
-mh_mavenrepo is a debhelper program that will scan your package for Maven
-POM files and generate installation scripts to keep the Debian parent POM
-in the Maven repository updated with the current list of libraries and their
-versions.
-
-=head1 OPTIONS
-
-=over 4
-
-=item B<-n>, B<--noscripts>
-
-Do not modify postinst/postrm scripts.
-
-=back
-
-=head1 CONFORMS TO
-
-Java policy, version TODO
-
-=cut
-
-init();
-
-my $versionPropertiesFile = "debian/tmp/versions.properties";
-
-if (! $dh{NOSCRIPTS}) {
-    foreach my $package (@{$dh{DOPACKAGES}}) {
-    	doit(("rm","-rf","debian/tmp"));
-        if ( -e "debian/$package.poms" ) {
-            cleanpoms("debian/$package.poms");
-            my $libraries = readLibraries();
-			autoscript($package,"postinst","postinst-maven-repo","s%#PACKAGE#%$package%;s%#LIBRARIES#%$libraries%");
-			autoscript($package,"postrm","postrm-maven-repo","s%#LIBRARIES#%$libraries%");
-        }
-    }
-}
-
-sub cleanpoms {
-    my $pomsFile = shift;
-	open(POMS, $pomsFile) ||
-	    error("Can't open $pomsFile: $!");
-	foreach my $line (<POMS>) {
-        chomp($line);
-		if ($line ne '') {
-            my $pom='';
-            my $opts='';
-            my @elems=split(' ',$line);
-            push(@elems, '');
-            ($pom,$opts)=@elems;
-			doit("mh_cleanpom $opts $pom");
-		}
-	}
-	close(POMS);
-}
-
-sub readLibraries {
-   	open(VERSIONS, $versionPropertiesFile) ||
-        error("Can't open $versionPropertiesFile: $!");
-    my $libraries = '';
-	foreach my $line (<VERSIONS>) {
-        chomp($line);
-        $_=$line;
-		if (! ($line eq '') && ! (substr($line,0,1) eq '#')) {
-            s/\.version=/ /g;
-            $libraries .= $_ . ",";
-        }
-    }
-    close(VERSIONS);
-    return $libraries;
-}
-
-=head1 SEE ALSO
-
-L<debhelper(7)>
-
-This program is a part of maven-repo-helper but is made to work with debhelper.
-
-=head1 AUTHORS
-
-Ludovic Claude <ludovic.claude at laposte.net>
-
-Also includes bits of the dh_pycentral written by Raphael Hertzog <hertzog at debian.org>.
-
-=cut
\ No newline at end of file

Added: trunk/maven-repo-helper/src/main/bin/mh_patchpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_patchpoms	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,55 @@
+#!/bin/bash --
+
+set -e
+
+. /usr/share/maven-repo-helper/mh_lib.sh
+
+syntax()
+{
+   echo -e "Usage: mh_patchpoms [option]..."
+   echo -e "Reads the file debian/\$package.poms and tranform each POM file"
+   echo -e "listed in the .poms file into a POM file using the Debian versions"
+   echo -e "of the libraries. Also keeps a backup of each POM file which can"
+   echo -e "be restored with mh_unpatchpoms"
+   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-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-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-v --verbose: show more information while running"
+   echo -e "\t-n --no-act: don't actually do anything, just print the results"
+   exit 1
+}
+
+ARGS="p package r rules k keep-pom-version v verbose n no-act" parseargs "$@"
+
+RULES=$(getarg r rules)
+KEEP_POM_VERSION=$(getarg k keep-pom-version)
+PACKAGE=$(getarg p package)
+PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
+VERBOSE=$(getarg v verbose)
+NOACT=$(getarg n no-act)
+
+if [ -z "$RULES" ]; then
+    if [ -f debian/maven.rules ]; then
+        RULES="debian/maven.rules"
+    fi
+fi
+
+DH_OPTS="${VERBOSE:+-v}"
+MH_ARGS="--package=${PACKAGE} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version}"
+
+if [ -z "$NOACT" ]; then
+    cat debian/$PACKAGE.poms | while read POM OPT1 OPT2; do
+        if [ ! -z "$POM" ]; then
+            cp $POM $POM.save
+        fi
+    done
+    java -cp /usr/share/java/maven-repo-helper.jar org.debian.maven.repo.POMTransformer $DH_OPTS $MH_ARGS
+fi
+

Added: trunk/maven-repo-helper/src/main/bin/mh_unpatchpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_unpatchpoms	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/bin/mh_unpatchpoms	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,38 @@
+#!/bin/bash --
+
+set -e
+
+. /usr/share/maven-repo-helper/mh_lib.sh
+
+syntax()
+{
+   echo -e "Usage: mh_unpatchpoms [option]..."
+   echo -e "Restore the POM files that have been patched to their original content."
+   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-v --verbose: show more information while running"
+   echo -e "\t-n --no-act: don't actually do anything, just print the results"
+   exit 1
+}
+
+ARGS="p package v verbose n no-act" parseargs "$@"
+
+PACKAGE=$(getarg p package)
+PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
+VERBOSE=$(getarg v verbose)
+NOACT=$(getarg n no-act)
+
+if [ -z "$NOACT" ]; then
+    cat debian/$PACKAGE.poms | while read POM OPT1 OPT2; do
+        if [ ! -z "$POM" ]; then
+            if [ -e ${POM}.save ]; then
+                rm $POM
+                mv ${POM}.save $POM
+            fi
+        fi
+    done
+fi
+

Deleted: trunk/maven-repo-helper/src/main/bin/mvn-repo
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mvn-repo	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/bin/mvn-repo	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,2 +0,0 @@
-#!/bin/sh --
-java -cp /usr/share/java/maven-repo-helper.jar org.debian.maven.repo.DebianPOM "$@"

Deleted: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DebianPOM.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DebianPOM.java	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DebianPOM.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,284 +0,0 @@
-package org.debian.maven.repo;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * Manages the Debian POM.
- *
- * Can add or remove library properties to that POM and create it if it did not
- * exist before.
- *
- * @author Ludovic Claude
- */
-public class DebianPOM {
-
-    private static final Logger log = Logger.getLogger(DebianPOM.class.getName());
-
-    public void addLibrary(File pom, File updatedPom, Map libraryProperties) {
-        Map remainingProperties = new TreeMap(libraryProperties);
-        final XMLInputFactory factory = XMLInputFactory.newInstance();
-        XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
-        Writer out = null;
-        try {
-            out = new BufferedWriter(new FileWriter(updatedPom));
-            XMLStreamWriter writer = outFactory.createXMLStreamWriter(out);
-
-            if (!pom.exists()) {
-                pom.getParentFile().mkdirs();
-                writer.writeStartDocument("UTF-8", "1.0");
-                writer.writeCharacters("\n");
-                writer.writeStartElement("project");
-                writer.writeCharacters("\n\t");
-                writer.writeStartElement("groupId");
-                writer.writeCharacters("org.debian");
-                writer.writeEndElement();
-                writer.writeCharacters("\n\t");
-                writer.writeStartElement("artifactId");
-                writer.writeCharacters("debian-parent");
-                writer.writeEndElement();
-                writer.writeCharacters("\n\t");
-                writer.writeStartElement("version");
-                writer.writeCharacters("1.0-SNAPSHOT");
-                writer.writeEndElement();
-                writer.writeCharacters("\n\t");
-                writer.writeStartElement("properties");
-            } else {
-
-                final XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(new FileReader(pom)));
-                int inProperties = 0;
-                String property = null;
-
-                writer.writeStartDocument("UTF-8", "1.0");
-
-                copy:
-                for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
-                    switch (event) {
-                        case XMLStreamConstants.START_ELEMENT: {
-                            String element = parser.getLocalName();
-                            if ("properties".equals(element)) {
-                                inProperties++;
-                            } else if (inProperties > 0) {
-                                property = element;
-                            }
-                            writer.writeStartElement(element);
-                            break;
-                        }
-
-                        case XMLStreamConstants.END_ELEMENT: {
-                            String element = parser.getLocalName();
-                            if (isDeclaration(element)) {
-                                writer.writeEndElement();
-                            } else if ("properties".equals(element)) {
-                                inProperties--;
-                                break copy;
-                            } else if (inProperties > 0 && property != null) {
-                                writer.writeEndElement();
-                                property = null;
-                            }
-                            break;
-                        }
-
-                        case XMLStreamConstants.CHARACTERS: {
-                            String value = parser.getText();
-                            if (inProperties == 0) {
-                                writer.writeCharacters(value);
-                            } else if (property != null) {
-                                if (remainingProperties.containsKey(property)) {
-                                    value = (String) remainingProperties.get(property);
-                                    remainingProperties.remove(property);
-                                }
-                                writer.writeCharacters(value);
-                            } else if ("\n\t\t".equals(value)) {
-                                // After end of a property, but not before end of
-                                // <properties> tag.
-                                writer.writeCharacters(value);
-                            }
-                            break;
-                        }
-                    } // end switch
-                } // end for
-                parser.close();
-            }
-
-            for (Iterator i = remainingProperties.entrySet().iterator(); i.hasNext();) {
-                Map.Entry entry = (Map.Entry) i.next();
-                writer.writeCharacters("\n\t\t");
-                writer.writeStartElement((String) entry.getKey());
-                writer.writeCharacters((String) entry.getValue());
-                writer.writeEndElement();
-            }
-
-            writer.writeCharacters("\n\t");
-            writer.writeEndElement();
-            writer.writeCharacters("\n");
-            writer.writeEndDocument();
-            writer.flush();
-            writer.close();
-        } catch (IOException ex) {
-            log.log(Level.SEVERE, "IO Error", ex);
-            return;
-        } catch (XMLStreamException ex) {
-            log.log(Level.SEVERE, "Error when reading the XML document", ex);
-            return;
-        } finally {
-            try {
-                if (out != null) {
-                    out.close();
-                }
-            } catch (IOException ex) {
-                log.log(Level.SEVERE, null, ex);
-                return;
-            }
-        }
-
-        if (updatedPom.exists()) {
-            pom.delete();
-            if (!updatedPom.renameTo(pom)) {
-                System.err.println("Cannot update " + pom.getAbsolutePath());
-            }
-        }
-    }
-
-    public void removeLibrary(File pom, File updatedPom, String oldProperty1, String oldProperty2) {
-        if (!pom.exists()) {
-            return;
-        }
-
-        final XMLInputFactory factory = XMLInputFactory.newInstance();
-        XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
-        Writer out = null;
-        try {
-            out = new BufferedWriter(new FileWriter(updatedPom));
-            XMLStreamWriter writer = outFactory.createXMLStreamWriter(out);
-
-            final XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(new FileReader(pom)));
-            int inProperties = 0;
-            String property = null;
-
-            writer.writeStartDocument("UTF-8", "1.0");
-
-            for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
-                switch (event) {
-                    case XMLStreamConstants.START_ELEMENT: {
-                        String element = parser.getLocalName();
-                        if ("properties".equals(element)) {
-                            inProperties++;
-                            writer.writeStartElement(element);
-                        } else if (inProperties > 0) {
-                            property = element;
-                            if (!property.equals(oldProperty1) && !property.equals(oldProperty2)) {
-                                writer.writeStartElement(element);
-                            }
-                        } else {
-                            writer.writeStartElement(element);
-                        }
-                        break;
-                    }
-
-                    case XMLStreamConstants.END_ELEMENT: {
-                        String element = parser.getLocalName();
-                        if ("properties".equals(element)) {
-                            writer.writeEndElement();
-                            inProperties--;
-                        } else if (inProperties > 0 && property != null) {
-                            if (!property.equals(oldProperty1) && !property.equals(oldProperty2)) {
-                                writer.writeEndElement();
-                            }
-                            property = null;
-                        } else {
-                            writer.writeEndElement();
-                        }
-                        break;
-                    }
-
-                    case XMLStreamConstants.CHARACTERS: {
-                        String value = parser.getText();
-                        if (property != null) {
-                            if (!property.equals(oldProperty1) && !property.equals(oldProperty2)) {
-                                writer.writeCharacters(value);
-                            }
-                        } else {
-                            writer.writeCharacters(value);
-                        }
-                        break;
-                    }
-                } // end switch
-            } // end for
-            parser.close();
-
-            writer.writeEndDocument();
-            writer.flush();
-            writer.close();
-        } catch (IOException ex) {
-            log.log(Level.SEVERE, "IO Error", ex);
-            return;
-        } catch (XMLStreamException ex) {
-            log.log(Level.SEVERE, "Error when reading the XML document", ex);
-            return;
-        } finally {
-            try {
-                if (out != null) {
-                    out.close();
-                }
-            } catch (IOException ex) {
-                log.log(Level.SEVERE, null, ex);
-                return;
-            }
-        }
-
-        if (updatedPom.exists()) {
-            pom.delete();
-            if (!updatedPom.renameTo(pom)) {
-                System.err.println("Cannot update " + pom.getAbsolutePath());
-            }
-        }
-
-    }
-
-    private boolean isDeclaration(String element) {
-        return "groupId".equals(element) || "artifactId".equals(element) || "version".equals(element);
-    }
-
-    public static void main(String[] args) {
-        DebianPOM dp = new DebianPOM();
-        File pom = new File(args[1]);
-        File updatedPom = new File(args[1] + ".tmp");
-
-        if (args[0].equals("add")) {
-            String property = args[2];
-            String version = args[3];
-            String pkg = args[4];
-
-            Map properties = new HashMap();
-            properties.put(property + ".version", version);
-            properties.put(property + ".package", pkg);
-            dp.addLibrary(pom, updatedPom, properties);
-
-        } else if (args[0].equals("remove")) {
-            String property = args[2];
-            dp.removeLibrary(pom, updatedPom, property + ".version", property + ".package");
-        } else {
-            System.err.println("Invalid arguments. Syntax is");
-            System.err.println("mvn-repo add <property> <version> <package>");
-            System.err.println("mvn-repo remove <property>");
-        }
-    }
-}

Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -4,6 +4,11 @@
  */
 package org.debian.maven.repo;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  *
  * @author ludo
@@ -65,6 +70,18 @@
             return false;
         }
         final Dependency other = (Dependency) obj;
+        if ((this.groupId == null) ? (other.groupId != null) : !this.groupId.equals(other.groupId)) {
+            return false;
+        }
+        if ((this.artifactId == null) ? (other.artifactId != null) : !this.artifactId.equals(other.artifactId)) {
+            return false;
+        }
+        if ((this.type == null) ? (other.type != null) : !this.type.equals(other.type)) {
+            return false;
+        }
+        if ((this.version == null) ? (other.version != null) : !this.version.equals(other.version)) {
+            return false;
+        }
         return true;
     }
 
@@ -76,4 +93,41 @@
         hash = 31 * hash + (this.version != null ? this.version.hashCode() : 0);
         return hash;
     }
+
+    public String toString() {
+        return groupId + ":" + artifactId + ":" + type + ":" + version;
+    }
+
+    public Dependency applyRules(Collection rules) {
+        for (Iterator i = rules.iterator(); i.hasNext();) {
+            DependencyRule rule = (DependencyRule) i.next();
+            if (rule.matches(this)) {
+                return rule.apply(this);
+            }
+        }
+        return this;
+    }
+
+    public DependencyRule findMatchingRule(Collection rules) {
+        for (Iterator i = rules.iterator(); i.hasNext();) {
+            DependencyRule rule = (DependencyRule) i.next();
+            if (rule.matches(this)) {
+                return rule;
+            }
+        }
+        return null;
+    }
+
+    public static List applyRules(List dependencies, Collection rules) {
+        if (dependencies == null) {
+            return null;
+        }
+        List result = new ArrayList();
+        for (Iterator i = dependencies.iterator(); i.hasNext();) {
+            Dependency dependency = (Dependency) i.next();
+            result.add(dependency.applyRules(rules));
+        }
+        return result;
+    }
+
 }

Added: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRule.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRule.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRule.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,123 @@
+package org.debian.maven.repo;
+
+import java.util.StringTokenizer;
+
+/**
+ *
+ * @author ludo
+ */
+public class DependencyRule implements Comparable {
+
+    public static DependencyRule TO_DEBIAN_VERSION_RULE = new DependencyRule("");
+    public static DependencyRule MAVEN_PLUGINS_KEEP_VERSION_RULE = new DependencyRule("* * maven-plugin *");
+
+    private Rule groupRule;
+    private Rule artifactRule;
+    private Rule typeRule;
+    private Rule versionRule;
+
+    public DependencyRule(String def) {
+        StringTokenizer st = new StringTokenizer(def, " \t", false);
+        if (st.hasMoreTokens()) {
+            groupRule = new Rule(st.nextToken());
+        } else {
+            groupRule = new Rule("*");
+        }
+        if (st.hasMoreTokens()) {
+            artifactRule = new Rule(st.nextToken());
+        } else {
+            artifactRule = new Rule("*");
+        }
+        if (st.hasMoreTokens()) {
+            typeRule = new Rule(st.nextToken());
+        } else {
+            typeRule = new Rule("*");
+        }
+        if (st.hasMoreTokens()) {
+            versionRule = new Rule(st.nextToken());
+        } else {
+            versionRule = new Rule("s/.*/debian/");
+        }
+    }
+
+    public boolean matches(Dependency dependency) {
+        return groupRule.match(dependency.getGroupId()) && artifactRule.match(dependency.getArtifactId()) && typeRule.match(dependency.getType()) && versionRule.match(dependency.getVersion());
+    }
+
+    public Dependency apply(Dependency dependency) {
+        return new Dependency(groupRule.apply(dependency.getGroupId()),
+                artifactRule.apply(dependency.getArtifactId()),
+                typeRule.apply(dependency.getType()),
+                versionRule.apply(dependency.getVersion()));
+    }
+
+    public int compareTo(Object o) {
+        DependencyRule other = (DependencyRule) o;
+        if (groupRule.isGeneric() && !other.groupRule.isGeneric()) {
+            return 1;
+        }
+        if (!groupRule.isGeneric() && other.groupRule.isGeneric()) {
+            return -1;
+        }
+        if (artifactRule.isGeneric() && !other.artifactRule.isGeneric()) {
+            return 1;
+        }
+        if (!artifactRule.isGeneric() && other.artifactRule.isGeneric()) {
+            return -1;
+        }
+        if (typeRule.isGeneric() && !other.typeRule.isGeneric()) {
+            return 1;
+        }
+        if (!typeRule.isGeneric() && other.typeRule.isGeneric()) {
+            return -1;
+        }
+        if (versionRule.isGeneric() && !other.versionRule.isGeneric()) {
+            return 1;
+        }
+        if (!versionRule.isGeneric() && other.versionRule.isGeneric()) {
+            return -1;
+        }
+        return this.toPatternString().compareTo(other.toPatternString());
+    }
+
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final DependencyRule other = (DependencyRule) obj;
+        if (this.groupRule != other.groupRule && (this.groupRule == null || !this.groupRule.equals(other.groupRule))) {
+            return false;
+        }
+        if (this.artifactRule != other.artifactRule && (this.artifactRule == null || !this.artifactRule.equals(other.artifactRule))) {
+            return false;
+        }
+        if (this.typeRule != other.typeRule && (this.typeRule == null || !this.typeRule.equals(other.typeRule))) {
+            return false;
+        }
+        if (this.versionRule != other.versionRule && (this.versionRule == null || !this.versionRule.equals(other.versionRule))) {
+            return false;
+        }
+        return true;
+    }
+
+    public int hashCode() {
+        int hash = 7;
+        hash = 73 * hash + (this.groupRule != null ? this.groupRule.hashCode() : 0);
+        hash = 73 * hash + (this.artifactRule != null ? this.artifactRule.hashCode() : 0);
+        hash = 73 * hash + (this.typeRule != null ? this.typeRule.hashCode() : 0);
+        hash = 73 * hash + (this.versionRule != null ? this.versionRule.hashCode() : 0);
+        return hash;
+    }
+
+    public String toPatternString() {
+        return groupRule.getPattern() + ":" + artifactRule.getPattern() + ":" + typeRule.getPattern() + ":" + versionRule.getPattern();
+    }
+
+    public String toString() {
+        return groupRule + " " + artifactRule + " " + typeRule + " " + versionRule;
+    }
+
+}

Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,490 +1,226 @@
 package org.debian.maven.repo;
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.io.LineNumberReader;
-import java.io.Writer;
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
 
 /**
  * Cleans up a POM for inclusion in the /usr/share/maven-repo/ repository.
  *
  * All POMs should contain only 
  *
- * @author Ludovic Claude
+ * @author Ludovic Claude <ludovicc at users.sourceforge.net>
  */
-public class POMCleaner {
+public class POMCleaner extends POMTransformer {
 
     private static final Logger log = Logger.getLogger(POMCleaner.class.getName());
-    private static final List IGNORED_ELEMENTS = Arrays.asList(new String[]{"build",
+    private static final List WRITE_IGNORED_ELEMENTS = Arrays.asList(new String[]{"build",
                 "distributionManagement", "profiles", "ciManagement", "prerequisites",
-                "repositories", "pluginRepositories", "reports", "reporting"});
-    private static final List INFO_ELEMENTS = Arrays.asList(new String[]{"groupId",
-                "artifactId", "packaging", "version"});
-    private final XMLInputFactory factory = XMLInputFactory.newInstance();
+                "repositories", "pluginRepositories", "reports", "reporting", "modelVersion",
+                "parent"});
 
-    public void cleanPom(File originalPom, File targetPom, File pomProperties, File versionProperties,
-            boolean inheritFromDebian, Collection specialCases) {
+    private boolean keepAllElements = false;
 
-        targetPom.getParentFile().mkdirs();
-        pomProperties.getParentFile().mkdirs();
-        versionProperties.getParentFile().mkdirs();
+    public POMCleaner() {
+    }
 
-        XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
-        Writer out = null;
-        try {
-            // First pass - read information for this POM
-            Dependency pomInfo = readPOMInfo(originalPom);
-            // Second pass - collect version and parent information
-            List dependencies = readDependencies(originalPom, inheritFromDebian);
+    public boolean isKeepAllElements() {
+        return keepAllElements;
+    }
 
-            // Third pass - create the new document
-            int inIgnoredElement = 0;
-            int inParent = 0;
-            int inDependency = 0;
-            int inLevel = 0;
-            int dependencyIndex = -1;
-            String element = null;
-            boolean afterText = false;
-            XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(new FileReader(originalPom)));
-            out = new BufferedWriter(new FileWriter(targetPom));
-            XMLStreamWriter writer = outFactory.createXMLStreamWriter(out);
+    public void setKeepAllElements(boolean keepAllElements) {
+        this.keepAllElements = keepAllElements;
+    }
 
-            writer.writeStartDocument("UTF-8", "1.0");
+    public void cleanPom(File originalPom, File targetPom, File pomProperties,
+            boolean noParent, boolean keepPomVersion, String debianPackage) {
 
-            for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
-                switch (event) {
-                    case XMLStreamConstants.START_ELEMENT: {
-                        element = parser.getLocalName();
-                        if (isIgnoredElement(element, inheritFromDebian) || inIgnoredElement > 0 || "modelVersion".equals(element) || (inDependency == 0 && inParent == 0 && isInfoElement(element))) {
-                            inIgnoredElement++;
-                        } else {
-                            indent(writer, inLevel);
-                            writer.writeStartElement(element);
-                            inLevel++;
+        if (targetPom.getParentFile() != null) {
+            targetPom.getParentFile().mkdirs();
+        }
+        if (pomProperties.getParentFile() != null) {
+            pomProperties.getParentFile().mkdirs();
+        }
 
-                            if ("project".equals(element) && inLevel == 1) {
-                                indent(writer, inLevel);
-                                if (inheritFromDebian) {
-                                    writer.writeStartElement("parent");
-                                    indent(writer, inLevel + 1);
-                                    writer.writeStartElement("groupId");
-                                    writer.writeCharacters("org.debian");
-                                    writer.writeEndElement();
-                                    indent(writer, inLevel + 1);
-                                    writer.writeStartElement("artifactId");
-                                    writer.writeCharacters("debian-parent");
-                                    writer.writeEndElement();
-                                    indent(writer, inLevel + 1);
-                                    writer.writeStartElement("version");
-                                    writer.writeCharacters("1.0-SNAPSHOT");
-                                    writer.writeEndElement();
-                                    indent(writer, inLevel);
-                                    writer.writeEndElement();
-                                    indent(writer, inLevel);
-                                }
-                                writer.writeStartElement("modelVersion");
-                                writer.writeCharacters("4.0.0");
-                                writer.writeEndElement();
-                                indent(writer, inLevel);
-                                writer.writeStartElement("groupId");
-                                writer.writeCharacters(pomInfo.getGroupId());
-                                writer.writeEndElement();
-                                indent(writer, inLevel);
-                                writer.writeStartElement("artifactId");
-                                writer.writeCharacters(pomInfo.getArtifactId());
-                                writer.writeEndElement();
-                                indent(writer, inLevel);
-                                writer.writeStartElement("version");
-                                writer.writeCharacters(pomInfo.getVersion());
-                                writer.writeEndElement();
-                                indent(writer, inLevel);
-                                writer.writeStartElement("packaging");
-                                writer.writeCharacters(pomInfo.getType());
-                                writer.writeEndElement();
-                                indent(writer, inLevel);
-                            } else if ("parent".equals(element)) {
-                                inParent++;
-                            } else if (inParent > 0) {
-                                inParent++;
-                            } else if ("dependency".equals(element)) {
-                                inDependency++;
-                                dependencyIndex++;
-                            } else if (inDependency > 0) {
-                                inDependency++;
-                            }
-                        }
-                        break;
-                    }
+        try {
+            POMInfo info = transformPom(originalPom, targetPom, noParent, keepPomVersion, debianPackage);
 
-                    case XMLStreamConstants.END_ELEMENT: {
-                        if (inIgnoredElement > 0) {
-                            inIgnoredElement--;
-                        } else {
-                            inLevel--;
-                            if (inDependency > 0) {
-                                inDependency--;
-                            }
-                            if (inParent > 0) {
-                                inParent--;
-                            }
-                            if (!afterText) {
-                                indent(writer, inLevel);
-                            }
-                            writer.writeEndElement();
-                            afterText = false;
-                        }
-                        element = null;
-                        break;
-                    }
-
-                    case XMLStreamConstants.CHARACTERS: {
-                        if (inIgnoredElement == 0) {
-                            String value = parser.getText().trim();
-                            if (inDependency > 0 && "version".equals(element)) {
-                                Dependency dependency = (Dependency) dependencies.get(dependencyIndex);
-                                value = "${" + versionProperty(dependency, specialCases) + "}";
-                            }
-                            writer.writeCharacters(value);
-                            afterText = !value.isEmpty();
-                        }
-                        break;
-                    }
-
-                } // end switch
-            } // end for
-            parser.close();
-
-            writer.writeEndDocument();
-            writer.flush();
-            writer.close();
-
             Properties pomProps = new Properties();
-            pomProps.put("GROUP_ID", pomInfo.getGroupId());
-            pomProps.put("ARTIFACT_ID", pomInfo.getArtifactId());
-            pomProps.put("TYPE", pomInfo.getType());
-            pomProps.put("VERSION", pomInfo.getVersion());
+            pomProps.put("groupId", info.getThisPom().getGroupId());
+            pomProps.put("artifactId", info.getThisPom().getArtifactId());
+            pomProps.put("type", info.getThisPom().getType());
+            pomProps.put("version", info.getOriginalVersion());
+            pomProps.put("debianVersion", info.getThisPom().getVersion());
             FileWriter pomWriter = new FileWriter(pomProperties);
             pomProps.store(pomWriter, "POM properties");
             pomWriter.close();
 
-            Properties versions = new Properties();
-            if (versionProperties.exists()) {
-                versions.load(new FileReader(versionProperties));
-                versionProperties.delete();
-            }
-            versions.put(versionProperty(pomInfo, specialCases), pomInfo.getVersion());
-            FileWriter versionsWriter = new FileWriter(versionProperties);
-            versions.store(versionsWriter, "Version properties");
-            versionsWriter.close();
-
         } catch (IOException ex) {
             log.log(Level.SEVERE, null, ex);
             return;
         } catch (XMLStreamException ex) {
             log.log(Level.SEVERE, null, ex);
             return;
-        } finally {
-            try {
-                if (out != null) {
-                    out.close();
-                }
-            } catch (IOException ex) {
-                log.log(Level.SEVERE, null, ex);
-                return;
-            }
         }
     }
 
-    protected Dependency readPOMInfo(File pom) throws XMLStreamException, FileNotFoundException {
-        XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(new FileReader(pom)));
-        Dependency dependency = new Dependency(null, null, "jar", null);
-        int inIgnoredElement = 0;
-        int inParent = 0;
-        String element = null;
-
-        // First pass - collect version and parent information
-        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
-            switch (event) {
-                case XMLStreamConstants.START_ELEMENT: {
-                    element = parser.getLocalName();
-                    if (inIgnoredElement == 0 && "parent".equals(element)) {
-                        inParent++;
-                    } else if (inIgnoredElement == 0 && isInfoElement(element)) {
-                        if (inParent > 0) {
-                            inParent++;
-                        }
-                    } else if (!"project".equals(element)) {
-                        inIgnoredElement++;
-                    }
-                    break;
-                }
-
-                case XMLStreamConstants.END_ELEMENT: {
-                    if (inIgnoredElement > 0) {
-                        inIgnoredElement--;
-                    } else {
-                        if (inParent > 0) {
-                            inParent--;
-                        }
-                    }
-                    element = null;
-                    break;
-                }
-
-                case XMLStreamConstants.CHARACTERS: {
-                    String value = parser.getText().trim();
-                    if (inIgnoredElement == 0) {
-                        if ("groupId".equals(element)) {
-                            if (inParent == 0 || dependency.getGroupId() == null) {
-                                dependency.setGroupId(value);
-                            }
-                        } else if ("artifactId".equals(element)) {
-                            if (inParent == 0 || dependency.getArtifactId() == null) {
-                                dependency.setArtifactId(value);
-                            }
-                        } else if ("version".equals(element)) {
-                            if (inParent == 0 || dependency.getVersion() == null) {
-                                dependency.setVersion(value);
-                            }
-                        } else if ("packaging".equals(element)) {
-                            if (inParent == 0) {
-                                dependency.setType(value);
-                            }
-                        }
-                    }
-                    break;
-                }
-
-            } // end switch
-        } // end for
-        parser.close();
-
-        return dependency;
-    }
-
-    protected List readDependencies(File originalPom, boolean inheritFromDebian) throws XMLStreamException, FileNotFoundException {
-        XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(new FileReader(originalPom)));
-        List dependencies = new ArrayList();
-        int inIgnoredElement = 0;
-        int inDependency = 0;
-        String element = null;
-
-        // First pass - collect version and parent information
-        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
-            switch (event) {
-                case XMLStreamConstants.START_ELEMENT: {
-                    element = parser.getLocalName();
-                    if (isIgnoredElement(element, inheritFromDebian) || inIgnoredElement > 0) {
-                        inIgnoredElement++;
-                    } else {
-                        if ("dependency".equals(element)) {
-                            inDependency++;
-                            dependencies.add(new Dependency(null, null, "jar", null));
-                        } else if (inDependency > 0) {
-                            inDependency++;
-                        }
-                    }
-                    break;
-                }
-
-                case XMLStreamConstants.END_ELEMENT: {
-                    if (inIgnoredElement > 0) {
-                        inIgnoredElement--;
-                    } else {
-                        if (inDependency > 0) {
-                            inDependency--;
-                        }
-                    }
-                    element = null;
-                    break;
-                }
-
-                case XMLStreamConstants.CHARACTERS: {
-                    String value = parser.getText().trim();
-                    if (inDependency > 0) {
-                        Dependency dependency = (Dependency) dependencies.get(dependencies.size() - 1);
-                        if ("groupId".equals(element)) {
-                            dependency.setGroupId(value);
-                        } else if ("artifactId".equals(element)) {
-                            dependency.setArtifactId(value);
-                        } else if ("type".equals(element)) {
-                            dependency.setType(value);
-                        } else if ("version".equals(element)) {
-                            dependency.setVersion(value);
-                        }
-                    }
-                    break;
-                }
-
-            } // end switch
-        } // end for
-        parser.close();
-
-        return dependencies;
-    }
-
-    protected void indent(XMLStreamWriter writer, int inLevel) throws XMLStreamException {
-        writer.writeCharacters("\n");
-        for (int i = 0; i < inLevel; i++) {
-            writer.writeCharacters("\t");
+    protected boolean isWriteIgnoredElement(String element) {
+        if (keepAllElements) {
+            return super.isWriteIgnoredElement(element);
         }
+        return WRITE_IGNORED_ELEMENTS.contains(element);
     }
 
-    protected boolean isIgnoredElement(String element, boolean inheritFromDebian) {
-        if (inheritFromDebian && "parent".equals(element)) {
-            return true;
-        }
-        return IGNORED_ELEMENTS.contains(element);
-    }
-
-    protected boolean isInfoElement(String element) {
-        return INFO_ELEMENTS.contains(element);
-    }
-
-    protected String versionProperty(Dependency dependency, Collection specialCases) {
-        for (Iterator i = specialCases.iterator(); i.hasNext();) {
-            Dependency specialCase = (Dependency) i.next();
-            if (matches(specialCase.getGroupId(), dependency.getGroupId()) &&
-                    matches(specialCase.getArtifactId(), dependency.getArtifactId()) &&
-                    matches(specialCase.getType(), dependency.getType())) {
-                String groupId = specialCase.getGroupId().replace("*", "__");
-                String artifactId = specialCase.getArtifactId().replace("*", "__");
-                String type = specialCase.getType().replace("*", "__");
-                String version = specialCase.getVersion().replace("*", "__");
-                return groupId + "." + artifactId + "." + type + "." + version + ".version";
-            }
-        }
-        String groupId = dependency.getGroupId();
-        String artifactId = dependency.getArtifactId();
-        String type = dependency.getType();
-        if (type == null) {
-            type = "jar";
-        }
-        return groupId + "." + artifactId + "." + type + ".debian.version";
-    }
-
-    private boolean matches(String reference, String test) {
-        String regex = reference.replace(".", "\\.").replace("*", "[\\w\\d-]*").replace("__", "[\\w\\d-]*");
-        return test.matches(regex);
-    }
-
     public static void main(String[] args) {
         if (args.length == 0 || "-h".equals(args[0]) || "--help".equals(args[0])) {
             System.out.println("Purpose: cleans a Maven POM for inclusion in the Debian/Maven repository in /usr/share/maven-repo");
-            System.out.println("Usage: [option] original-pom target-file versions-properties [special-dependencies]");
+            System.out.println("Usage: [option] original-pom target-file pom-properties");
             System.out.println("");
             System.out.println("Options:");
             System.out.println("  -v, --verbose: be extra verbose");
-            System.out.println("  -d, --debian-parent: target POM will inherit directly from the Debian parent POM");
+            System.out.println("  -o, --no-parent: don't inherit from a parent POM");
+            System.out.println("  -p<package>, --package=<package>: name of the Debian package containing");
+            System.out.println("    this library");
+            System.out.println("  -r<rules>, --rules=<rules>: path to the file containing the");
+            System.out.println("    extra rules to apply when cleaning the POM");
+            System.out.println("  -i<rules>, --published-rules=<rules>: path to the file containing the");
+            System.out.println("    extra rules to publish in the property debian.mavenRules in the cleaned POM");
+            System.out.println("  --no-rules: don't apply any rules for converting versions, ");
+            System.out.println("    do not even convert versions to the default 'debian' version");
+            System.out.println("  --keep-pom-version: keep the original version of the POM but, ");
+            System.out.println("    convert all other versions in dependencies and plugins");
+            System.out.println("  --keep-all-elements: keep all elements in the POM, do a version");
+            System.out.println("    transformation only, don't delete the build and other elements.");
             System.out.println("");
             System.out.println("Arguments:");
             System.out.println("  original-pom: location of the original POM");
             System.out.println("  target-file: where the cleaned POM will be written to");
-            System.out.println("  versions-properties: the version for this POM will be added to this properties file");
-            System.out.println("  special-dependencies: optional file containing the list of special cases");
-            System.out.println("    for transforming dependency versions into properties");
+            System.out.println("  pom-properties: property file where the POM properties will be written to");
             System.out.println("");
             System.out.println("Description:");
             System.out.println("  Cleans a Maven POM and prepare it for inclusion in the Debian");
             System.out.println("  repository for Maven.");
             System.out.println();
-            System.out.println("  POMs present in this repository should always inherit either");
-            System.out.println("  directly or indirectly from the parent POM");
-            System.out.println("  (org.debian:debian-parent:1.0-SNAPSHOT).");
+            System.out.println("  The POM will be normalised, and its parent tag removed if the option");
+            System.out.println("  --no-parent is given. The version will be replaced by 'debian', unless");
+            System.out.println("  a special rule applies (see below the discussion about rules).");
             System.out.println("  Build, profiles and other build time only sections of the POM");
-            System.out.println("  should be stripped.");
+            System.out.println("  will be stripped.");
             System.out.println();
             System.out.println("  If versions are given for a dependency, this version will be");
-            System.out.println("  replaced by a property of the form");
-            System.out.println("  [groupId].[artifactId].[type].[debian version].version");
-            System.out.println("  By default, groupId is the current groupId, idem for");
-            System.out.println("  artifactId and type (jar/war/ear/ejb/pom...) and debian version");
-            System.out.println("  is 'debian'");
+            System.out.println("  replaced by the 'debian' version, or a rule can be given to");
+            System.out.println("  use a custom version");
             System.out.println();
             System.out.println("  You can modify those defaults with the help of the");
-            System.out.println("  special-dependencies file. This file should contain the following lines:");
-            System.out.println("  [groupId].[artifactId].[type].[debian version]");
-            System.out.println("  where groupId, artifactId and type can be the explicit attribute to");
-            System.out.println("  match, or can contain a wildcard (either * or __ ) in order to use");
-            System.out.println("  one version property for several related dependencies.");
+            System.out.println("  rules file. This file should contain the lines with the format:");
+            System.out.println("  <groupId> [artifactId] [type] [version]");
+            System.out.println("  where groupId, artifactId, type and version can be the explicit attribute to");
+            System.out.println("  match, or can contain a wildcard (*) for generic matches.");
             System.out.println();
-            System.out.println("  The dependency version is never matched.");
-            System.out.println("  The Debian version is usually 'debian', but can be anything else if");
-            System.out.println("  you need to have several versions of the same library in the Maven");
-            System.out.println("  repository.");
+            System.out.println("  Each one of those elements can also be a replace rule, of the form");
+            System.out.println("  s/<regex>/<replace>/ where regex is a regular expression, and replace");
+            System.out.println("  is the replacement. Substitution groups $1 $2... can be used in the");
+            System.out.println("  replacement if capture groups () have been used in the regex.");
+            System.out.println();
+            System.out.println("  The first element is mandatory (groupId), but you can ignore the following");
+            System.out.println("  elements.");
+            System.out.println("  If the version is missing, then any version will be replaced with 'debian'.");
+            System.out.println("  If type is missing, then any type is matched.");
+            System.out.println("  If artifactId is missing, then any artifactId is matched.");
+            System.out.println();
+            System.out.println("  You can also have comments in this file, it should be a line starting with #");
+            System.out.println();
+            System.out.println("  Example of a rules file:");
+            System.out.println();
+            System.out.println("  s/commons-(.*)/org.apache.commons.commons$1/");
+            System.out.println("  org.itext * * s/1\\..*/1.x/");
+            System.out.println("  org.itext * * s/2\\..*/2.x/");
+            System.out.println("  org.codehaus.plexus plexus-container-default jar s/1\\.0-alpha-.*/1.0-alpha/");
+            System.out.println();
+            System.out.println("  This rules file does the following:");
+            System.out.println("  - all groupIds starting with commons- will have org.apache.commons. prefixed to them");
+            System.out.println("  - any artifact in the org.itext group with a version number starting with 1. will");
+            System.out.println("    use the 1.x version");
+            System.out.println("  - any artifact in the org.itext group with a version number starting with 2. will");
+            System.out.println("    use the 2.x version");
+            System.out.println("  - the jar with groupId=org.codehaus.plexus and artifactId=plexus-container-default and a");
+            System.out.println("    version starting with 1.0-alpha- will use the 1.0-alpha version");
+            System.out.println();
+            System.out.println("  The default rule (* * * s/.*/debian/) replaces any version number with");
+            System.out.println("  the 'debian' version and always applies last if there was no other matches.");
             return;
         }
         POMCleaner cleaner = new POMCleaner();
-        Collection specialCases = new ArrayList();
         int i = inc(-1, args);
         boolean verbose = false;
-        if ("--verbose".equals(args[0]) || "-v".equals(args[0])) {
-            verbose = true;
+        boolean noParent = false;
+        boolean noRules = false;
+        boolean keepPomVersion = false;
+        boolean keepAllElements = false;
+        String debianPackage = "";
+        File rulesFile = null;
+        File publishedRulesFile = new File("debian/maven.publishedRules");
+        while (i < args.length && (args[i].trim().startsWith("-") || args[i].trim().isEmpty())) {
+            String arg = args[i].trim();
+            if ("--verbose".equals(arg) || "-v".equals(arg)) {
+                verbose = true;
+            } else if ("--no-parent".equals(arg) || "-o".equals(arg)) {
+                noParent = true;
+            } else if ("--no-rules".equals(arg)) {
+                noRules = true;
+            } else if ("--keep-pom-version".equals(arg)) {
+                keepPomVersion = true;
+            } else if ("--keep-all-elements".equals(arg)) {
+                keepAllElements = true;
+            } else if (arg.startsWith("-p")) {
+                debianPackage = arg.substring(2);
+            } else if (arg.startsWith("--package=")) {
+                debianPackage = arg.substring("--package=".length());
+            } else if (arg.startsWith("-r")) {
+                rulesFile = new File(arg.substring(2));
+            } else if (arg.startsWith("--rules=")) {
+                rulesFile = new File(arg.substring("--rules=".length()));
+            } else if (arg.startsWith("-i")) {
+                publishedRulesFile = new File(arg.substring(2));
+            } else if (arg.startsWith("--published-rules=")) {
+                publishedRulesFile = new File(arg.substring("--rules=".length()));
+            }
             i = inc(i, args);
         }
-        boolean inheritFromDebian = false;
-        if ("--debian-parent".equals(args[0]) || "-d".equals(args[0])) {
-            inheritFromDebian = true;
-            i = inc(i, args);
+        File originalPom = new File(args[i++].trim());
+        File targetPom = new File(args[i++].trim());
+        File pomProperties = new File(args[i++].trim());
+
+        if (verbose) {
+            System.out.println("Cleaning POM " + originalPom.getAbsolutePath() +
+                    ", saving the result into " + targetPom.getAbsolutePath());
         }
-        File originalPom = new File(args[i++]);
-        File targetPom = new File(args[i++]);
-        File pomProperties = new File(args[i++]);
-        File versionProperties = new File(args[i++]);
-        if (i < args.length) {
-            String specialDependencies = args[i++];
-            File sdFile = new File(specialDependencies);
-            if (!sdFile.exists()) {
-                if (verbose) {
-                    System.err.println("Cannot find file: " + sdFile);
-                }
-            } else {
-                try {
-                    LineNumberReader lnr = new LineNumberReader(new FileReader(sdFile));
-                    String line = null;
-                    while ((line = lnr.readLine()) != null) {
-                        line = line.trim();
-                        if (line.isEmpty()) {
-                            break;
-                        }
-                        int dot = line.lastIndexOf('.');
-                        String version = line.substring(dot + 1);
-                        line = line.substring(0, dot);
-                        dot = line.lastIndexOf('.');
-                        String type = line.substring(dot + 1);
-                        line = line.substring(0, dot);
-                        dot = line.lastIndexOf('.');
-                        String artifactId = line.substring(dot + 1);
-                        String groupId = line.substring(0, dot);
-                        specialCases.add(new Dependency(groupId, artifactId, type, version));
-                    }
 
-                } catch (IOException ex) {
-                    log.log(Level.SEVERE, null, ex);
+        if (!noRules) {
+            cleaner.addDefaultRules();
+            if (rulesFile != null) {
+                if (!rulesFile.exists()) {
+                    if (verbose) {
+                        System.err.println("Cannot find file: " + rulesFile);
+                    }
+                } else {
+                    cleaner.addRules(rulesFile);
                 }
             }
+            if (publishedRulesFile != null && publishedRulesFile.exists()) {
+                cleaner.addPublishedRules(publishedRulesFile);
+            }
         }
 
-        cleaner.cleanPom(originalPom, targetPom, pomProperties, versionProperties, inheritFromDebian, specialCases);
+        cleaner.setKeepAllElements(keepAllElements);
+        cleaner.cleanPom(originalPom, targetPom, pomProperties, noParent,
+                keepPomVersion, debianPackage);
     }
 
     private static int inc(int i, String[] args) {

Added: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMInfo.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMInfo.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMInfo.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,212 @@
+package org.debian.maven.repo;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class POMInfo {
+    private String originalParentVersion;
+    private Dependency originalPom;
+    private Dependency parent;
+    private Dependency thisPom;
+    private List dependencies;
+    private List dependencyManagement;
+    private List extensions;
+    private List plugins;
+    private List pluginManagement;
+    private List profileDependencies;
+    private List profileDependencyManagement;
+    private Map properties;
+
+    public Dependency getOriginalPom() {
+        return originalPom;
+    }
+
+    public void setOriginalPom(Dependency originalPom) {
+        this.originalPom = originalPom;
+    }
+
+    public String getOriginalVersion() {
+        if (originalPom != null) {
+            return originalPom.getVersion();
+        }
+        return thisPom.getVersion();
+    }
+
+    public String getOriginalParentVersion() {
+        return originalParentVersion;
+    }
+
+    public void setOriginalParentVersion(String originalParentVersion) {
+        this.originalParentVersion = originalParentVersion;
+    }
+
+    /**
+     * @return the parent
+     */
+    public Dependency getParent() {
+        return parent;
+    }
+
+    /**
+     * @param parent the parent to set
+     */
+    public void setParent(Dependency parent) {
+        this.parent = parent;
+    }
+
+    /**
+     * @return the thisPom
+     */
+    public Dependency getThisPom() {
+        return thisPom;
+    }
+
+    /**
+     * @param thisPom the thisPom to set
+     */
+    public void setThisPom(Dependency thisPom) {
+        this.thisPom = thisPom;
+    }
+
+    /**
+     * @return the dependencies
+     */
+    public List getDependencies() {
+        return dependencies;
+    }
+
+    /**
+     * @param dependencies the dependencies to set
+     */
+    public void setDependencies(List dependencies) {
+        this.dependencies = dependencies;
+    }
+
+    /**
+     * @return the properties
+     */
+    public Map getProperties() {
+        return properties;
+    }
+
+    /**
+     * @param properties the properties to set
+     */
+    public void setProperties(Map properties) {
+        this.properties = properties;
+    }
+
+    public List getDependencyManagement() {
+        return dependencyManagement;
+    }
+
+    public void setDependencyManagement(List dependencyManagement) {
+        this.dependencyManagement = dependencyManagement;
+    }
+
+    public List getPlugins() {
+        return plugins;
+    }
+
+    public void setPlugins(List plugins) {
+        this.plugins = plugins;
+    }
+
+    public List getPluginManagement() {
+        return pluginManagement;
+    }
+
+    public void setPluginManagement(List pluginManagement) {
+        this.pluginManagement = pluginManagement;
+    }
+
+    public List getProfileDependencies() {
+        return profileDependencies;
+    }
+
+    public void setProfileDependencies(List profileDependencies) {
+        this.profileDependencies = profileDependencies;
+    }
+
+    public List getProfileDependencyManagement() {
+        return profileDependencyManagement;
+    }
+
+    public void setProfileDependencyManagement(List profileDependencyManagement) {
+        this.profileDependencyManagement = profileDependencyManagement;
+    }
+
+    public List getExtensions() {
+        return extensions;
+    }
+
+    public void setExtensions(List extensions) {
+        this.extensions = extensions;
+    }
+
+    public POMInfo applyRules(Collection rules) {
+        if (rules.isEmpty()) {
+            return this;
+        }
+
+        POMInfo result = new POMInfo();
+        result.setOriginalPom(getThisPom());
+        result.setThisPom(getThisPom().applyRules(rules));
+        if (getParent() != null) {
+            result.setOriginalParentVersion(getParent().getVersion());
+            result.setParent(getParent().applyRules(rules));
+        }
+        result.setDependencies(Dependency.applyRules(getDependencies(), rules));
+        result.setDependencyManagement(Dependency.applyRules(getDependencyManagement(), rules));
+        result.setExtensions(Dependency.applyRules(getExtensions(), rules));
+        result.setPlugins(Dependency.applyRules(getPlugins(), rules));
+        result.setPluginManagement(Dependency.applyRules(getPluginManagement(), rules));
+        result.setProfileDependencies(Dependency.applyRules(getProfileDependencies(), rules));
+        result.setProfileDependencyManagement(Dependency.applyRules(getProfileDependencyManagement(), rules));
+        result.setProperties(getProperties());
+
+        return result;
+    }
+
+    public void mergeManagement(POMInfo parentPOM) {
+        if (parentPOM != null) {
+            mergeManagement(dependencyManagement, parentPOM.getDependencyManagement());
+            mergeManagement(pluginManagement, parentPOM.getPluginManagement());
+        }
+        resolveVersions(dependencies, dependencyManagement);
+        resolveVersions(plugins, pluginManagement);
+    }
+
+    private void mergeManagement(List target, List management) {
+        resolveVersions(target, management);
+        nextParentDep: for (Iterator i = management.iterator(); i.hasNext();) {
+            Dependency parentDep = (Dependency)i.next();
+            for (Iterator j = target.iterator(); j.hasNext();) {
+                Dependency dependency = (Dependency)j.next();
+                if (dependency.equals(parentDep)) {
+                    continue nextParentDep;
+                }
+            }
+            target.add(parentDep);
+        }
+    }
+
+    private void resolveVersions(List deps, List management) {
+        for (Iterator i = management.iterator(); i.hasNext();) {
+            Dependency parentDep = (Dependency)i.next();
+            for (Iterator j = deps.iterator(); j.hasNext();) {
+                Dependency dependency = (Dependency)j.next();
+                if (dependency.getVersion() == null) {
+                    if (dependency.getGroupId().equals(parentDep.getGroupId()) &&
+                        dependency.getArtifactId().equals(parentDep.getArtifactId()) &&
+                        dependency.getType().equals(parentDep.getType())) {
+                        dependency.setVersion(parentDep.getVersion());
+                        break;
+                    }
+                }
+            }
+        }
+    }
+}

Added: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMReader.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMReader.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMReader.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,272 @@
+package org.debian.maven.repo;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Reads relevant information from the POM.
+ *
+ * @author Ludovic Claude <ludovicc at users.sourceforge.net>
+ */
+public class POMReader {
+
+    private static final List READ_IGNORED_ELEMENTS = Arrays.asList(new String[]{
+                "distributionManagement", "ciManagement", "prerequisites", "exclusions",
+                "repositories", "pluginRepositories", "reports", "modelVersion"});
+    protected final XMLInputFactory factory = XMLInputFactory.newInstance();
+
+    public POMInfo readPom(File originalPom) throws XMLStreamException, FileNotFoundException {
+        if (! originalPom.exists()) {
+            System.err.println("Cannot find pom file " + originalPom.getAbsolutePath());
+        }
+        XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(new FileReader(originalPom)));
+        List path = new ArrayList();
+        List dependencies = new ArrayList();
+        List dependencyManagement = new ArrayList();
+        List extensions = new ArrayList();
+        List plugins = new ArrayList();
+        List pluginManagement = new ArrayList();
+        List profileDependencies = new ArrayList();
+        List profileDependencyManagement = new ArrayList();
+
+        Map properties = new TreeMap();
+        Dependency thisPom = new Dependency(null, null, "jar", null);
+        Dependency parent = null;
+        Dependency currentDependency = null;
+        int inLevel = 0;
+        int inIgnoredElement = 0;
+        int inDependency = 0;
+        int inExtension = 0;
+        int inPlugin = 0;
+        int inParent = 0;
+        int inProperties = 0;
+        String element = null;
+
+        // First pass - collect version and parent information
+        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+            switch (event) {
+                case XMLStreamConstants.START_ELEMENT: {
+                    element = parser.getLocalName();
+                    if (isReadIgnoredElement(element) || inIgnoredElement > 0) {
+                        inIgnoredElement++;
+                    } else {
+                        inLevel++;
+                        path.add(element);
+                        if ("dependency".equals(element)) {
+                            inDependency++;
+                            currentDependency = new Dependency(null, null, "jar", null);
+                            String parentElement = (String) path.get(path.size() - 2);
+                            String parentParentElement = (String) path.get(path.size() - 3);
+                            if ("dependencies".equals(parentElement)) {
+                                if ("dependencyManagement".equals(parentParentElement)) {
+                                    String p3Element = (String) path.get(path.size() - 4);
+                                    if ("project".equals(p3Element)) {
+                                        dependencyManagement.add(currentDependency);
+                                    } else if ("profile".equals(p3Element)) {
+                                        profileDependencyManagement.add(currentDependency);
+                                    }
+                                } else if ("project".equals(parentParentElement)) {
+                                    dependencies.add(currentDependency);
+                                } else if ("profile".equals(parentParentElement)) {
+                                    profileDependencies.add(currentDependency);
+                                }
+                            }
+                        } else if (inDependency > 0) {
+                            inDependency++;
+                        } else if ("plugin".equals(element)) {
+                            inPlugin++;
+                            String parentElement = (String) path.get(path.size() - 2);
+                            String parentParentElement = (String) path.get(path.size() - 3);
+                            currentDependency = new Dependency("org.apache.maven.plugins", null, "maven-plugin", null);
+                            if ("plugins".equals(parentElement)) {
+                                if ("pluginManagement".equals(parentParentElement)) {
+                                    pluginManagement.add(currentDependency);
+                                } else {
+                                    plugins.add(currentDependency);
+                                }
+                            }
+                        } else if (inPlugin > 0) {
+                            inPlugin++;
+                        } else if ("extension".equals(element)) {
+                            inExtension++;
+                            currentDependency = new Dependency(null, null, "jar", null);
+                            extensions.add(currentDependency);
+                        } else if (inExtension > 0) {
+                            inExtension++;
+                        } else if (inLevel == 2 && "parent".equals(element)) {
+                            inParent++;
+                            parent = new Dependency();
+                            parent.setType("pom");
+                        } else if (inParent > 0) {
+                            inParent++;
+                        } else if (inLevel == 2 && "properties".equals(element)) {
+                            inProperties++;
+                        } else if (inProperties > 0) {
+                            inProperties++;
+                        }
+                    }
+                    break;
+                }
+
+                case XMLStreamConstants.END_ELEMENT: {
+                    if (inIgnoredElement > 0) {
+                        inIgnoredElement--;
+                    } else {
+                        inLevel--;
+                        path.remove(path.size() - 1);
+                        if (inDependency > 0) {
+                            inDependency--;
+                        } else if (inPlugin > 0) {
+                            inPlugin--;
+                        } else if (inExtension > 0) {
+                            inExtension--;
+                        } else if (inParent > 0) {
+                            inParent--;
+                        } else if (inProperties > 0) {
+                            inProperties--;
+                        }
+                    }
+                    element = null;
+                    break;
+                }
+
+                case XMLStreamConstants.CHARACTERS: {
+                    String value = parser.getText().trim();
+                    if (inDependency > 1 || inPlugin > 1 || inExtension > 1) {
+                        if ("groupId".equals(element)) {
+                            currentDependency.setGroupId(value);
+                        } else if ("artifactId".equals(element)) {
+                            currentDependency.setArtifactId(value);
+                        } else if ("type".equals(element)) {
+                            currentDependency.setType(value);
+                        } else if ("version".equals(element)) {
+                            currentDependency.setVersion(value);
+                        }
+                    } else if (inParent > 1) {
+                        if ("groupId".equals(element)) {
+                            parent.setGroupId(value);
+                        } else if ("artifactId".equals(element)) {
+                            parent.setArtifactId(value);
+                        } else if ("version".equals(element)) {
+                            parent.setVersion(value);
+                        }
+                    } else if (inProperties > 1) {
+                        properties.put(element, value);
+                    } else if (inLevel == 2 && inIgnoredElement == 0) {
+                        if ("groupId".equals(element)) {
+                            thisPom.setGroupId(value);
+                        } else if ("artifactId".equals(element)) {
+                            thisPom.setArtifactId(value);
+                        } else if ("packaging".equals(element)) {
+                            thisPom.setType(value);
+                        } else if ("version".equals(element)) {
+                            thisPom.setVersion(value);
+                        }
+                    }
+                    break;
+                }
+
+                case XMLStreamConstants.CDATA: {
+                    String value = parser.getText().trim();
+                    if (inProperties > 1) {
+                        properties.put(element, value);
+                    }
+                    break;
+                }
+
+            } // end switch
+        } // end for
+        parser.close();
+
+        if (thisPom.getGroupId() == null && parent != null) {
+            thisPom.setGroupId(parent.getGroupId());
+        }
+        if (thisPom.getVersion() == null && parent != null) {
+            thisPom.setVersion(parent.getVersion());
+        }
+
+        Map inferedProperties = new TreeMap(properties);
+        inferedProperties.put("pom.groupId", thisPom.getGroupId());
+        inferedProperties.put("project.groupId", thisPom.getGroupId());
+        inferedProperties.put("pom.artifactId", thisPom.getArtifactId());
+        inferedProperties.put("project.artifactId", thisPom.getArtifactId());
+        inferedProperties.put("pom.version", thisPom.getVersion());
+        inferedProperties.put("project.version", thisPom.getVersion());
+        expendProperties(dependencies, inferedProperties);
+        expendProperties(dependencyManagement, inferedProperties);
+        expendProperties(profileDependencies, inferedProperties);
+        expendProperties(profileDependencyManagement, inferedProperties);
+        expendProperties(plugins, inferedProperties);
+        expendProperties(pluginManagement, inferedProperties);
+
+        POMInfo info = new POMInfo();
+        if (properties.get("debian.originalVersion") != null) {
+            Dependency originalPomDep = new Dependency(thisPom.getGroupId(),
+                    thisPom.getArtifactId(), thisPom.getType(), 
+                    (String) properties.get("debian.originalVersion"));
+            info.setOriginalPom(originalPomDep);
+        }
+        info.setThisPom(thisPom);
+        info.setParent(parent);
+        info.setDependencies(dependencies);
+        info.setDependencyManagement(dependencyManagement);
+        info.setExtensions(extensions);
+        info.setProfileDependencies(profileDependencies);
+        info.setProfileDependencyManagement(profileDependencyManagement);
+        info.setPlugins(plugins);
+        info.setPluginManagement(pluginManagement);
+        info.setProperties(properties);
+        return info;
+    }
+
+    protected boolean isReadIgnoredElement(String element) {
+        return READ_IGNORED_ELEMENTS.contains(element);
+    }
+
+    private void expendProperties(List dependencies, Map inferedProperties) {
+        for (Iterator i = dependencies.iterator(); i.hasNext();) {
+            Dependency dependency = (Dependency) i.next();
+            expandProperties(dependency, inferedProperties);
+        }
+    }
+
+    private void expandProperties(Dependency dependency, Map inferedProperties) {
+        dependency.setGroupId(expandString(dependency.getGroupId(), inferedProperties));
+        dependency.setArtifactId(expandString(dependency.getArtifactId(), inferedProperties));
+        dependency.setType(expandString(dependency.getType(), inferedProperties));
+        dependency.setVersion(expandString(dependency.getVersion(), inferedProperties));
+    }
+
+    private String expandString(String str, Map inferedProperties) {
+        if (str == null) {
+            return null;
+        }
+        int pos;
+        while ((pos = str.indexOf("${")) >= 0) {
+            int end = str.indexOf('}', pos);
+            String property = str.substring(pos + 2, end);
+            if (inferedProperties.containsKey(property)) {
+                String endStr = "";
+                if (end + 1 < str.length()) {
+                    endStr = str.substring(end + 1);
+                }
+                str = str.substring(0, pos) + inferedProperties.get(property) + endStr;
+            } else {
+                break;
+            }
+        }
+        return str;
+    }
+}
\ No newline at end of file

Added: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,556 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.debian.maven.repo;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ *
+ * @author Ludovic Claude <ludovicc at users.sourceforge.net>
+ */
+public class POMTransformer extends POMReader {
+
+    private static final Logger log = Logger.getLogger(POMTransformer.class.getName());
+    private static final List WRITE_IGNORED_ELEMENTS = Arrays.asList(new String[]{
+                "modelVersion", "parent"});
+    private static final List INFO_ELEMENTS = Arrays.asList(new String[]{"groupId",
+                "artifactId", "packaging", "version"});
+    private Set rules = new TreeSet();
+    private Set publishedRules = new TreeSet();
+    private boolean verbose;
+
+    public POMTransformer() {
+    }
+
+    public void addDefaultRules() {
+        addRule(DependencyRule.TO_DEBIAN_VERSION_RULE);
+        addRule(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE);
+    }
+
+    public void addRule(DependencyRule rule) {
+        rules.add(rule);
+    }
+
+    public void addRules(File file) {
+        if (verbose) {
+            System.out.println("Add rules:");
+        }
+        addRules(file, rules);
+    }
+
+    public void addPublishedRule(DependencyRule rule) {
+        if (verbose) {
+            System.out.println("Publish rules:");
+        }
+        publishedRules.add(rule);
+    }
+
+    public void addPublishedRules(File file) {
+        addRules(file, publishedRules);
+    }
+
+    private void addRules(File file, Set dest) {
+        try {
+            LineNumberReader lnr = new LineNumberReader(new FileReader(file));
+            String line = null;
+            while ((line = lnr.readLine()) != null) {
+                line = line.trim();
+                if (!line.isEmpty() && !line.startsWith("#")) {
+                    if (verbose) {
+                        System.out.println("  " + line);
+                    }
+                    dest.add(new DependencyRule(line));
+                }
+            }
+            if (verbose) {
+                System.out.println("---------");
+            }
+
+        } catch (IOException ex) {
+            log.log(Level.SEVERE, null, ex);
+        }
+    }
+
+    public void keepPomVersions(File poms, final String debianPackage) {
+        foreachPoms(poms, new POMHandler() {
+
+            public void handlePOM(File pomFile, boolean noParent) throws Exception {
+                Dependency pom = readPom(pomFile).getThisPom();
+                addRule(new DependencyRule(pom.getGroupId() + " " + pom.getArtifactId() + " " + pom.getType() + " " + pom.getVersion()));
+            }
+        });
+    }
+
+    public void transformPoms(File poms, final String debianPackage, final boolean keepPomVersion) {
+        foreachPoms(poms, new POMHandler() {
+
+            public void handlePOM(File pomFile, boolean noParent) throws Exception {
+                File targetFile = new File(pomFile.getAbsolutePath() + ".new");
+                transformPom(pomFile, targetFile, noParent, keepPomVersion, debianPackage);
+                pomFile.delete();
+                targetFile.renameTo(pomFile);
+            }
+        });
+    }
+
+    public void transformPom(File originalPom, File targetPom) throws XMLStreamException, FileNotFoundException, IOException {
+        transformPom(originalPom, targetPom, false, false, null);
+    }
+
+    public POMInfo transformPom(File originalPom, File targetPom,
+            boolean noParent, boolean keepPomVersion, String debianPackage) throws XMLStreamException, FileNotFoundException, IOException {
+
+        if (targetPom.getParentFile() != null) {
+            targetPom.getParentFile().mkdirs();
+        }
+
+        XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
+        Writer out = null;
+        try {
+            // First pass - read information for this POM
+            POMInfo info = readPom(originalPom);
+
+            info = info.applyRules(rules);
+            Dependency parent = info.getParent();
+            Dependency pomInfo = info.getThisPom();
+
+            // Second pass - create the new document
+            int inIgnoredElement = 0;
+            int inDependency = 0;
+            int inExclusion = 0;
+            int inExtension = 0;
+            int inPlugin = 0;
+            int inProperty = 0;
+            int inLevel = 0;
+            List path = new ArrayList();
+            Map dependencyIndexes = new HashMap();
+            Dependency dependency = null;
+            String element = null;
+            boolean afterText = false;
+            XMLStreamReader parser = factory.createXMLStreamReader(new BufferedReader(new FileReader(originalPom)));
+            out = new BufferedWriter(new FileWriter(targetPom));
+            XMLStreamWriter writer = outFactory.createXMLStreamWriter(out);
+
+            writer.writeStartDocument("UTF-8", "1.0");
+
+            for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
+                switch (event) {
+                    case XMLStreamConstants.START_ELEMENT: {
+                        element = parser.getLocalName();
+                        if (isWriteIgnoredElement(element) || (inLevel == 1 && isInfoElement(element))) {
+                            inIgnoredElement++;
+                        } else if (inLevel == 1 && "properties".equals(element) && info.getProperties().isEmpty()) {
+                            inIgnoredElement++;
+                        } else if (inIgnoredElement > 0) {
+                            inIgnoredElement++;
+                        } else {
+                            indent(writer, inLevel);
+                            writer.writeStartElement(element);
+                            inLevel++;
+                            path.add(element);
+
+                            if ("project".equals(element) && inLevel == 1) {
+                                indent(writer, inLevel);
+                                writer.writeStartElement("modelVersion");
+                                writer.writeCharacters("4.0.0");
+                                writer.writeEndElement();
+                                indent(writer, inLevel);
+                                writer.writeStartElement("groupId");
+                                writer.writeCharacters(pomInfo.getGroupId());
+                                writer.writeEndElement();
+                                indent(writer, inLevel);
+                                writer.writeStartElement("artifactId");
+                                writer.writeCharacters(pomInfo.getArtifactId());
+                                writer.writeEndElement();
+                                indent(writer, inLevel);
+                                writer.writeStartElement("version");
+                                if (keepPomVersion) {
+                                    writer.writeCharacters(info.getOriginalVersion());
+                                } else {
+                                    writer.writeCharacters(pomInfo.getVersion());
+                                }
+                                writer.writeEndElement();
+                                indent(writer, inLevel);
+                                writer.writeStartElement("packaging");
+                                writer.writeCharacters(pomInfo.getType());
+                                writer.writeEndElement();
+                                indent(writer, inLevel);
+                                if (!noParent && parent != null) {
+                                    writer.writeStartElement("parent");
+                                    indent(writer, inLevel + 1);
+                                    writer.writeStartElement("groupId");
+                                    writer.writeCharacters(parent.getGroupId());
+                                    writer.writeEndElement();
+                                    indent(writer, inLevel + 1);
+                                    writer.writeStartElement("artifactId");
+                                    writer.writeCharacters(parent.getArtifactId());
+                                    writer.writeEndElement();
+                                    indent(writer, inLevel + 1);
+                                    writer.writeStartElement("version");
+                                    if (keepPomVersion) {
+                                        // use original parent version
+                                        writer.writeCharacters(info.getOriginalParentVersion());
+                                    } else {
+                                        writer.writeCharacters(parent.getVersion());
+                                    }
+                                    writer.writeEndElement();
+                                    indent(writer, inLevel);
+                                    writer.writeEndElement();
+                                    indent(writer, inLevel);
+                                }
+                                if (info.getProperties().isEmpty()) {
+                                    writer.writeStartElement("properties");
+                                    writeDebianProperties(writer, inLevel, info, debianPackage);
+                                    indent(writer, inLevel);
+                                    writer.writeEndElement();
+                                    indent(writer, inLevel);
+                                }
+                            } else if (inLevel == 2 && "properties".equals(element)) {
+                                inProperty++;
+                            } else if (inProperty > 0) {
+                                inProperty++;
+                            } else if ("dependency".equals(element)) {
+                                inDependency++;
+                                String parentElement = (String) path.get(path.size() - 2);
+                                String parentParentElement = (String) path.get(path.size() - 3);
+                                if ("dependencies".equals(parentElement)) {
+                                    List dependencyList = null;
+                                    if ("dependencyManagement".equals(parentParentElement)) {
+                                        String p3Element = (String) path.get(path.size() - 4);
+                                        if ("project".equals(p3Element)) {
+                                            dependencyList = info.getDependencyManagement();
+                                        } else if ("profile".equals(p3Element)) {
+                                            dependencyList = info.getProfileDependencyManagement();
+                                        }
+                                    } else if ("project".equals(parentParentElement)) {
+                                        dependencyList = info.getDependencies();
+                                    } else if ("profile".equals(parentParentElement)) {
+                                        dependencyList = info.getProfileDependencies();
+                                    }
+                                    if (dependencyList != null) {
+                                        int index = inc(dependencyIndexes, dependencyList);
+                                        dependency = (Dependency) dependencyList.get(index);
+                                    }
+                                }
+                            } else if (inExclusion > 0) {
+                                inExclusion++;
+                            } else if (inDependency > 0) {
+                                if ("exclusion".equals(element)) {
+                                    inExclusion++;
+                                } else {
+                                    inDependency++;
+                                }
+                            } else if ("plugin".equals(element)) {
+                                inPlugin++;
+                                String parentElement = (String) path.get(path.size() - 2);
+                                String parentParentElement = (String) path.get(path.size() - 3);
+                                if ("plugins".equals(parentElement)) {
+                                    List dependencyList;
+                                    if ("pluginManagement".equals(parentParentElement)) {
+                                        dependencyList = info.getPluginManagement();
+                                    } else {
+                                        dependencyList = info.getPlugins();
+                                    }
+                                    int index = inc(dependencyIndexes, dependencyList);
+                                    dependency = (Dependency) dependencyList.get(index);
+                                }
+                            } else if (inPlugin > 0) {
+                                inPlugin++;
+                            } else if ("extension".equals(element)) {
+                                inExtension++;
+                                int index = inc(dependencyIndexes, info.getExtensions());
+                                dependency = (Dependency) info.getExtensions().get(index);
+                            } else if (inExtension > 0) {
+                                inExtension++;
+
+                            }
+                        }
+                        break;
+                    }
+
+                    case XMLStreamConstants.END_ELEMENT: {
+                        if (inIgnoredElement > 0) {
+                            inIgnoredElement--;
+                        } else {
+                            inLevel--;
+                            path.remove(path.size() - 1);
+                            if (inExclusion > 0) {
+                                inExclusion--;
+                            } else if (inDependency > 0) {
+                                inDependency--;
+                            } else if (inPlugin > 0) {
+                                inPlugin--;
+                            } else if (inExtension > 0) {
+                                inExtension--;
+                            }
+                            if (inDependency + inPlugin + inExtension == 0) {
+                                dependency = null;
+                            }
+                            if (inProperty > 0) {
+                                inProperty--;
+                                if (inProperty == 0) {
+                                    writeDebianProperties(writer, inLevel, info, debianPackage);
+                                }
+                            }
+                            if (!afterText) {
+                                indent(writer, inLevel);
+                            }
+                            writer.writeEndElement();
+                            afterText = false;
+                        }
+                        element = null;
+                        break;
+                    }
+
+                    case XMLStreamConstants.CHARACTERS: {
+                        if (inIgnoredElement == 0) {
+                            String value = parser.getText().trim();
+                            if (dependency != null && inExclusion == 0) {
+                                if ("groupId".equals(element)) {
+                                    value = dependency.getGroupId();
+                                } else if ("artifactId".equals(element)) {
+                                    value = dependency.getArtifactId();
+                                } else if ("type".equals(element)) {
+                                    value = dependency.getType();
+                                } else if ("version".equals(element)) {
+                                    value = dependency.getVersion();
+                                }
+                            }
+                            writer.writeCharacters(value);
+                            afterText = !value.isEmpty();
+                        }
+                        break;
+                    }
+
+                } // end switch
+            } // end for
+            parser.close();
+
+            writer.writeEndDocument();
+            writer.flush();
+            writer.close();
+
+            return info;
+
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+            } catch (IOException ex) {
+                log.log(Level.SEVERE, null, ex);
+            }
+        }
+    }
+
+    protected void indent(XMLStreamWriter writer, int inLevel) throws XMLStreamException {
+        writer.writeCharacters("\n");
+        for (int i = 0; i < inLevel; i++) {
+            writer.writeCharacters("\t");
+        }
+    }
+
+    protected boolean isWriteIgnoredElement(String element) {
+        return WRITE_IGNORED_ELEMENTS.contains(element);
+    }
+
+    protected boolean isInfoElement(String element) {
+        return INFO_ELEMENTS.contains(element);
+    }
+
+    private int inc(Map dependencyIndexes, List dependencyList) {
+        Integer index = (Integer) dependencyIndexes.get(dependencyList);
+        if (index == null) {
+            index = new Integer(0);
+        } else {
+            index = new Integer(index.intValue() + 1);
+        }
+        dependencyIndexes.put(dependencyList, index);
+        return index.intValue();
+    }
+
+    private void writeDebianProperties(XMLStreamWriter writer, int inLevel, POMInfo info, String debianPackage) throws XMLStreamException {
+        indent(writer, inLevel + 1);
+        writer.writeStartElement("debian.originalVersion");
+        writer.writeCharacters(info.getOriginalVersion());
+        writer.writeEndElement();
+        if (debianPackage != null) {
+            indent(writer, inLevel + 1);
+            writer.writeStartElement("debian.package");
+            writer.writeCharacters(debianPackage);
+            writer.writeEndElement();
+        }
+        DependencyRule usedRule = info.getOriginalPom().findMatchingRule(rules);
+        if (usedRule != null && !usedRule.equals(DependencyRule.TO_DEBIAN_VERSION_RULE) && !usedRule.equals(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE)) {
+            addPublishedRule(usedRule);
+        }
+        if (!publishedRules.isEmpty()) {
+            indent(writer, inLevel + 1);
+            writer.writeStartElement("debian.mavenRule");
+            StringWriter sw = new StringWriter();
+            for (Iterator i = publishedRules.iterator(); i.hasNext();) {
+                DependencyRule dependencyRule = (DependencyRule) i.next();
+                sw.append(dependencyRule.toString());
+                if (i.hasNext()) {
+                    sw.append(",\n");
+                    for (int j = 0; j <= inLevel; j++) {
+                        sw.append("\t");
+                    }
+                }
+            }
+            writer.writeCData(sw.toString());
+            writer.writeEndElement();
+        }
+    }
+
+    public void setVerbose(boolean verbose) {
+        this.verbose = verbose;
+    }
+
+    private interface POMHandler {
+
+        void handlePOM(File pomFile, boolean noParent) throws Exception;
+    }
+
+    private void foreachPoms(File poms, POMHandler handler) {
+        try {
+            LineNumberReader reader = new LineNumberReader(new FileReader(poms));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                StringTokenizer st = new StringTokenizer(line, " \t");
+                if (!st.hasMoreTokens()) {
+                    continue;
+                }
+                String pom = st.nextToken();
+                File pomFile = new File(pom);
+                boolean noParent = false;
+                if (st.hasMoreTokens()) {
+                    if ("--no-parent".equals(st.nextToken())) {
+                        noParent = true;
+                    }
+                }
+                handler.handlePOM(pomFile, noParent);
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) {
+        if (args.length == 0 || "-h".equals(args[0]) || "--help".equals(args[0])) {
+            System.out.println("Purpose: Transforms the POM files to use Debian versions.");
+            System.out.println("Usage: [option] <poms>");
+            System.out.println("");
+            System.out.println("Options:");
+            System.out.println("  -v, --verbose: be extra verbose");
+            System.out.println("  -p<package>, --package=<package>: name of the Debian package containing");
+            System.out.println("    this library");
+            System.out.println("  -r<rules>, --rules=<rules>: path to the file containing the");
+            System.out.println("    extra rules to apply when cleaning the POM");
+            System.out.println("  --no-rules: don't apply any rules for converting versions, ");
+            System.out.println("    do not even convert versions to the default 'debian' version");
+            System.out.println("  --keep-pom-version: keep the original version of the POMs but, ");
+            System.out.println("    convert all other versions in dependencies and plugins");
+            System.out.println("");
+            System.out.println("Arguments:");
+            System.out.println("  poms: location of file containing the list of POM files to process.");
+            System.out.println("    Optional, defaults to debian/$package");
+            System.out.println("");
+            System.out.println("Description:");
+            System.out.println("  Reads the file debian/$package.poms and tranform each POM file");
+            System.out.println("  listed in the .poms file into a POM file using the Debian versions");
+            System.out.println("  of the libraries.");
+            return;
+        }
+        POMTransformer transformer = new POMTransformer();
+        int i = inc(-1, args);
+        boolean verbose = false;
+        boolean noRules = false;
+        boolean keepPomVersion = false;
+        String debianPackage = "";
+        File rulesFile = null;
+        File publishedRulesFile = new File("debian/maven.publishedRules");
+        while (i < args.length && (args[i].trim().startsWith("-") || args[i].trim().isEmpty())) {
+            String arg = args[i].trim();
+            if ("--verbose".equals(arg) || "-v".equals(arg)) {
+                verbose = true;
+            } else if ("--no-rules".equals(arg)) {
+                noRules = true;
+            } else if ("--keep-pom-version".equals(arg)) {
+                keepPomVersion = true;
+            } else if (arg.startsWith("-p")) {
+                debianPackage = arg.substring(2);
+            } else if (arg.startsWith("--package=")) {
+                debianPackage = arg.substring("--package=".length());
+            } else if (arg.startsWith("-r")) {
+                rulesFile = new File(arg.substring(2));
+            } else if (arg.startsWith("--rules=")) {
+                rulesFile = new File(arg.substring("--rules=".length()));
+            }
+            i = inc(i, args);
+        }
+        transformer.setVerbose(verbose);
+
+        File poms;
+        if (i + 1 < args.length) {
+            poms = new File(args[i++].trim());
+        } else {
+            poms = new File("debian/" + debianPackage + ".poms");
+        }
+
+        if (!noRules) {
+            transformer.addDefaultRules();
+            if (rulesFile != null) {
+                if (!rulesFile.exists()) {
+                    if (verbose) {
+                        System.err.println("Cannot find file: " + rulesFile);
+                    }
+                } else {
+                    transformer.addRules(rulesFile);
+                }
+            }
+            if (keepPomVersion) {
+                transformer.keepPomVersions(poms, debianPackage);
+            }
+            if (publishedRulesFile != null && publishedRulesFile.exists()) {
+                transformer.addPublishedRules(publishedRulesFile);
+            }
+        }
+
+        transformer.transformPoms(poms, debianPackage, keepPomVersion);
+    }
+
+    private static int inc(int i, String[] args) {
+        do {
+            i++;
+        } while (i < args.length && args[i].isEmpty());
+        return i;
+    }
+}

Added: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Repository.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Repository.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Repository.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,236 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.debian.maven.repo;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import javax.xml.stream.XMLStreamException;
+
+/**
+ *
+ * @author ludo
+ */
+public class Repository {
+
+    private File baseDir;
+    private Map poms = new HashMap();
+    private Map dep2info = new HashMap();
+    private Map pomsWithMissingParent = new HashMap();
+    private Map pomsWithMissingVersions = new HashMap();
+    private Map resolvedPoms = new HashMap();
+
+    public Repository(File baseDir) {
+        this.baseDir = baseDir;
+    }
+
+    public File getBaseDir() {
+        return baseDir;
+    }
+
+    public void scan() {
+        File[] files = baseDir.listFiles();
+        scan(files);
+        resolveAll(poms);
+        int unresolved = pomsWithMissingParent.size();
+        while (unresolved > 0) {
+            resolveAll(pomsWithMissingParent);
+            if (pomsWithMissingParent.size() == unresolved) {
+                // stale detection
+                break;
+            }
+            unresolved = pomsWithMissingParent.size();
+        }
+        unresolved = poms.size();
+        while (unresolved > 0) {
+            resolveAll(poms);
+            if (poms.size() == unresolved) {
+                // stale detection
+                break;
+            }
+            unresolved = poms.size();
+        }
+
+        if (pomsWithMissingParent.size() > 0) {
+            System.out.println("POMs with missing parents:");
+            for (Iterator i = pomsWithMissingParent.keySet().iterator(); i.hasNext();) {
+                File pom = (File) i.next();
+                System.out.println("\t" + pom.getAbsolutePath());
+            }
+        }
+        if (pomsWithMissingVersions.size() > 0) {
+            System.out.println("POMs with missing versions:");
+            for (Iterator i = pomsWithMissingVersions.entrySet().iterator(); i.hasNext();) {
+                Entry entry = (Entry) i.next();
+                File pom = (File) entry.getKey();
+                POMInfo pomInfo = (POMInfo) entry.getValue();
+                System.out.println("\t" + pom.getAbsolutePath());
+                for (Iterator j = pomInfo.getDependencies().iterator(); j.hasNext();) {
+                    Dependency dependency = (Dependency)j.next();
+                    if (dependency.getVersion() == null || dependency.getVersion().contains("$")) {
+                        System.out.println("\t\t" + dependency);
+                    }
+                }
+                for (Iterator j = pomInfo.getPlugins().iterator(); j.hasNext();) {
+                    Dependency dependency = (Dependency)j.next();
+                    if (dependency.getVersion() == null || dependency.getVersion().contains("$")) {
+                        System.out.println("\t\t" + dependency);
+                    }
+                }
+            }
+        }
+        System.out.println();
+
+        Set issues = new TreeSet();
+        Map pomsWithIssues = new HashMap();
+        for (Iterator i = resolvedPoms.entrySet().iterator(); i.hasNext();) {
+                Entry entry = (Entry) i.next();
+                File pom = (File) entry.getKey();
+                POMInfo pomInfo = (POMInfo) entry.getValue();
+                for (Iterator j = pomInfo.getDependencies().iterator(); j.hasNext();) {
+                    Dependency dependency = (Dependency)j.next();
+                    if (!dep2info.containsKey(dependency)) {
+                        issues.add("Unpackaged dependency: " + dependency + " in " + pom);
+                        List pomIssues = (List) pomsWithIssues.get(pom);
+                        if (pomIssues == null) {
+                            pomIssues = new ArrayList();
+                            pomsWithIssues.put(pom, pomIssues);
+                        }
+                        pomIssues.add(dependency);
+                    }
+                }
+                for (Iterator j = pomInfo.getPlugins().iterator(); j.hasNext();) {
+                    Dependency dependency = (Dependency)j.next();
+                    if (!dep2info.containsKey(dependency)) {
+                        issues.add("Unpackaged plugin: " + dependency + " in " + pom);
+                        List pomIssues = (List) pomsWithIssues.get(pom);
+                        if (pomIssues == null) {
+                            pomIssues = new ArrayList();
+                            pomsWithIssues.put(pom, pomIssues);
+                        }
+                        pomIssues.add(dependency);
+                    }
+                }
+        }
+
+        for (Iterator i = issues.iterator(); i.hasNext();) {
+            String issue = (String)i.next();
+            System.out.println(issue);
+        }
+        System.out.println();
+
+        // Find the poms with most issues
+        Map pomsWithNumberOfIssues = new TreeMap(Collections.reverseOrder());
+        for (Iterator i = pomsWithIssues.entrySet().iterator(); i.hasNext();) {
+            Entry entry = (Entry) i.next();
+            File pom = (File) entry.getKey();
+            List missingDeps = (List) entry.getValue();
+            int count = missingDeps.size();
+            List orderedPoms = (List) pomsWithNumberOfIssues.get(new Integer(count));
+            if (orderedPoms == null) {
+                orderedPoms = new ArrayList();
+                pomsWithNumberOfIssues.put(new Integer(count), orderedPoms);
+            }
+            orderedPoms.add(pom);
+        }
+        System.out.println("POM files with the most issues:");
+        int count = 0;
+        for (Iterator i = pomsWithNumberOfIssues.values().iterator(); i.hasNext() && count < 10; ) {
+            List orderedPoms = (List) i.next();
+            for (Iterator j = orderedPoms.iterator(); j.hasNext() && count < 10; count++) {
+                File pom = (File) j.next();
+                List missingDeps = (List) pomsWithIssues.get(pom);
+                System.out.println("Missing dependencies in " + pom);
+                for (Iterator k = missingDeps.iterator(); k.hasNext();) {
+                    Dependency dependency = (Dependency)k.next();
+                    System.out.println("\t" + dependency);
+                }
+            }
+        }
+
+    }
+
+    private void resolveAll(Map file2pom) {
+        // copy to avoid concurrent modifications
+        Map copy = new HashMap(file2pom);
+        for (Iterator i = copy.entrySet().iterator(); i.hasNext();) {
+            Entry entry = (Entry) i.next();
+            resolveDependencies((File) entry.getKey(), (POMInfo) entry.getValue());
+        }
+    }
+
+    private void scan(File[] files) {
+        POMReader pomReader = new POMReader();
+        for (int i = 0; i < files.length; i++) {
+            File file = files[i];
+            if (file.isDirectory()) {
+                scan(file.listFiles());
+            } else if (file.getName().endsWith(".pom")) {
+                try {
+                    POMInfo pom = pomReader.readPom(file);
+                    poms.put(file, pom);
+                } catch (XMLStreamException ex) {
+                    ex.printStackTrace();
+                } catch (FileNotFoundException ex) {
+                    ex.printStackTrace();
+                }
+            }
+        }
+    }
+
+    private void resolveDependencies(File file, POMInfo pomInfo) {
+        dep2info.put(pomInfo.getThisPom(), pomInfo);
+        POMInfo parentPOM = null;
+        if (pomInfo.getParent() != null) {
+            parentPOM = (POMInfo) dep2info.get(pomInfo.getParent());
+            if (parentPOM == null) {
+                pomsWithMissingParent.put(file, pomInfo);
+                return;
+            } else {
+                pomsWithMissingParent.remove(file);
+            }
+            if (!resolvedPoms.values().contains(parentPOM)) {
+                return;
+            }
+        }
+
+        resolvedPoms.put(file, pomInfo);
+        poms.remove(file);
+
+        pomInfo.mergeManagement(parentPOM);
+
+        for (Iterator i = pomInfo.getDependencies().iterator(); i.hasNext();) {
+            Dependency dependency = (Dependency) i.next();
+            if (dependency.getVersion() == null) {
+                pomsWithMissingVersions.put(file, pomInfo);
+            }
+        }
+        for (Iterator i = pomInfo.getPlugins().iterator(); i.hasNext();) {
+            Dependency dependency = (Dependency) i.next();
+            if (dependency.getVersion() == null) {
+                pomsWithMissingVersions.put(file, pomInfo);
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        String repoLocation = "/usr/share/maven-repo";
+        if (args.length > 0) {
+            repoLocation = args[0];
+        }
+        System.out.println("Scanning repository...");
+        new Repository(new File(repoLocation)).scan();
+        System.out.println("Done.");
+    }
+}

Added: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Rule.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,84 @@
+package org.debian.maven.repo;
+
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class Rule {
+    private static Pattern generic = Pattern.compile("([\\[\\?\\+\\*\\|])|([^\\\\]\\.)");
+
+    private Pattern pattern;
+    private String replace;
+    private String rule;
+
+    public Rule(String rule) {
+        this.rule = rule;
+        if (rule.startsWith("s/")) {
+            StringTokenizer st = new StringTokenizer(rule, "/");
+            st.nextToken();
+            pattern = Pattern.compile(st.nextToken());
+            replace = st.nextToken();
+        } else {
+            pattern = Pattern.compile(rule.replace(".", "\\.").replace("*", "(.*)"));
+            replace = rule.replace("*", "$1");
+        }
+    }
+
+    public boolean match(String s) {
+        if (s == null) {
+            return isGeneric();
+        }
+        return pattern.matcher(s).matches();
+    }
+
+    public String apply(String s) {
+        if (s == null) {
+            return null;
+        }
+        Matcher m = pattern.matcher(s);
+        StringBuffer sb = new StringBuffer();
+        while (m.find()) {
+            if (m.start() < m.end()) {
+                m.appendReplacement(sb, replace);
+            }
+        }
+       // m.appendTail(sb);
+        return sb.toString();
+    }
+
+    public boolean isGeneric() {
+        return generic.matcher(pattern.pattern()).find();
+    }
+
+    public String getPattern() {
+        return pattern.pattern();
+    }
+    
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Rule other = (Rule) obj;
+        if (this.pattern != other.pattern && (this.pattern == null || !this.pattern.equals(other.pattern))) {
+            return false;
+        }
+        if ((this.replace == null) ? (other.replace != null) : !this.replace.equals(other.replace)) {
+            return false;
+        }
+        return true;
+    }
+
+    public int hashCode() {
+        int hash = 7;
+        hash = 89 * hash + (this.pattern != null ? this.pattern.hashCode() : 0);
+        hash = 89 * hash + (this.replace != null ? this.replace.hashCode() : 0);
+        return hash;
+    }
+
+    public String toString() {
+        return rule;
+    }
+}
\ No newline at end of file

Modified: trunk/maven-repo-helper/src/main/share/mh_lib.sh
===================================================================
--- trunk/maven-repo-helper/src/main/share/mh_lib.sh	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/share/mh_lib.sh	2009-06-07 12:53:01 UTC (rev 8319)
@@ -4,7 +4,7 @@
 # - package selection
 #
 
-VERSION=0.2
+MH_VERSION=${MH_VERSION:-0.5}
 
 parseargs()
 {
@@ -12,7 +12,7 @@
    ARGV=()
    while [ -n "$1" ]; do
       if [ "-V" = "$1" ] || [ "--version" = "$1" ]; then
-         echo "Maven Repo Helper version $VERSION"
+         echo "Maven Repo Helper version $MH_VERSION"
          exit 0
       elif [ "-h" = "$1" ] || [ "--help" = "$1" ]; then
          syntax
@@ -61,4 +61,4 @@
       fi
       shift
    done
-}
\ No newline at end of file
+}

Deleted: trunk/maven-repo-helper/src/main/share/postinst.tmpl
===================================================================
--- trunk/maven-repo-helper/src/main/share/postinst.tmpl	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/share/postinst.tmpl	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,42 +0,0 @@
-DEBIAN_POM="/usr/share/maven-repo/org/debian/debian-parent/1.0-SNAPSHOT/debian-parent-1.0-SNAPSHOT.pom"
-
-LIBRARIES="#LIBRARIES#"
-PACKAGE="#PACKAGE#"
-
-if [ ! -f $DEBIAN_POM ]; then
-    mkdir -p $(dirname $DEBIAN_POM)
-    echo "<?xml version="1.0" encoding="UTF-8"?>" > $DEBIAN_POM
-    echo "<project>"  >> $DEBIAN_POM
-    echo "  <groupId>org.debian</groupId>"  >> $DEBIAN_POM
-    echo "  <artifactId>debian-parent</artifactId>"  >> $DEBIAN_POM
-    echo "  <version>1.0-SNAPSHOT</version>"  >> $DEBIAN_POM
-    echo "  <properties>"  >> $DEBIAN_POM
-    echo "  </properties>"  >> $DEBIAN_POM
-    echo "</project>"  >> $DEBIAN_POM
-fi
-
-add_repo_property() {
-    VERSION_PROPERTY=$1
-    LIBVER=$2
-    if [ $(grep "<${VERSION_PROPERTY}\.version>" $DEBIAN_POM) ]; then
-        # Update version
-        cat $DEBIAN_POM | sed "s,<${VERSION_PROPERTY}\.version>.*</,<${VERSION_PROPERTY}.version>$LIBVER</," > pom.tmp
-    else
-        cat $DEBIAN_POM | grep -v "</properties>" | grep -v "</project>" > pom.tmp
-        echo "    <${VERSION_PROPERTY}.package>$PACKAGE</${VERSION_PROPERTY}.package>" >> pom.tmp
-        echo "    <${VERSION_PROPERTY}.version>$LIBVER</${VERSION_PROPERTY}.version>" >> pom.tmp
-        echo "  </properties>"  >> pom.tmp
-        echo "</project>"  >> pom.tmp
-    fi
-    rm $DEBIAN_POM
-    mv pom.tmp $DEBIAN_POM
-}
-
-if [ "$1" = "configure" ]; then
-    echo $LIBRARIES | tr ',' '\n' | while read VERSION_PROPERTY LIBVER; do
-        if [ ! -z "$VERSION_PROPERTY" ]; then
-            add_repo_property $VERSION_PROPERTY $LIBVER
-        fi
-    done
-fi
-

Deleted: trunk/maven-repo-helper/src/main/share/postrm.tmpl
===================================================================
--- trunk/maven-repo-helper/src/main/share/postrm.tmpl	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/main/share/postrm.tmpl	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,45 +0,0 @@
-DEBIAN_POM="/usr/share/maven-repo/org/debian/debian-parent/1.0-SNAPSHOT/debian-parent-1.0-SNAPSHOT.pom"
-
-LIBRARIES="#LIBRARIES#"
-
-remove_repo_property() {
-    VERSION_PROPERTY=$1
-    cat $DEBIAN_POM | grep -v "<$VERSION_PROPERTY" > pom.tmp
-    rm $DEBIAN_POM
-    mv pom.tmp $DEBIAN_POM
-}
-
-properties_start_tag_line() {
-    grep -n "<properties>" $DEBIAN_POM | cut -d':' -f1
-}
-
-properties_end_tag_line() {
-    grep -n "</properties>" $DEBIAN_POM | cut -d':' -f1
-}
-
-case "$1" in 
-  remove|purge)
-    echo $LIBRARIES | tr ',' '\n' | while read VERSION_PROPERTY LIBVER; do
-        if [ ! -z "$VERSION_PROPERTY" ]; then
-            remove_repo_property $VERSION_PROPERTY
-        fi
-    done
-    # Detect if DEBIAN_POM is empty
-    TAG_START=$(properties_start_tag_line)
-    TAG_END=$(properties_end_tag_line)
-    if [ $(($TAG_START+1)) -eq $TAG_END ]; then
-        rm $DEBIAN_POM
-        rmdir --ignore-fail-on-non-empty -p $(dirname $DEBIAN_POM)
-    fi
-    ;;
-
-  upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-    # Nothing to do here
-    ;;
-
-  *)
-    echo "$0 called with unknown argument \`$1'" >&2
-    exit 1
-  ;;
-esac
-

Deleted: trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/DebianPOMTest.java
===================================================================
--- trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/DebianPOMTest.java	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/DebianPOMTest.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,91 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.debian.maven.repo;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Before;
-import org.junit.Test;
-import static org.custommonkey.xmlunit.XMLAssert.*;
-
-/**
- *
- * @author ludo
- */
-public class DebianPOMTest extends TestBase {
-
-    Map<String, String> libraryProperties;
-
-    @Before
-    @Override
-    public void setUp() {
-        super.setUp();
-        libraryProperties = new HashMap<String, String>();
-    }
-
-    /**
-     * Test of addLibrary method, of class DebianPOM.
-     */
-    @Test
-    public void testAddLibrariesToNewDebianPOM() throws Exception {
-        DebianPOM instance = new DebianPOM();
-        libraryProperties.put("library.jar.debian.version", "1.0");
-        libraryProperties.put("library.jar.debian.package", "libtest-java");
-        instance.addLibrary(pom, updatedPom, libraryProperties);
-        assertXMLEqual(read("new.pom"), read(pom));
-
-        libraryProperties.put("library2.jar.debian.version", "3.0");
-        libraryProperties.put("library2.jar.debian.package", "libother-java");
-        instance.addLibrary(pom, updatedPom, libraryProperties);
-        assertXMLEqual(read("new2.pom"), read(pom));
-    }
-
-    /**
-     * Test of addLibrary method, of class DebianPOM.
-     */
-    @Test
-    public void testUpdateLibraries() throws Exception {
-        usePom("new.pom");
-        DebianPOM instance = new DebianPOM();
-
-        libraryProperties.put("library.jar.debian.version", "1.1");
-        instance.addLibrary(pom, updatedPom, libraryProperties);
-        assertXMLEqual(read("updated.pom"), read(pom));
-    }
-
-    /**
-     * Test of removeLibrary method, of class DebianPOM.
-     */
-    @Test
-    public void testRemoveLibrary() throws Exception {
-        usePom("new2.pom");
-        DebianPOM instance = new DebianPOM();
-
-        instance.removeLibrary(pom, updatedPom, "library2.jar.debian.version", "library2.jar.debian.package");
-        assertXMLEqual(read("new.pom"), read(pom));
-
-        instance.removeLibrary(pom, updatedPom, "library.jar.debian.version", "library.jar.debian.package");
-        assertXMLEqual(read("empty.pom"), read(pom));
-    }
-
-    /**
-     * Test of main method, of class DebianPOM.
-     */
-    @Test
-    public void testMain() throws Exception {
-        String[] args = {"add", "tmp/original.pom", "library.jar.debian", "1.0", "libtest-java"};
-        DebianPOM.main(args);
-        assertXMLEqual(read("new.pom"), read(pom));
-
-        args = new String[] {"add", "tmp/original.pom", "library2.jar.debian", "3.0", "libother-java"};
-        DebianPOM.main(args);
-        assertXMLEqual(read("new2.pom"), read(pom));
-
-        args = new String[] {"remove", "tmp/original.pom", "library2.jar.debian"};
-        DebianPOM.main(args);
-        assertXMLEqual(read("new.pom"), read(pom));
-    }
-
-}
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/DependencyRuleTest.java
===================================================================
--- trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/DependencyRuleTest.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/DependencyRuleTest.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,55 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.debian.maven.repo;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author ludo
+ */
+public class DependencyRuleTest extends TestCase {
+    
+    /**
+     * Test of matches method, of class DependencyRule.
+     */
+    public void testMatches() {
+        Dependency dependency = new Dependency("javax.servlet", "servlet-api", "jar", "2.3");
+        DependencyRule generic = new DependencyRule("");
+        DependencyRule servlet23 = new DependencyRule("javax.servlet * * 2.3");
+        DependencyRule log4j12 = new DependencyRule("log4j log4j jar s/1\\.2\\..*/1.2.x/");
+        assertTrue(generic.matches(dependency));
+        assertTrue(servlet23.matches(dependency));
+        assertFalse(log4j12.matches(dependency));
+    }
+
+    /**
+     * Test of apply method, of class DependencyRule.
+     */
+    public void testApply() {
+        Dependency dependency = new Dependency("javax.servlet", "servlet-api", "jar", "2.3");
+        DependencyRule generic = new DependencyRule("");
+        DependencyRule servlet23 = new DependencyRule("javax.servlet * * 2.3");
+        assertEquals(new Dependency("javax.servlet", "servlet-api", "jar", "debian"), generic.apply(dependency));
+        assertEquals(new Dependency("javax.servlet", "servlet-api", "jar", "2.3"), servlet23.apply(dependency));
+    }
+
+    /**
+     * Test of compareTo method, of class DependencyRule.
+     */
+    public void testCompareTo() {
+        DependencyRule generic = new DependencyRule("");
+        DependencyRule servlet23 = new DependencyRule("javax.servlet * * 2.3");
+        DependencyRule log4j12 = new DependencyRule("log4j log4j jar s/1\\.2\\..*/1.2.x/");
+        assertTrue(generic.compareTo(servlet23) > 0);
+        assertTrue(generic.compareTo(log4j12) > 0);
+        assertTrue(servlet23.compareTo(log4j12) > 0);
+        assertTrue(servlet23.compareTo(generic) < 0);
+        assertTrue(log4j12.compareTo(servlet23) < 0);
+        assertEquals(0, servlet23.compareTo(servlet23));
+    }
+
+}

Modified: trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMCleanerTest.java
===================================================================
--- trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMCleanerTest.java	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMCleanerTest.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -6,10 +6,7 @@
 
 import java.io.File;
 import java.io.FileReader;
-import java.util.ArrayList;
 import java.util.Properties;
-import org.junit.Test;
-import static org.custommonkey.xmlunit.XMLAssert.*;
 
 /**
  *
@@ -18,20 +15,14 @@
 public class POMCleanerTest extends TestBase {
 
     private File pomProperties;
-    private File versionProperties;
     private File specialDependencies;
 
-    @Override
     public void tearDown() {
         super.tearDown();
         if (specialDependencies != null && specialDependencies.exists()) {
             specialDependencies.delete();
             specialDependencies = null;
         }
-        if (versionProperties != null && versionProperties.exists()) {
-            versionProperties.delete();
-            versionProperties = null;
-        }
         if (pomProperties != null && pomProperties.exists()) {
             pomProperties.delete();
             pomProperties = null;
@@ -41,65 +32,149 @@
     /**
      * Test of cleanPom method, of class POMCleaner.
      */
-    @Test
     public void testCleanMavenPom() throws Exception {
         pomProperties = new File(testDir, "pom.properties");
-        versionProperties = new File(testDir, "versions.properties");
         usePom("maven.xml");
-        boolean inheritFromDebian = true;
+        boolean noParent = true;
         POMCleaner instance = new POMCleaner();
-        ArrayList<Dependency> specialCases = new ArrayList<Dependency>();
-        specialCases.add(new Dependency("org.apache.maven", "*", "*", "debian"));
-        specialCases.add(new Dependency("org.apache.maven.reporting", "*", "jar", "debian"));
-        specialCases.add(new Dependency("org.apache.maven.wagon", "*", "jar", "debian"));
-        instance.cleanPom(pom, updatedPom, pomProperties, versionProperties, inheritFromDebian, specialCases);
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("org.codehaus.plexus plexus-container-default jar s/1\\.0-alpha-.*/1.0-alpha/"));
+        instance.cleanPom(pom, updatedPom, pomProperties, noParent, false, "maven2");
         assertXMLEqual(read("maven.cleaned"), read(updatedPom));
         Properties pomInfo = new Properties();
         pomInfo.load(new FileReader(pomProperties));
-        assertEquals("org.apache.maven", pomInfo.get("GROUP_ID"));
-        assertEquals("maven", pomInfo.get("ARTIFACT_ID"));
-        assertEquals("pom", pomInfo.get("TYPE"));
-        assertEquals("2.1.0-SNAPSHOT", pomInfo.get("VERSION"));
-        Properties versions = new Properties();
-        versions.load(new FileReader(versionProperties));
-        assertEquals("2.1.0-SNAPSHOT", versions.get("org.apache.maven.__.__.debian.version"));
+        assertEquals("org.apache.maven", pomInfo.get("groupId"));
+        assertEquals("maven", pomInfo.get("artifactId"));
+        assertEquals("pom", pomInfo.get("type"));
+        assertEquals("2.1.0-SNAPSHOT", pomInfo.get("version"));
+        assertEquals("debian", pomInfo.get("debianVersion"));
     }
 
     /**
      * Test of cleanPom method, of class POMCleaner.
      */
-    @Test
     public void testCleanModelloPom() throws Exception {
         pomProperties = new File(testDir, "pom.properties");
-        versionProperties = new File(testDir, "versions.properties");
         usePom("modello-core.xml");
-        boolean inheritFromDebian = false;
+        boolean noParent = false;
         POMCleaner instance = new POMCleaner();
-        ArrayList<Dependency> specialCases = new ArrayList<Dependency>();
-        specialCases.add(new Dependency("org.codehaus.modello", "*", "jar", "debian"));
-        instance.cleanPom(pom, updatedPom, pomProperties, versionProperties, inheritFromDebian, specialCases);
+        instance.addDefaultRules();
+        instance.cleanPom(pom, updatedPom, pomProperties, noParent, false, "libmodello-java");
         assertXMLEqual(read("modello-core.cleaned"), read(updatedPom));
-        Properties versions = new Properties();
-        versions.load(new FileReader(versionProperties));
-        assertEquals("1.0-alpha-22", versions.get("org.codehaus.modello.__.jar.debian.version"));
+        Properties pomInfo = new Properties();
+        pomInfo.load(new FileReader(pomProperties));
+        assertEquals("org.codehaus.modello", pomInfo.get("groupId"));
+        assertEquals("modello-core", pomInfo.get("artifactId"));
+        assertEquals("jar", pomInfo.get("type"));
+        assertEquals("1.0-alpha-22", pomInfo.get("version"));
+        assertEquals("debian", pomInfo.get("debianVersion"));
+
+        instance.cleanPom(pom, updatedPom, pomProperties, noParent, true, "libmodello-java");
+        assertXMLEqual(read("modello-core.keep.cleaned"), read(updatedPom));
+        pomInfo = new Properties();
+        pomInfo.load(new FileReader(pomProperties));
+        assertEquals("org.codehaus.modello", pomInfo.get("groupId"));
+        assertEquals("modello-core", pomInfo.get("artifactId"));
+        assertEquals("jar", pomInfo.get("type"));
+        assertEquals("1.0-alpha-22", pomInfo.get("version"));
+        assertEquals("debian", pomInfo.get("debianVersion"));
+
     }
 
     /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testCleanWagonPom() throws Exception {
+        pomProperties = new File(testDir, "pom.properties");
+        usePom("wagon-http-lightweight.xml");
+        boolean noParent = false;
+        POMCleaner instance = new POMCleaner();
+        instance.addDefaultRules();
+        instance.cleanPom(pom, updatedPom, pomProperties, noParent, false, "libwagon-java");
+        assertXMLEqual(read("wagon-http-lightweight.cleaned"), read(updatedPom));
+        Properties pomInfo = new Properties();
+        pomInfo.load(new FileReader(pomProperties));
+        assertEquals("org.apache.maven.wagon", pomInfo.get("groupId"));
+        assertEquals("wagon-http-lightweight", pomInfo.get("artifactId"));
+        assertEquals("jar", pomInfo.get("type"));
+        assertEquals("1.0-beta-5", pomInfo.get("version"));
+        assertEquals("debian", pomInfo.get("debianVersion"));
+    }
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testCleanPlexusContainerDefaultPom() throws Exception {
+        pomProperties = new File(testDir, "pom.properties");
+        usePom("plexus-container-default.xml");
+        boolean noParent = true;
+        POMCleaner instance = new POMCleaner();
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("org.codehaus.plexus plexus-container-default jar s/1\\.0-alpha-.*/1.0-alpha/"));
+        instance.cleanPom(pom, updatedPom, pomProperties, noParent, false, "libplexus-container-default-java");
+        assertXMLEqual(read("plexus-container-default.cleaned"), read(updatedPom));
+        Properties pomInfo = new Properties();
+        pomInfo.load(new FileReader(pomProperties));
+        assertEquals("org.codehaus.plexus", pomInfo.get("groupId"));
+        assertEquals("plexus-container-default", pomInfo.get("artifactId"));
+        assertEquals("jar", pomInfo.get("type"));
+        assertEquals("1.0-alpha-9-stable-1", pomInfo.get("version"));
+        assertEquals("1.0-alpha", pomInfo.get("debianVersion"));
+    }
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testCleanSlf4jPom() throws Exception {
+        pomProperties = new File(testDir, "pom.properties");
+        usePom("slf4j.xml");
+        boolean noParent = true;
+        POMCleaner instance = new POMCleaner();
+        instance.addDefaultRules();
+        instance.cleanPom(pom, updatedPom, pomProperties, noParent, false, "libslf4j-java");
+        assertXMLEqual(read("slf4j.cleaned"), read(updatedPom));
+        Properties pomInfo = new Properties();
+        pomInfo.load(new FileReader(pomProperties));
+        assertEquals("org.slf4j", pomInfo.get("groupId"));
+        assertEquals("slf4j-parent", pomInfo.get("artifactId"));
+        assertEquals("pom", pomInfo.get("type"));
+        assertEquals("1.5.6", pomInfo.get("version"));
+        assertEquals("debian", pomInfo.get("debianVersion"));
+    }
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testCleanCommonsValidatorPom() throws Exception {
+        pomProperties = new File(testDir, "pom.properties");
+        usePom("commons-validator.xml");
+        boolean noParent = true;
+        POMCleaner instance = new POMCleaner();
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("junit junit jar s/3\\..*/3.x/"));
+        instance.cleanPom(pom, updatedPom, pomProperties, noParent, false, "libcommons-validator-java");
+        assertXMLEqual(read("commons-validator.cleaned"), read(updatedPom));
+        Properties pomInfo = new Properties();
+        pomInfo.load(new FileReader(pomProperties));
+        assertEquals("commons-validator", pomInfo.get("groupId"));
+        assertEquals("commons-validator", pomInfo.get("artifactId"));
+        assertEquals("jar", pomInfo.get("type"));
+        assertEquals("1.3.1", pomInfo.get("version"));
+        assertEquals("debian", pomInfo.get("debianVersion"));
+    }
+
+
+    /**
      * Test of main method, of class DebianPOM.
      */
-    @Test
     public void testMain() throws Exception {
         specialDependencies = new File(testDir, "special-cases.txt");
         pomProperties = new File(testDir, "pom.properties");
-        versionProperties = new File(testDir, "versions.properties");
         usePom("maven.xml");
-        useFile("maven.spec", specialDependencies);
-        String[] args = {"--debian-parent", pom.getAbsolutePath(), updatedPom.getAbsolutePath(),
-            pomProperties.getAbsolutePath(), versionProperties.getAbsolutePath(), specialDependencies.getAbsolutePath()};
+        useFile("maven.rules", specialDependencies);
+        String[] args = {"--no-parent", "-pmaven2", "-r" + specialDependencies.getAbsolutePath(),
+            pom.getAbsolutePath(), updatedPom.getAbsolutePath(), pomProperties.getAbsolutePath() };
         POMCleaner.main(args);
         assertXMLEqual(read("maven.cleaned"), read(updatedPom));
-        Properties versions = new Properties();
-        versions.load(new FileReader(versionProperties));
-        assertEquals("2.1.0-SNAPSHOT", versions.get("org.apache.maven.__.__.debian.version"));
     }
 }
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMReaderTest.java
===================================================================
--- trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMReaderTest.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMReaderTest.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,67 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.debian.maven.repo;
+
+/**
+ *
+ * @author ludo
+ */
+public class POMReaderTest extends TestBase {
+
+    /**
+     * Test of cleanPom method, of class POMReader.
+     */
+    public void testReadMavenPom() throws Exception {
+        usePom("maven.xml");
+        POMReader instance = new POMReader();
+        POMInfo info = instance.readPom(pom);
+        assertNotNull(info.getParent());
+        assertEquals("org.apache.maven", info.getParent().getGroupId());
+        assertEquals("maven-parent", info.getParent().getArtifactId());
+        assertEquals("11", info.getParent().getVersion());
+        assertEquals("pom", info.getParent().getType());
+
+        assertEquals("org.apache.maven", info.getThisPom().getGroupId());
+        assertEquals("maven", info.getThisPom().getArtifactId());
+        assertEquals("2.1.0-SNAPSHOT", info.getThisPom().getVersion());
+        assertEquals("pom", info.getThisPom().getType());
+
+        assertEquals(1, info.getDependencies().size());
+        Dependency dependency = (Dependency) info.getDependencies().get(0);
+        assertEquals("junit", dependency.getGroupId());
+        assertEquals("junit", dependency.getArtifactId());
+        assertEquals("3.8.1", dependency.getVersion());
+        assertEquals("jar", dependency.getType());
+
+        assertEquals(34, info.getDependencyManagement().size());
+        dependency = (Dependency) info.getDependencyManagement().get(0);
+        assertEquals("org.apache.maven", dependency.getGroupId());
+        assertEquals("maven-plugin-descriptor", dependency.getArtifactId());
+        assertEquals("2.1.0-SNAPSHOT", dependency.getVersion());
+        assertEquals("jar", dependency.getType());
+
+        assertEquals(0, info.getProfileDependencies().size());
+        assertEquals(0, info.getProfileDependencyManagement().size());
+
+        assertEquals(14, info.getPluginManagement().size());
+        dependency = (Dependency) info.getPluginManagement().get(0);
+        assertEquals("org.apache.maven.plugins", dependency.getGroupId());
+        assertEquals("maven-jar-plugin", dependency.getArtifactId());
+        assertEquals("2.1", dependency.getVersion());
+        assertEquals("maven-plugin", dependency.getType());
+
+        assertEquals(6, info.getPlugins().size());
+        dependency = (Dependency) info.getPlugins().get(0);
+        assertEquals("org.codehaus.mojo", dependency.getGroupId());
+        assertEquals("clirr-maven-plugin", dependency.getArtifactId());
+        assertEquals(null, dependency.getVersion());
+        assertEquals("maven-plugin", dependency.getType());
+
+        assertEquals(2, info.getProperties().size());
+        assertEquals("2.1.0-SNAPSHOT", info.getProperties().get("mavenVersion"));
+        assertEquals("1.0-beta-5", info.getProperties().get("wagonVersion"));
+    }
+
+}
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMTransformerTest.java
===================================================================
--- trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMTransformerTest.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMTransformerTest.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,64 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.debian.maven.repo;
+
+/**
+ *
+ * @author ludo
+ */
+public class POMTransformerTest extends TestBase {
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testTransformMavenPom() throws Exception {
+        usePom("maven.xml");
+        boolean noParent = true;
+        POMTransformer instance = new POMTransformer();
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("org.codehaus.plexus plexus-container-default jar s/1\\.0-alpha-.*/1.0-alpha/"));
+        instance.addRule(new DependencyRule("org.apache.maven.plugins maven-assembly-plugin maven-plugin s/.*/2.2/"));
+        instance.transformPom(pom, updatedPom, noParent, false, null);
+        assertXMLEqual(read("maven.transformed"), read(updatedPom));
+    }
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testTransformMavenCorePom() throws Exception {
+        usePom("maven-core.xml");
+        boolean noParent = false;
+        POMTransformer instance = new POMTransformer();
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("org.codehaus.plexus plexus-container-default jar s/1\\.0-alpha-.*/1.0-alpha/"));
+        instance.transformPom(pom, updatedPom, noParent, false, "maven2");
+        assertXMLEqual(read("maven-core.transformed"), read(updatedPom));
+    }
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testTransformModelloPom() throws Exception {
+        usePom("modello-core.xml");
+        boolean noParent = false;
+        POMTransformer instance = new POMTransformer();
+        instance.addDefaultRules();
+        instance.transformPom(pom, updatedPom, noParent, false, "libmodello-java");
+        assertXMLEqual(read("modello-core.transformed"), read(updatedPom));
+    }
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testTransformPlexusContainerDefaultPom() throws Exception {
+        usePom("plexus-container-default.xml");
+        POMTransformer instance = new POMTransformer();
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("org.codehaus.plexus plexus-container-default jar s/1\\.0-alpha-.*/1.0-alpha/"));
+        instance.transformPom(pom, updatedPom);
+        assertXMLEqual(read("plexus-container-default.transformed"), read(updatedPom));
+    }
+
+}
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/RuleTest.java
===================================================================
--- trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/RuleTest.java	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/RuleTest.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,107 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.debian.maven.repo;
+
+/**
+ *
+ * @author ludo
+ */
+public class RuleTest extends TestBase {
+    
+    /**
+     * Test of match method, of class Rule.
+     */
+    public void testMatch() {
+        Rule simple = new Rule("test");
+        assertFalse(simple.match("xxx"));
+        assertTrue(simple.match("test"));
+        assertFalse(simple.match("test2"));
+
+        Rule simpleReplace = new Rule("s/test/foo/");
+        assertFalse(simpleReplace.match("xxx"));
+        assertTrue(simpleReplace.match("test"));
+        assertFalse(simpleReplace.match("test2"));
+
+        Rule complexReplace = new Rule("s/test(.*)/foo$1/");
+        assertFalse(complexReplace.match("xxx"));
+        assertTrue(complexReplace.match("test"));
+        assertTrue(complexReplace.match("test2"));
+
+        Rule complexReplace2 = new Rule("s/.*/debian/");
+        assertTrue(complexReplace2.match("xxx"));
+        assertTrue(complexReplace2.match("test"));
+        assertTrue(complexReplace2.match("test2"));
+
+        Rule generic = new Rule("*");
+        assertTrue(generic.match("xxx"));
+        assertTrue(generic.match("test"));
+        assertTrue(generic.match("test2"));
+
+        Rule generic2 = new Rule("test*");
+        assertFalse(generic2.match("xxx"));
+        assertTrue(generic2.match("test"));
+        assertTrue(generic2.match("test2"));
+
+    }
+
+    /**
+     * Test of apply method, of class Rule.
+     */
+    public void testApply() {
+        Rule simple = new Rule("test");
+        assertEquals("test", simple.apply("test"));
+
+        Rule simpleReplace = new Rule("s/test/foo/");
+        assertEquals("foo", simpleReplace.apply("test"));
+
+        Rule complexReplace = new Rule("s/test(.*)/foo$1/");
+        assertEquals("foo", complexReplace.apply("test"));
+        assertEquals("foo2", complexReplace.apply("test2"));
+
+        Rule complexReplace2 = new Rule("s/.*/debian/");
+        assertEquals("debian", complexReplace2.apply("xxx"));
+        assertEquals("debian", complexReplace2.apply("test"));
+        assertEquals("debian", complexReplace2.apply("test2"));
+
+        Rule generic = new Rule("*");
+        assertEquals("xxx", generic.apply("xxx"));
+        assertEquals("test", generic.apply("test"));
+        assertEquals("test2", generic.apply("test2"));
+
+        Rule generic2 = new Rule("test*");
+        assertEquals("test", generic2.apply("test"));
+        assertEquals("test2", generic2.apply("test2"));
+
+    }
+
+    /**
+     * Test of apply method, of class Rule.
+     */
+    public void testIsGeneric() {
+        Rule simple = new Rule("test");
+        assertFalse(simple.isGeneric());
+
+        Rule simpleWithDot = new Rule("test.stuff");
+        assertFalse(simpleWithDot.isGeneric());
+
+        Rule simpleReplace = new Rule("s/test/foo/");
+        assertFalse(simpleReplace.isGeneric());
+
+        Rule complexReplace = new Rule("s/test(.*)/foo$1/");
+        assertTrue(complexReplace.isGeneric());
+
+        Rule complexReplace2 = new Rule("s/.*/debian/");
+        assertTrue(complexReplace2.isGeneric());
+
+        Rule generic = new Rule("*");
+        assertTrue(generic.isGeneric());
+
+        Rule generic2 = new Rule("test*");
+        assertTrue(generic2.isGeneric());
+
+    }
+
+}

Modified: trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/TestBase.java
===================================================================
--- trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/TestBase.java	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/TestBase.java	2009-06-07 12:53:01 UTC (rev 8319)
@@ -12,45 +12,32 @@
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.apache.commons.io.IOUtils;
+import org.custommonkey.xmlunit.XMLTestCase;
 import org.custommonkey.xmlunit.XMLUnit;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
 
 /**
  *
  * @author ludo
  */
-public class TestBase {
+public class TestBase extends XMLTestCase {
 
     protected static File testDir = new File("tmp");
-    private List<Reader> openedReaders = new ArrayList();
+    private List openedReaders = new ArrayList();
     protected File pom;
     protected File updatedPom;
 
-    @BeforeClass
-    public static void setUpClass() throws Exception {
-        testDir.mkdir();
-        XMLUnit.setIgnoreWhitespace(true);
-    }
-
-    @AfterClass
-    public static void tearDownClass() throws Exception {
-        testDir.delete();
-    }
-
-    @Before
     public void setUp() {
+        XMLUnit.setIgnoreWhitespace(true);
+        testDir.mkdir();
         pom = new File(testDir, "original.pom");
         updatedPom = new File(testDir, "updated.pom");
     }
 
-    @After
     public void tearDown() {
         if (pom.exists()) {
             pom.delete();
@@ -58,7 +45,8 @@
         if (updatedPom.exists()) {
             updatedPom.delete();
         }
-        for (Reader reader : openedReaders) {
+        for (Iterator i = openedReaders.iterator(); i.hasNext(); ) {
+            Reader reader = (Reader) i.next();
             try {
                 reader.close();
             } catch (IOException ex) {
@@ -66,6 +54,7 @@
             }
         }
         openedReaders.clear();
+        testDir.delete();
     }
 
     protected void useFile(String resource, File file) throws IOException {

Added: trunk/maven-repo-helper/src/test/resources/commons-validator.cleaned
===================================================================
--- trunk/maven-repo-helper/src/test/resources/commons-validator.cleaned	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/commons-validator.cleaned	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>commons-validator</groupId>
+	<artifactId>commons-validator</artifactId>
+	<version>debian</version>
+	<packaging>jar</packaging>
+	<properties>
+		<debian.originalVersion>1.3.1</debian.originalVersion>
+		<debian.package>libcommons-validator-java</debian.package>
+	</properties>
+
+	<name>Validator</name>
+	<description>Commons Validator provides the building blocks for both client side validation
+    and server side data validation. It may be used standalone or with a framework likeStruts.</description>
+	<url>http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/</url>
+	<issueManagement>
+		<url>http://issues.apache.org/jira/</url>
+	</issueManagement>
+	<inceptionYear>2002</inceptionYear>
+	<mailingLists>
+		<mailingList>
+			<name>Commons Dev List</name>
+			<subscribe>commons-dev-subscribe at jakarta.apache.org</subscribe>
+			<unsubscribe>commons-dev-unsubscribe at jakarta.apache.org</unsubscribe>
+			<archive>http://mail-archives.apache.org/mod_mbox/jakarta-commons-dev/</archive>
+		</mailingList>
+		<mailingList>
+			<name>Commons User List</name>
+			<subscribe>commons-user-subscribe at jakarta.apache.org</subscribe>
+			<unsubscribe>commons-user-unsubscribe at jakarta.apache.org</unsubscribe>
+			<archive>http://mail-archives.apache.org/mod_mbox/jakarta-commons-user/</archive>
+		</mailingList>
+	</mailingLists>
+	<developers>
+		<developer>
+			<id>mrdon</id>
+			<name>Don Brown</name>
+			<email>mrdon at apache.org</email>
+		</developer>
+		<developer>
+			<id>martinc</id>
+			<name>Martin Cooper</name>
+			<email>martinc at apache.org</email>
+		</developer>
+		<developer>
+			<id>dgraham</id>
+			<name>David Graham</name>
+			<email>dgraham at apache.org</email>
+		</developer>
+		<developer>
+			<id>husted</id>
+			<name>Ted Husted</name>
+			<email>husted at apache.org</email>
+		</developer>
+		<developer>
+			<id>rleland</id>
+			<name>Rob Leland</name>
+			<email>rleland at apache.org</email>
+		</developer>
+		<developer>
+			<id>craigmcc</id>
+			<name>Craig McClanahan</name>
+			<email>craigmcc at apache.org</email>
+		</developer>
+		<developer>
+			<id>jmitchell</id>
+			<name>James Mitchell</name>
+			<email>jmitchell NOSPAM apache.org</email>
+			<organization>EdgeTech, Inc</organization>
+		</developer>
+		<developer>
+			<id>niallp</id>
+			<name>Niall Pemberton</name>
+		</developer>
+		<developer>
+			<id>turner</id>
+			<name>James Turner</name>
+			<email>turner at apache.org</email>
+		</developer>
+		<developer>
+			<id>dwinterfeldt</id>
+			<name>David Winterfeldt</name>
+			<email>dwinterfeldt at apache.org</email>
+		</developer>
+		<developer>
+			<id>bayard</id>
+			<name>Henri Yandell</name>
+		</developer>
+	</developers>
+	<contributors>
+		<contributor>
+			<name>Saul Q Yuan Add</name>
+		</contributor>
+		<contributor>
+			<name>Shane Bailey</name>
+		</contributor>
+		<contributor>
+			<name>Dave Derry</name>
+		</contributor>
+		<contributor>
+			<name>Tim O'Brien</name>
+		</contributor>
+		<contributor>
+			<name>Scott Clasen</name>
+			<email>ticktock at speakeasy.net&gt;</email>
+		</contributor>
+		<contributor>
+			<name>Marcus Brito Finish</name>
+		</contributor>
+		<contributor>
+			<name>Padma Ginnaram</name>
+		</contributor>
+		<contributor>
+			<name>Thomas Jacob</name>
+			<email>thomas.jacob at sinnerschrader.com</email>
+		</contributor>
+		<contributor>
+			<name>Adam Kramer</name>
+		</contributor>
+		<contributor>
+			<name>Greg Ludington</name>
+		</contributor>
+		<contributor>
+			<name>Bjorn-H. Moritz</name>
+		</contributor>
+		<contributor>
+			<name>David Neuer</name>
+			<email>DavidNeuer at nascopgh.com</email>
+		</contributor>
+		<contributor>
+			<name>Kurt Post</name>
+		</contributor>
+		<contributor>
+			<name>Arun Mammen Thomas</name>
+		</contributor>
+		<contributor>
+			<name>Steven Fines</name>
+			<email>steven.fines at cotelligent.com</email>
+		</contributor>
+		<contributor>
+			<name>Didier Romelot</name>
+			<email>didier.romelot at renault.com</email>
+		</contributor>
+		<contributor>
+			<name>Steve Stair</name>
+		</contributor>
+		<contributor>
+			<name>Jeremy Tan</name>
+			<email>jeremytan at scualum.com</email>
+		</contributor>
+		<contributor>
+			<name>94RGt2</name>
+			<email>lmagee at biziworks.com.au</email>
+		</contributor>
+		<contributor>
+			<name>Nacho G. Mac Dowell</name>
+		</contributor>
+		<contributor>
+			<name>Mark Lowe</name>
+			<email>mark.lowe at boxstuff.com</email>
+		</contributor>
+	</contributors>
+	<licenses>
+		<license>
+			<name>The Apache Software License, Version 2.0</name>
+			<url>/LICENSE.txt</url>
+		</license>
+	</licenses>
+	<scm>
+		<connection>scm:svn:http://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.artifactId.substring(8)}/trunk</connection>
+		<url>http://svn.apache.org/viewvc</url>
+	</scm>
+	<organization>
+		<name>The Apache Software Foundation</name>
+		<url>http://jakarta.apache.org</url>
+	</organization>
+	<dependencies>
+		<dependency>
+			<groupId>commons-beanutils</groupId>
+			<artifactId>commons-beanutils</artifactId>
+			<version>debian</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-digester</groupId>
+			<artifactId>commons-digester</artifactId>
+			<version>debian</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-logging</groupId>
+			<artifactId>commons-logging</artifactId>
+			<version>debian</version>
+		</dependency>
+		<dependency>
+			<groupId>oro</groupId>
+			<artifactId>oro</artifactId>
+			<version>debian</version>
+			<optional>true</optional>
+		</dependency>
+		<dependency>
+			<groupId>xml-apis</groupId>
+			<artifactId>xml-apis</artifactId>
+			<version>debian</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.x</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/commons-validator.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/commons-validator.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/commons-validator.xml	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>commons-validator</groupId>
+  <artifactId>commons-validator</artifactId>
+  <name>Validator</name>
+  <version>1.3.1</version>
+  <description>Commons Validator provides the building blocks for both client side validation
+    and server side data validation. It may be used standalone or with a framework like
+    Struts.</description>
+  <url>http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/</url>
+  <issueManagement>
+    <url>http://issues.apache.org/jira/</url>
+  </issueManagement>
+  <ciManagement>
+    <notifiers>
+      <notifier>
+        <configuration>
+          <address>commons-dev at jakarta.apache.org</address>
+        </configuration>
+      </notifier>
+    </notifiers>
+  </ciManagement>
+  <inceptionYear>2002</inceptionYear>
+  <mailingLists>
+    <mailingList>
+      <name>Commons Dev List</name>
+      <subscribe>commons-dev-subscribe at jakarta.apache.org</subscribe>
+      <unsubscribe>commons-dev-unsubscribe at jakarta.apache.org</unsubscribe>
+      <archive>http://mail-archives.apache.org/mod_mbox/jakarta-commons-dev/</archive>
+    </mailingList>
+    <mailingList>
+      <name>Commons User List</name>
+      <subscribe>commons-user-subscribe at jakarta.apache.org</subscribe>
+      <unsubscribe>commons-user-unsubscribe at jakarta.apache.org</unsubscribe>
+      <archive>http://mail-archives.apache.org/mod_mbox/jakarta-commons-user/</archive>
+    </mailingList>
+  </mailingLists>
+  <developers>
+    <developer>
+      <id>mrdon</id>
+      <name>Don Brown</name>
+      <email>mrdon at apache.org</email>
+    </developer>
+    <developer>
+      <id>martinc</id>
+      <name>Martin Cooper</name>
+      <email>martinc at apache.org</email>
+    </developer>
+    <developer>
+      <id>dgraham</id>
+      <name>David Graham</name>
+      <email>dgraham at apache.org</email>
+    </developer>
+    <developer>
+      <id>husted</id>
+      <name>Ted Husted</name>
+      <email>husted at apache.org</email>
+    </developer>
+    <developer>
+      <id>rleland</id>
+      <name>Rob Leland</name>
+      <email>rleland at apache.org</email>
+    </developer>
+    <developer>
+      <id>craigmcc</id>
+      <name>Craig McClanahan</name>
+      <email>craigmcc at apache.org</email>
+    </developer>
+    <developer>
+      <id>jmitchell</id>
+      <name>James Mitchell</name>
+      <email>jmitchell NOSPAM apache.org</email>
+      <organization>EdgeTech, Inc</organization>
+    </developer>
+    <developer>
+      <id>niallp</id>
+      <name>Niall Pemberton</name>
+    </developer>
+    <developer>
+      <id>turner</id>
+      <name>James Turner</name>
+      <email>turner at apache.org</email>
+    </developer>
+    <developer>
+      <id>dwinterfeldt</id>
+      <name>David Winterfeldt</name>
+      <email>dwinterfeldt at apache.org</email>
+    </developer>
+    <developer>
+      <id>bayard</id>
+      <name>Henri Yandell</name>
+    </developer>
+  </developers>
+  <contributors>
+    <contributor>
+      <name>Saul Q Yuan Add</name>
+    </contributor>
+    <contributor>
+      <name>Shane Bailey</name>
+    </contributor>
+    <contributor>
+      <name>Dave Derry</name>
+    </contributor>
+    <contributor>
+      <name>Tim O'Brien</name>
+    </contributor>
+    <contributor>
+      <name>Scott Clasen</name>
+      <email>ticktock at speakeasy.net></email>
+    </contributor>
+    <contributor>
+      <name>Marcus Brito Finish</name>
+    </contributor>
+    <contributor>
+      <name>Padma Ginnaram</name>
+    </contributor>
+    <contributor>
+      <name>Thomas Jacob</name>
+      <email>thomas.jacob at sinnerschrader.com</email>
+    </contributor>
+    <contributor>
+      <name>Adam Kramer</name>
+    </contributor>
+    <contributor>
+      <name>Greg Ludington</name>
+    </contributor>
+    <contributor>
+      <name>Bjorn-H. Moritz</name>
+    </contributor>
+    <contributor>
+      <name>David Neuer</name>
+      <email>DavidNeuer at nascopgh.com</email>
+    </contributor>
+    <contributor>
+      <name>Kurt Post</name>
+    </contributor>
+    <contributor>
+      <name>Arun Mammen Thomas</name>
+    </contributor>
+    <contributor>
+      <name>Steven Fines</name>
+      <email>steven.fines at cotelligent.com</email>
+    </contributor>
+    <contributor>
+      <name>Didier Romelot</name>
+      <email>didier.romelot at renault.com</email>
+    </contributor>
+    <contributor>
+      <name>Steve Stair</name>
+    </contributor>
+    <contributor>
+      <name>Jeremy Tan</name>
+      <email>jeremytan at scualum.com</email>
+    </contributor>
+    <contributor>
+      <name>94RGt2</name>
+      <email>lmagee at biziworks.com.au</email>
+    </contributor>
+    <contributor>
+      <name>Nacho G. Mac Dowell</name>
+    </contributor>
+    <contributor>
+      <name>Mark Lowe</name>
+      <email>mark.lowe at boxstuff.com</email>
+    </contributor>
+  </contributors>
+  <licenses>
+    <license>
+      <name>The Apache Software License, Version 2.0</name>
+      <url>/LICENSE.txt</url>
+    </license>
+  </licenses>
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/jakarta/commons/proper/${pom.artifactId.substring(8)}/trunk</connection>
+    <url>http://svn.apache.org/viewvc</url>
+  </scm>
+  <organization>
+    <name>The Apache Software Foundation</name>
+    <url>http://jakarta.apache.org</url>
+  </organization>
+  <build>
+    <sourceDirectory>src/share</sourceDirectory>
+    <testSourceDirectory>src/test</testSourceDirectory>
+    <resources>
+      <resource>
+        <targetPath>META-INF</targetPath>
+        <directory>${basedir}</directory>
+        <includes>
+          <include>NOTICE.txt</include>
+        </includes>
+      </resource>
+    </resources>
+    <testResources>
+      <testResource>
+        <directory>${pom.build.unitTestSourceDirectory}</directory>
+        <includes>
+          <include>**/*.xml</include>
+        </includes>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/*Test.java</include>
+          </includes>
+          <excludes>
+            <exclude>**/routines/BaseCalendarValidatorTest.java</exclude>
+            <exclude>**/routines/BaseNumberValidatorTest.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-xdoc-plugin</artifactId>
+        <version>1.9.2</version>
+        <configuration>
+          <comment>&lt;strong>Site Only&lt;/strong> - v1.9.2 (minimum)
+              required for building the Validator Site documentation.</comment>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-changelog-plugin</artifactId>
+        <version>1.8.2</version>
+        <configuration>
+          <comment>&lt;strong>Site Only&lt;/strong> - v1.8.2 (minimum)
+              required for building the Validator Site documentation.</comment>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-changes-plugin</artifactId>
+        <version>1.6</version>
+        <configuration>
+          <comment>&lt;strong>Site Only&lt;/strong> - v1.6 (minimum)
+              required for building the Validator Site documentation.</comment>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>maven-plugins</groupId>
+        <artifactId>maven-cobertura-plugin</artifactId>
+        <version>1.1.1</version>
+        <configuration>
+          <scope>test</scope>
+          <comment>Required only for generating test coverage reports.</comment>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>commons-beanutils</groupId>
+      <artifactId>commons-beanutils</artifactId>
+      <version>1.7.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-digester</groupId>
+      <artifactId>commons-digester</artifactId>
+      <version>1.6</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.4</version>
+    </dependency>
+    <dependency>
+      <groupId>oro</groupId>
+      <artifactId>oro</artifactId>
+      <version>2.0.8</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>xml-apis</groupId>
+      <artifactId>xml-apis</artifactId>
+      <version>2.0.2</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <distributionManagement>
+    <repository>
+      <id>default</id>
+      <name>Default Repository</name>
+      <url>file:///www/jakarta.apache.org/builds/jakarta-commons/${pom.artifactId.substring(8)}/</url>
+    </repository>
+    <site>
+      <id>default</id>
+      <name>Default Site</name>
+      <url>scp://people.apache.org//www/jakarta.apache.org/commons/${pom.artifactId.substring(8)}/</url>
+    </site>
+    <status>converted</status>
+  </distributionManagement>
+</project>
\ No newline at end of file

Deleted: trunk/maven-repo-helper/src/test/resources/empty.pom
===================================================================
--- trunk/maven-repo-helper/src/test/resources/empty.pom	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/resources/empty.pom	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project>
-    <groupId>org.debian</groupId>
-    <artifactId>debian-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
-    <properties>
-    </properties>
-</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/maven-core.transformed
===================================================================
--- trunk/maven-repo-helper/src/test/resources/maven-core.transformed	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/maven-core.transformed	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.apache.maven</groupId>
+	<artifactId>maven-core</artifactId>
+	<version>debian</version>
+	<packaging>jar</packaging>
+	<parent>
+		<groupId>org.apache.maven</groupId>
+		<artifactId>maven</artifactId>
+		<version>debian</version>
+	</parent>
+	<properties>
+		<debian.originalVersion>2.1.1-SNAPSHOT</debian.originalVersion>
+		<debian.package>maven2</debian.package>
+	</properties>
+	
+	<name>Maven Core</name>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-settings</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.wagon</groupId>
+			<artifactId>wagon-file</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-parameter-documenter</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.wagon</groupId>
+			<artifactId>wagon-webdav-jackrabbit</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.wagon</groupId>
+			<artifactId>wagon-http-lightweight</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.reporting</groupId>
+			<artifactId>maven-reporting-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-profile</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-model</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-artifact</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.wagon</groupId>
+			<artifactId>wagon-provider-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.plexus</groupId>
+			<artifactId>plexus-container-default</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-repository-metadata</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-error-diagnostics</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-project</artifactId>
+		</dependency>
+        <dependency>
+            <groupId>commons-cli</groupId>
+            <artifactId>commons-cli</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>commons-lang</artifactId>
+                    <groupId>commons-lang</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>commons-logging</artifactId>
+                    <groupId>commons-logging</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.wagon</groupId>
+			<artifactId>wagon-ssh-external</artifactId>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-descriptor</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-interactivity-api</artifactId>
+			<version>debian</version>
+			<exclusions>
+				<exclusion>
+					<artifactId>plexus-utils</artifactId>
+					<groupId>plexus</groupId>
+				</exclusion>
+				<exclusion>
+					<artifactId>plexus-container-default</artifactId>
+					<groupId>org.codehaus.plexus</groupId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-artifact-manager</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-monitor</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven.wagon</groupId>
+			<artifactId>wagon-ssh</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.plexus</groupId>
+			<artifactId>plexus-utils</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>classworlds</groupId>
+			<artifactId>classworlds</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.sonatype.plexus</groupId>
+			<artifactId>plexus-sec-dispatcher</artifactId>
+		</dependency>
+	</dependencies>
+	<build>
+		<resources>
+			<resource>
+				<directory>src/main/resources</directory>
+				<filtering>true</filtering>
+			</resource>
+		</resources>
+	</build>
+	<reporting>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>l10n-maven-plugin</artifactId>
+				<version>1.0-alpha-1</version>
+				<configuration>
+					<locales>
+						<locale>el</locale>
+						<locale>de</locale>
+						<locale>es</locale>
+						<locale>fr</locale>
+						<locale>ja</locale>
+						<locale>nl</locale>
+						<locale>no</locale>
+						<locale>pl</locale>
+						<locale>zh_CN</locale>
+					</locales>
+				</configuration>
+			</plugin>
+		</plugins>
+	</reporting>
+	<profiles>
+		<profile>
+			<id>include-site</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-scm-plugin</artifactId>
+						<configuration>
+							<connectionUrl>scm:svn:http://svn.apache.org/repos/asf/maven/site/trunk</connectionUrl>
+							<checkoutDirectory>${project.build.directory}/maven-site</checkoutDirectory>
+						</configuration>
+						<executions>
+							<execution>
+								<phase>initialize</phase>
+								<goals>
+									<goal>checkout</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-invoker-plugin</artifactId>
+						<configuration>
+							<projectsDirectory>${project.build.directory}/maven-site</projectsDirectory>
+							<pom>${project.build.directory}/maven-site/pom.xml</pom>
+							<goals>
+								<goal>clean</goal>
+								<goal>site</goal>
+							</goals>
+						</configuration>
+						<executions>
+							<execution>
+								<id>initialize</id>
+								<phase>initialize</phase>
+								<goals>
+									<goal>run</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+		<profile>
+			<id>buildnumber</id>
+			<activation>
+				<file>
+					<exists>.svn</exists>
+				</file>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>buildnumber-maven-plugin</artifactId>
+						<version>1.0-beta-1</version>
+						<executions>
+							<execution>
+								<phase>generate-resources</phase>
+								<goals>
+									<goal>create</goal>
+								</goals>
+							</execution>
+						</executions>
+						<configuration>
+							<doCheck>false</doCheck>
+							<doUpdate>false</doUpdate>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/maven-core.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/maven-core.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/maven-core.xml	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven</artifactId>
+    <version>2.1.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-core</artifactId>
+
+  <name>Maven Core</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-settings</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-file</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-parameter-documenter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-webdav-jackrabbit</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-http-lightweight</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.reporting</groupId>
+      <artifactId>maven-reporting-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-profile</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-provider-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-container-default</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-repository-metadata</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-error-diagnostics</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <exclusions>
+        <exclusion>
+          <artifactId>commons-lang</artifactId>
+          <groupId>commons-lang</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>commons-logging</artifactId>
+          <groupId>commons-logging</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-ssh-external</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-descriptor</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-interactivity-api</artifactId>
+      <version>1.0-alpha-4</version>
+      <exclusions>
+        <exclusion>
+          <artifactId>plexus-utils</artifactId>
+          <groupId>plexus</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>plexus-container-default</artifactId>
+          <groupId>org.codehaus.plexus</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact-manager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-monitor</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.wagon</groupId>
+      <artifactId>wagon-ssh</artifactId>
+<!-- reset once workaround in DefaultMaven removed
+      <scope>runtime</scope>
+-->
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>classworlds</groupId>
+      <artifactId>classworlds</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.sonatype.plexus</groupId>
+      <artifactId>plexus-sec-dispatcher</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>l10n-maven-plugin</artifactId>
+        <version>1.0-alpha-1</version>
+        <configuration>
+          <locales>
+            <locale>el</locale>
+            <locale>de</locale>
+            <locale>es</locale>
+            <locale>fr</locale>
+            <locale>ja</locale>
+            <locale>nl</locale>
+            <locale>no</locale>
+            <locale>pl</locale>
+            <locale>zh_CN</locale>
+          </locales>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+
+  <profiles>
+    <profile>
+      <id>include-site</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-scm-plugin</artifactId>
+            <configuration>
+              <connectionUrl>scm:svn:http://svn.apache.org/repos/asf/maven/site/trunk</connectionUrl>
+              <checkoutDirectory>${project.build.directory}/maven-site</checkoutDirectory>
+            </configuration>
+            <executions>
+              <execution>
+                <phase>initialize</phase>
+                <goals>
+                  <goal>checkout</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <configuration>
+              <projectsDirectory>${project.build.directory}/maven-site</projectsDirectory>
+              <pom>${project.build.directory}/maven-site/pom.xml</pom>
+              <goals>
+                <goal>clean</goal>
+                <goal>site</goal>
+              </goals>
+            </configuration>
+            <executions>
+              <execution>
+                <id>initialize</id>
+                <phase>initialize</phase>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>buildnumber</id>
+      <activation>
+        <file>
+          <exists>.svn</exists>
+        </file>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>buildnumber-maven-plugin</artifactId>
+            <version>1.0-beta-1</version>
+            <executions>
+              <execution>
+                <phase>generate-resources</phase>
+                <goals>
+                  <goal>create</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <doCheck>false</doCheck>
+              <doUpdate>false</doUpdate>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>

Modified: trunk/maven-repo-helper/src/test/resources/maven.cleaned
===================================================================
--- trunk/maven-repo-helper/src/test/resources/maven.cleaned	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/resources/maven.cleaned	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,15 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project>
-	<parent>
-		<groupId>org.debian</groupId>
-		<artifactId>debian-parent</artifactId>
-		<version>1.0-SNAPSHOT</version>
-	</parent>
-
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>org.apache.maven</groupId>
 	<artifactId>maven</artifactId>
-	<version>2.1.0-SNAPSHOT</version>
+	<version>debian</version>
 	<packaging>pom</packaging>
 	<name>Maven</name>
 	<description>Maven is a project development management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file. Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.</description>
@@ -119,12 +113,14 @@
 	<properties>
 		<mavenVersion>2.1.0-SNAPSHOT</mavenVersion>
 		<wagonVersion>1.0-beta-5</wagonVersion>
+		<debian.originalVersion>2.1.0-SNAPSHOT</debian.originalVersion>
+        <debian.package>maven2</debian.package>
 	</properties>
 	<dependencies>
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
-			<version>${junit.junit.jar.debian.version}</version>
+			<version>debian</version>
 			<scope>test</scope>
 		</dependency>
 	</dependencies>
@@ -133,173 +129,173 @@
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-plugin-descriptor</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-error-diagnostics</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-model</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-project</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.reporting</groupId>
 				<artifactId>maven-reporting-api</artifactId>
-				<version>${org.apache.maven.reporting.__.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-repository-metadata</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-artifact</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-artifact-manager</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-artifact-test</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-settings</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-core</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-toolchain</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-plugin-parameter-documenter</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-profile</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-plugin-registry</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-plugin-api</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-monitor</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven</groupId>
 				<artifactId>maven-toolchain</artifactId>
-				<version>${org.apache.maven.__.__.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>commons-cli</groupId>
 				<artifactId>commons-cli</artifactId>
-				<version>${commons-cli.commons-cli.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.doxia</groupId>
 				<artifactId>doxia-sink-api</artifactId>
-				<version>${org.apache.maven.doxia.doxia-sink-api.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.doxia</groupId>
 				<artifactId>doxia-logging-api</artifactId>
-				<version>${org.apache.maven.doxia.doxia-logging-api.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.codehaus.plexus</groupId>
 				<artifactId>plexus-interpolation</artifactId>
-				<version>${org.codehaus.plexus.plexus-interpolation.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.codehaus.plexus</groupId>
 				<artifactId>plexus-container-default</artifactId>
-				<version>${org.codehaus.plexus.plexus-container-default.jar.debian.version}</version>
+				<version>1.0-alpha</version>
 			</dependency>
 			<dependency>
 				<groupId>org.codehaus.plexus</groupId>
 				<artifactId>plexus-utils</artifactId>
-				<version>${org.codehaus.plexus.plexus-utils.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.sonatype.plexus</groupId>
 				<artifactId>plexus-sec-dispatcher</artifactId>
-				<version>${org.sonatype.plexus.plexus-sec-dispatcher.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.wagon</groupId>
 				<artifactId>wagon-provider-api</artifactId>
-				<version>${org.apache.maven.wagon.__.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.wagon</groupId>
 				<artifactId>wagon-ssh</artifactId>
-				<version>${org.apache.maven.wagon.__.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.wagon</groupId>
 				<artifactId>wagon-ssh-external</artifactId>
-				<version>${org.apache.maven.wagon.__.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.wagon</groupId>
 				<artifactId>wagon-file</artifactId>
-				<version>${org.apache.maven.wagon.__.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.wagon</groupId>
 				<artifactId>wagon-webdav-jackrabbit</artifactId>
-				<version>${org.apache.maven.wagon.__.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>org.apache.maven.wagon</groupId>
 				<artifactId>wagon-http-lightweight</artifactId>
-				<version>${org.apache.maven.wagon.__.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>backport-util-concurrent</groupId>
 				<artifactId>backport-util-concurrent</artifactId>
-				<version>${backport-util-concurrent.backport-util-concurrent.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 			<dependency>
 				<groupId>easymock</groupId>
 				<artifactId>easymock</artifactId>
-				<version>${easymock.easymock.jar.debian.version}</version>
+				<version>debian</version>
 				<scope>test</scope>
 			</dependency>
 			<dependency>
 				<groupId>classworlds</groupId>
 				<artifactId>classworlds</artifactId>
-				<version>${classworlds.classworlds.jar.debian.version}</version>
+				<version>debian</version>
 			</dependency>
 		</dependencies>
 	</dependencyManagement>

Added: trunk/maven-repo-helper/src/test/resources/maven.rules
===================================================================
--- trunk/maven-repo-helper/src/test/resources/maven.rules	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/maven.rules	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1 @@
+org.codehaus.plexus plexus-container-default jar s/1.0-alpha-.*/1.0-alpha/

Deleted: trunk/maven-repo-helper/src/test/resources/maven.spec
===================================================================
--- trunk/maven-repo-helper/src/test/resources/maven.spec	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/resources/maven.spec	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,3 +0,0 @@
-org.apache.maven.*.*.debian
-org.apache.maven.reporting.*.jar.debian
-org.apache.maven.wagon.*.jar.debian

Added: trunk/maven-repo-helper/src/test/resources/maven.transformed
===================================================================
--- trunk/maven-repo-helper/src/test/resources/maven.transformed	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/maven.transformed	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,520 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.apache.maven</groupId>
+	<artifactId>maven</artifactId>
+	<version>debian</version>
+	<packaging>pom</packaging>
+
+	<name>Maven</name>
+	<description>Maven is a project development management and comprehension tool. Based on the concept of a project object model: builds, dependency management, documentation creation, site publication, and distribution publication are all controlled from the declarative file. Maven can be extended by plugins to utilise a number of other development tools for reporting or the build process.</description>
+	<url>http://maven.apache.org</url>
+	<inceptionYear>2001</inceptionYear>
+	<issueManagement>
+		<system>jira</system>
+		<url>http://jira.codehaus.org/browse/MNG</url>
+	</issueManagement>
+	<mailingLists>
+		<mailingList>
+			<name>Maven User List</name>
+			<subscribe>users-subscribe at maven.apache.org</subscribe>
+			<unsubscribe>users-unsubscribe at maven.apache.org</unsubscribe>
+			<post>users at maven.apache.org</post>
+			<archive>http://mail-archives.apache.org/mod_mbox/maven-users</archive>
+			<otherArchives>
+				<otherArchive>http://www.mail-archive.com/users@maven.apache.org/</otherArchive>
+				<otherArchive>http://www.nabble.com/Maven---Users-f178.html</otherArchive>
+				<otherArchive>http://maven.users.markmail.org/</otherArchive>
+			</otherArchives>
+		</mailingList>
+		<mailingList>
+			<name>Maven Developer List</name>
+			<subscribe>dev-subscribe at maven.apache.org</subscribe>
+			<unsubscribe>dev-unsubscribe at maven.apache.org</unsubscribe>
+			<post>dev at maven.apache.org</post>
+			<archive>http://mail-archives.apache.org/mod_mbox/maven-dev</archive>
+			<otherArchives>
+				<otherArchive>http://www.mail-archive.com/dev@maven.apache.org/</otherArchive>
+				<otherArchive>http://www.nabble.com/Maven-Developers-f179.html</otherArchive>
+				<otherArchive>http://maven.dev.markmail.org/</otherArchive>
+			</otherArchives>
+		</mailingList>
+		<mailingList>
+			<name>Maven Issues List</name>
+			<subscribe>issues-subscribe at maven.apache.org</subscribe>
+			<unsubscribe>issues-unsubscribe at maven.apache.org</unsubscribe>
+			<archive>http://mail-archives.apache.org/mod_mbox/maven-issues/</archive>
+			<otherArchives>
+				<otherArchive>http://www.mail-archive.com/issues@maven.apache.org</otherArchive>
+				<otherArchive>http://www.nabble.com/Maven---Issues-f15573.html</otherArchive>
+				<otherArchive>http://maven.issues.markmail.org/</otherArchive>
+			</otherArchives>
+		</mailingList>
+		<mailingList>
+			<name>Maven Commits List</name>
+			<subscribe>commits-subscribe at maven.apache.org</subscribe>
+			<unsubscribe>commits-unsubscribe at maven.apache.org</unsubscribe>
+			<archive>http://mail-archives.apache.org/mod_mbox/maven-commits</archive>
+			<otherArchives>
+				<otherArchive>http://www.mail-archive.com/commits@maven.apache.org</otherArchive>
+				<otherArchive>http://www.nabble.com/Maven---Commits-f15575.html</otherArchive>
+				<otherArchive>http://maven.commits.markmail.org/</otherArchive>
+			</otherArchives>
+		</mailingList>
+		<mailingList>
+			<name>Maven Announcements List</name>
+			<post>announce at maven.apache.org</post>
+			<subscribe>announce-subscribe at maven.apache.org</subscribe>
+			<unsubscribe>announce-unsubscribe at maven.apache.org</unsubscribe>
+			<archive>http://mail-archives.apache.org/mod_mbox/maven-announce/</archive>
+			<otherArchives>
+				<otherArchive>http://www.mail-archive.com/announce@maven.apache.org</otherArchive>
+				<otherArchive>http://www.nabble.com/Maven-Announcements-f15617.html</otherArchive>
+				<otherArchive>http://maven.announce.markmail.org/</otherArchive>
+			</otherArchives>
+		</mailingList>
+		<mailingList>
+			<name>Maven Notifications List</name>
+			<subscribe>notifications-subscribe at maven.apache.org</subscribe>
+			<unsubscribe>notifications-unsubscribe at maven.apache.org</unsubscribe>
+			<archive>http://mail-archives.apache.org/mod_mbox/maven-notifications/</archive>
+			<otherArchives>
+				<otherArchive>http://www.mail-archive.com/notifications@maven.apache.org</otherArchive>
+				<otherArchive>http://www.nabble.com/Maven---Notifications-f15574.html</otherArchive>
+				<otherArchive>http://maven.notifications.markmail.org/</otherArchive>
+			</otherArchives>
+		</mailingList>
+	</mailingLists>
+	<scm>
+		<connection>scm:svn:http://svn.apache.org/repos/asf/maven/components/branches/maven-2.1.x</connection>
+		<developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/components/branches/maven-2.1.x</developerConnection>
+		<url>http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x</url>
+	</scm>
+	<build>
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-jar-plugin</artifactId>
+					<version>2.1</version>
+				</plugin>
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-compiler-plugin</artifactId>
+					<version>2.0.2</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-assembly-plugin</artifactId>
+					<version>2.2</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-shade-plugin</artifactId>
+					<version>1.0</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-surefire-plugin</artifactId>
+					<version>2.3</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-deploy-plugin</artifactId>
+					<version>2.3</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-install-plugin</artifactId>
+					<version>2.1</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-site-plugin</artifactId>
+					<version>2.0-beta-5</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-resources-plugin</artifactId>
+					<version>2.2</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-remote-resources-plugin</artifactId>
+					<version>1.0-beta-2</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-clean-plugin</artifactId>
+					<version>2.1.1</version>
+				</plugin>
+				<plugin>
+					<artifactId>maven-release-plugin</artifactId>
+					<version>2.0-beta-7</version>
+					<configuration>
+						<tagBase>https://svn.apache.org/repos/asf/maven/components/tags</tagBase>
+						<autoVersionSubmodules>true</autoVersionSubmodules>
+						<preparationGoals>install</preparationGoals>
+					</configuration>
+				</plugin>
+				<plugin>
+					<groupId>org.codehaus.modello</groupId>
+					<artifactId>modello-maven-plugin</artifactId>
+					<version>1.0</version>
+					<executions>
+						<execution>
+							<id>site-docs</id>
+							<phase>pre-site</phase>
+							<goals>
+								<goal>xdoc</goal>
+								<goal>xsd</goal>
+							</goals>
+						</execution>
+						<execution>
+							<id>standard</id>
+							<goals>
+								<goal>java</goal>
+								<goal>xpp3-reader</goal>
+								<goal>xpp3-writer</goal>
+							</goals>
+						</execution>
+					</executions>
+				</plugin>
+				<plugin>
+					<groupId>org.codehaus.mojo</groupId>
+					<artifactId>clirr-maven-plugin</artifactId>
+					<version>2.2.1</version>
+					<configuration>
+						<comparisonVersion>2.0.9</comparisonVersion>
+						<excludes>
+							<exclude>org/apache/maven/lifecycle/LifecycleExecutor*</exclude>
+							<exclude>org/apache/maven/artifact/metadata/AbstractArtifactMetadata*</exclude>
+							<exclude>org/apache/maven/artifact/metadata/ArtifactMetadataSource*</exclude>
+							<exclude>org/apache/maven/project/MavenProjectBuilder*</exclude>
+							<exclude>org/apache/maven/project/ProjectBuilderConfiguration*</exclude>
+							<exclude>org/apache/maven/project/interpolation/ModelInterpolator*</exclude>
+							<exclude>org/apache/maven/project/inheritance/ModelInheritanceAssembler*</exclude>
+							<exclude>org/apache/maven/execution/MavenExecutionRequest*</exclude>
+							<exclude>org/apache/maven/plugin/DefaultPluginManager*</exclude>
+							<exclude>org/apache/maven/settings/io/xpp3/SettingsXpp3Reader*</exclude>
+							<exclude>org/apache/maven/artifact/repository/metadata/io/xpp3/MetadataXpp3Reader*</exclude>
+							<exclude>org/apache/maven/model/io/xpp3/MavenXpp3Reader*</exclude>
+							<exclude>org/apache/maven/usability/plugin/io/xpp3/ParamdocXpp3Reader*</exclude>
+							<exclude>org/apache/maven/profiles/io/xpp3/ProfilesXpp3Reader*</exclude>
+							<exclude>org/apache/maven/plugin/registry/io/xpp3/PluginRegistryXpp3Reader*</exclude>
+							<exclude>org/apache/maven/plugin/lifecycle/io/xpp3/LifecycleMappingsXpp3Reader*</exclude>
+							<exclude>org/apache/maven/toolchain/model/io/xpp3/MavenToolchainsXpp3Reader*</exclude>
+						</excludes>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
+	<modules>
+		<module>maven-artifact</module>
+		<module>maven-artifact-manager</module>
+		<module>maven-artifact-test</module>
+		<module>maven-core</module>
+		<module>maven-error-diagnostics</module>
+		<module>maven-model</module>
+		<module>maven-monitor</module>
+		<module>maven-plugin-api</module>
+		<module>maven-plugin-descriptor</module>
+		<module>maven-plugin-parameter-documenter</module>
+		<module>maven-plugin-registry</module>
+		<module>maven-profile</module>
+		<module>maven-project</module>
+		<module>maven-reporting</module>
+		<module>maven-repository-metadata</module>
+		<module>maven-script</module>
+		<module>maven-settings</module>
+		<module>maven-toolchain</module>
+		<module>apache-maven</module>
+	</modules>
+	<properties>
+		<mavenVersion>2.1.0-SNAPSHOT</mavenVersion>
+		<wagonVersion>1.0-beta-5</wagonVersion>
+		<debian.originalVersion>2.1.0-SNAPSHOT</debian.originalVersion>
+	</properties>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>debian</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-plugin-descriptor</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-error-diagnostics</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-model</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-project</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.reporting</groupId>
+				<artifactId>maven-reporting-api</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-repository-metadata</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-artifact</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-artifact-manager</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-artifact-test</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-settings</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-core</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-toolchain</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-plugin-parameter-documenter</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-profile</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-plugin-registry</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-plugin-api</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-monitor</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven</groupId>
+				<artifactId>maven-toolchain</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>commons-cli</groupId>
+				<artifactId>commons-cli</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.doxia</groupId>
+				<artifactId>doxia-sink-api</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.doxia</groupId>
+				<artifactId>doxia-logging-api</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.codehaus.plexus</groupId>
+				<artifactId>plexus-interpolation</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.codehaus.plexus</groupId>
+				<artifactId>plexus-container-default</artifactId>
+				<version>1.0-alpha</version>
+			</dependency>
+			<dependency>
+				<groupId>org.codehaus.plexus</groupId>
+				<artifactId>plexus-utils</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.sonatype.plexus</groupId>
+				<artifactId>plexus-sec-dispatcher</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.wagon</groupId>
+				<artifactId>wagon-provider-api</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.wagon</groupId>
+				<artifactId>wagon-ssh</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.wagon</groupId>
+				<artifactId>wagon-ssh-external</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.wagon</groupId>
+				<artifactId>wagon-file</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.wagon</groupId>
+				<artifactId>wagon-webdav-jackrabbit</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>org.apache.maven.wagon</groupId>
+				<artifactId>wagon-http-lightweight</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>backport-util-concurrent</groupId>
+				<artifactId>backport-util-concurrent</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>easymock</groupId>
+				<artifactId>easymock</artifactId>
+				<version>debian</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>classworlds</groupId>
+				<artifactId>classworlds</artifactId>
+				<version>debian</version>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
+	<distributionManagement>
+		<site>
+			<id>apache.website</id>
+			<url>scp://people.apache.org/www/maven.apache.org/ref/${project.version}/</url>
+		</site>
+	</distributionManagement>
+	<profiles>
+		<profile>
+			<id>quality-checks</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>clirr-maven-plugin</artifactId>
+						<executions>
+							<execution>
+								<id>clirr-check</id>
+								<phase>verify</phase>
+								<goals>
+									<goal>check</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+		<profile>
+			<id>release</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>clirr-maven-plugin</artifactId>
+						<executions>
+							<execution>
+								<goals>
+									<goal>check</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+		<profile>
+			<id>run-its</id>
+			<modules>
+				<module>maven-core-it-runner</module>
+			</modules>
+		</profile>
+		<profile>
+			<id>reporting</id>
+			<reporting>
+				<plugins>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>clirr-maven-plugin</artifactId>
+					</plugin>
+				</plugins>
+			</reporting>
+		</profile>
+		<profile>
+			<id>reporting-aggregate</id>
+			<reporting>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-project-info-reports-plugin</artifactId>
+						<version>2.1</version>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-jxr-plugin</artifactId>
+						<version>2.1</version>
+						<configuration>
+							<aggregate>true</aggregate>
+							<inputEncoding>${project.build.sourceEncoding}</inputEncoding>
+						</configuration>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-javadoc-plugin</artifactId>
+						<version>2.5</version>
+						<configuration>
+							<links>
+								<link>http://java.sun.com/j2se/1.4.2/docs/api</link>
+								<link>http://java.sun.com/j2ee/1.4/docs/api</link>
+								<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
+								<link>http://commons.apache.org/collections/apidocs-COLLECTIONS_3_0/</link>
+								<link>http://commons.apache.org/dbcp/apidocs/</link>
+								<link>http://commons.apache.org/fileupload/apidocs/</link>
+								<link>http://commons.apache.org/httpclient/apidocs/</link>
+								<link>http://commons.apache.org/logging/apidocs/</link>
+								<link>http://commons.apache.org/pool/apidocs/</link>
+								<link>http://junit.sourceforge.net/javadoc/</link>
+								<link>http://logging.apache.org/log4j/1.2/apidocs/</link>
+								<link>http://jakarta.apache.org/regexp/apidocs/</link>
+								<link>http://velocity.apache.org/engine/releases/velocity-1.5/apidocs/</link>
+							</links>
+							<aggregate>true</aggregate>
+						</configuration>
+					</plugin>
+				</plugins>
+			</reporting>
+		</profile>
+	</profiles>
+</project>
\ No newline at end of file

Modified: trunk/maven-repo-helper/src/test/resources/modello-core.cleaned
===================================================================
--- trunk/maven-repo-helper/src/test/resources/modello-core.cleaned	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/resources/modello-core.cleaned	2009-06-07 12:53:01 UTC (rev 8319)
@@ -3,16 +3,21 @@
   <parent>
     <artifactId>modello</artifactId>
     <groupId>org.codehaus.modello</groupId>
-    <version>1.0-alpha-22</version>
+    <version>debian</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.codehaus.modello</groupId>
   <artifactId>modello-core</artifactId>
-  <version>1.0-alpha-22</version>
+  <version>debian</version>
   <packaging>jar</packaging>
   <name>Modello Core</name>
 
+  <properties>
+    <debian.originalVersion>1.0-alpha-22</debian.originalVersion>
+    <debian.package>libmodello-java</debian.package>
+  </properties>
+
   <dependencies>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
@@ -24,4 +29,5 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
+
 </project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/modello-core.keep.cleaned
===================================================================
--- trunk/maven-repo-helper/src/test/resources/modello-core.keep.cleaned	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/modello-core.keep.cleaned	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.codehaus.modello</groupId>
+  <artifactId>modello-core</artifactId>
+  <version>1.0-alpha-22</version>
+  <packaging>jar</packaging>
+  <name>Modello Core</name>
+
+  <parent>
+    <groupId>org.codehaus.modello</groupId>
+    <artifactId>modello</artifactId>
+    <version>1.0-alpha-22</version>
+  </parent>
+
+  <properties>
+    <debian.originalVersion>1.0-alpha-22</debian.originalVersion>
+    <debian.package>libmodello-java</debian.package>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-container-default</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.modello</groupId>
+      <artifactId>modello-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/modello-core.transformed
===================================================================
--- trunk/maven-repo-helper/src/test/resources/modello-core.transformed	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/modello-core.transformed	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.codehaus.modello</groupId>
+	<artifactId>modello-core</artifactId>
+	<version>debian</version>
+	<packaging>jar</packaging>
+	<parent>
+		<groupId>org.codehaus.modello</groupId>
+		<artifactId>modello</artifactId>
+		<version>debian</version>
+	</parent>
+	<properties>
+		<debian.originalVersion>1.0-alpha-22</debian.originalVersion>
+		<debian.package>libmodello-java</debian.package>
+	</properties>
+
+	<name>Modello Core</name>
+	<dependencies>
+		<dependency>
+			<groupId>org.codehaus.plexus</groupId>
+			<artifactId>plexus-container-default</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.modello</groupId>
+			<artifactId>modello-test</artifactId>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+				<configuration>
+					<descriptorRefs>
+						<descriptorRef>jar-with-dependencies</descriptorRef>
+					</descriptorRefs>
+					<archive>
+						<manifest>
+							<mainClass>org.codehaus.modello.ModelloCli</mainClass>
+						</manifest>
+					</archive>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Deleted: trunk/maven-repo-helper/src/test/resources/new.pom
===================================================================
--- trunk/maven-repo-helper/src/test/resources/new.pom	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/resources/new.pom	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project>
-    <groupId>org.debian</groupId>
-    <artifactId>debian-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
-    <properties>
-        <library.jar.debian.package>libtest-java</library.jar.debian.package>
-        <library.jar.debian.version>1.0</library.jar.debian.version>
-    </properties>
-</project>
\ No newline at end of file

Deleted: trunk/maven-repo-helper/src/test/resources/new2.pom
===================================================================
--- trunk/maven-repo-helper/src/test/resources/new2.pom	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/resources/new2.pom	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,12 +0,0 @@
-
-<project>
-    <groupId>org.debian</groupId>
-    <artifactId>debian-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
-    <properties>
-        <library.jar.debian.package>libtest-java</library.jar.debian.package>
-        <library.jar.debian.version>1.0</library.jar.debian.version>
-        <library2.jar.debian.package>libother-java</library2.jar.debian.package>
-        <library2.jar.debian.version>3.0</library2.jar.debian.version>
-    </properties>
-</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/plexus-container-default.cleaned
===================================================================
--- trunk/maven-repo-helper/src/test/resources/plexus-container-default.cleaned	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/plexus-container-default.cleaned	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.codehaus.plexus</groupId>
+	<artifactId>plexus-container-default</artifactId>
+	<version>1.0-alpha</version>
+	<packaging>jar</packaging>
+  <properties>
+    <debian.originalVersion>1.0-alpha-9-stable-1</debian.originalVersion>
+    <debian.package>libplexus-container-default-java</debian.package>
+	<debian.mavenRule><![CDATA[org.codehaus.plexus plexus-container-default jar s/1\.0-alpha-.*/1.0-alpha/]]></debian.mavenRule>
+  </properties>
+  <name>Default Plexus Container</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>debian</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>debian</version>
+    </dependency>
+    <dependency>
+      <groupId>classworlds</groupId>
+      <artifactId>classworlds</artifactId>
+      <version>debian</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/plexus-container-default.transformed
===================================================================
--- trunk/maven-repo-helper/src/test/resources/plexus-container-default.transformed	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/plexus-container-default.transformed	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.codehaus.plexus</groupId>
+	<artifactId>plexus-container-default</artifactId>
+	<version>1.0-alpha</version>
+	<packaging>jar</packaging>
+	<parent>
+		<groupId>org.codehaus.plexus</groupId>
+		<artifactId>plexus-containers</artifactId>
+		<version>debian</version>
+	</parent>
+	<properties>
+		<debian.originalVersion>1.0-alpha-9-stable-1</debian.originalVersion>
+		<debian.mavenRule><![CDATA[org.codehaus.plexus plexus-container-default jar s/1\.0-alpha-.*/1.0-alpha/]]></debian.mavenRule>
+	</properties>
+
+	<name>Default Plexus Container</name>
+	<build>
+		<plugins>
+			<plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<excludes>
+						<exclude>**/Test*.java</exclude>
+						<exclude>**/Abstract*.java</exclude>
+					</excludes>
+				</configuration>
+			</plugin>
+		</plugins>
+		<extensions>
+			<extension>
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-webdav</artifactId>
+                <version>debian</version>
+			</extension>
+		</extensions>
+	</build>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>debian</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.plexus</groupId>
+			<artifactId>plexus-utils</artifactId>
+			<version>debian</version>
+		</dependency>
+		<dependency>
+			<groupId>classworlds</groupId>
+			<artifactId>classworlds</artifactId>
+			<version>debian</version>
+		</dependency>
+	</dependencies>
+	<distributionManagement>
+		<repository>
+			<id>codehaus.org</id>
+			<name>Plexus Central Repository</name>
+			<url>dav:https://dav.codehaus.org/repository/plexus</url>
+		</repository>
+		<snapshotRepository>
+			<id>codehaus.org</id>
+			<name>Plexus Central Development Repository</name>
+			<url>dav:https://dav.codehaus.org/snapshots.repository/plexus</url>
+		</snapshotRepository>
+		<site>
+			<id>codehaus.org</id>
+			<url>dav:https://dav.codehaus.org/plexus</url>
+		</site>
+	</distributionManagement>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/plexus-container-default.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/plexus-container-default.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/plexus-container-default.xml	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,65 @@
+<project>
+  <parent>
+    <artifactId>plexus-containers</artifactId>
+    <groupId>org.codehaus.plexus</groupId>
+    <version>1.0.3</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>plexus-container-default</artifactId>
+  <name>Default Plexus Container</name>
+  <version>1.0-alpha-9-stable-1</version>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/Test*.java</exclude>
+            <exclude>**/Abstract*.java</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.wagon</groupId>
+        <artifactId>wagon-webdav</artifactId>
+        <version>1.0-beta-2</version>
+      </extension>
+    </extensions>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.0.4</version>
+    </dependency>
+    <dependency>
+      <groupId>classworlds</groupId>
+      <artifactId>classworlds</artifactId>
+      <version>1.1-alpha-2</version>
+    </dependency>
+  </dependencies>
+  <distributionManagement>
+    <repository>
+      <id>codehaus.org</id>
+      <name>Plexus Central Repository</name>
+      <url>dav:https://dav.codehaus.org/repository/plexus</url>
+    </repository>
+    <snapshotRepository>
+      <id>codehaus.org</id>
+      <name>Plexus Central Development Repository</name>
+      <url>dav:https://dav.codehaus.org/snapshots.repository/plexus</url>
+    </snapshotRepository>
+    <site>
+      <id>codehaus.org</id>
+      <url>dav:https://dav.codehaus.org/plexus</url>
+    </site>
+  </distributionManagement>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/slf4j.cleaned
===================================================================
--- trunk/maven-repo-helper/src/test/resources/slf4j.cleaned	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/slf4j.cleaned	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.slf4j</groupId>
+	<artifactId>slf4j-parent</artifactId>
+	<version>debian</version>
+	<packaging>pom</packaging>
+	<properties>
+		<debian.originalVersion>1.5.6</debian.originalVersion>
+		<debian.package>libslf4j-java</debian.package>
+	</properties>
+
+	<name>SLF4J</name>
+	<url>http://www.slf4j.org</url>
+	<organization>
+		<name>QOS.ch</name>
+		<url>http://www.qos.ch</url>
+	</organization>
+	<inceptionYear>2005</inceptionYear>
+	<modules>
+		<module>slf4j-api</module>
+		<module>slf4j-simple</module>
+		<module>slf4j-nop</module>
+		<module>slf4j-jdk14</module>
+		<module>slf4j-log4j12</module>
+		<module>slf4j-jcl</module>
+		<module>slf4j-ext</module>
+		<module>jcl-over-slf4j</module>
+		<module>jcl104-over-slf4j</module>
+		<module>log4j-over-slf4j</module>
+		<module>jul-to-slf4j</module>
+		<module>integration</module>
+		<module>slf4j-site</module>
+		<module>slf4j-migrator</module>
+	</modules>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>debian</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>org.slf4j</groupId>
+				<artifactId>slf4j-api</artifactId>
+				<version>debian</version>
+			</dependency>
+			<dependency>
+				<groupId>log4j</groupId>
+				<artifactId>log4j</artifactId>
+				<version>debian</version>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
+	<scm>
+		<connection>scm:svn:http://svn.slf4j.org/repos/slf4j/trunk</connection>
+		<developerConnection>scm:svn:https://svn.slf4j.org/repos/slf4j/trunk</developerConnection>
+		<url>http://svn.slf4j.org/viewvc/slf4j/trunk/</url>
+	</scm>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/slf4j.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/slf4j.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/slf4j.xml	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>org.slf4j</groupId>
+	<artifactId>slf4j-parent</artifactId>
+	<version>1.5.6</version>
+
+	<packaging>pom</packaging>
+	<name>SLF4J</name>
+
+	<url>http://www.slf4j.org</url>
+
+	<organization>
+		<name>QOS.ch</name>
+		<url>http://www.qos.ch</url>
+	</organization>
+	<inceptionYear>2005</inceptionYear>
+
+  <properties>
+  </properties>
+
+	<modules>
+		<module>slf4j-api</module>
+    <module>slf4j-simple</module>
+    <module>slf4j-nop</module>
+		<module>slf4j-jdk14</module>
+    <module>slf4j-log4j12</module>
+    <module>slf4j-jcl</module>
+    <module>slf4j-ext</module>
+    <module>jcl-over-slf4j</module>
+    <module>jcl104-over-slf4j</module>
+    <module>log4j-over-slf4j</module>
+    <module>jul-to-slf4j</module>
+    <module>integration</module>
+    <module>slf4j-site</module>
+    <module>slf4j-migrator</module>
+  </modules>
+
+	<dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+		</dependency>
+	</dependencies>
+
+
+ <dependencyManagement>
+    <dependencies>
+
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>log4j</artifactId>
+        <version>1.2.14</version>
+      </dependency>
+
+   </dependencies>
+ </dependencyManagement>
+
+
+	<build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.3</source>
+					<target>1.3</target>
+				</configuration>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<forkMode>once</forkMode>
+					<reportFormat>plain</reportFormat>
+					<trimStackTrace>false</trimStackTrace>
+					<excludes>
+						<exclude>**/AllTest.java</exclude>
+						<exclude>**/PackageTest.java</exclude>
+					</excludes>
+				</configuration>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+        	<aggregate>true</aggregate>
+          <excludePackageNames>org.slf4j.migrator:org.slf4j.migrator.*</excludePackageNames>
+					<links>
+						<link>
+							http://java.sun.com/j2se/1.5.0/docs/api
+						</link>
+					</links>
+          <groups>
+            <group>
+              <title>SLF4J packages</title>
+              <packages>org.slf4j:org.slf4j.*</packages>
+            </group>
+
+            <group>
+              <title>SLF4J extensions</title>
+              <packages>org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent</packages>
+            </group>
+
+            <group>
+              <title>Jakarta Commons Logging packages</title>
+              <packages>org.apache.commons.*</packages>
+            </group>
+
+            <group>
+              <title>Apache log4j</title>
+              <packages>org.apache.log4j</packages>
+            </group>
+
+            <group>
+              <title>java.util.logging (JUL) to SLF4J bridge</title>
+              <packages>org.slf4j.bridge</packages>
+            </group>
+
+          </groups>
+        </configuration>
+      </plugin>
+
+    </plugins>
+
+	</build>
+
+  <profiles>
+    <profile>
+      <id>skipTests</id>
+      <properties>
+        <maven.test.skip>true</maven.test.skip>
+      </properties>
+    </profile>
+     <profile>
+      <id>osgi</id>
+      <modules>
+         <module>osgi-over-slf4j</module>
+         <module>slf4j-osgi-test-bundle</module>
+         <module>slf4j-osgi-integration-test</module>
+      </modules>
+
+      <repositories>
+        <repository>
+          <id>m2apache.snapshots</id>
+          <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+          <releases>
+            <enabled>false</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+
+        <repository>
+          <id>springframework.org</id>
+          <name>Springframework Maven SNAPSHOT Repository</name>
+          <url>http://static.springframework.org/maven2-snapshots/</url>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+
+      </repositories>
+
+      <pluginRepositories>
+        <pluginRepository>
+          <id>apache.snapshots</id>
+          <name>Apache Snapshot Plugin Repository</name>
+          <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+          <releases>
+            <enabled>false</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+
+    </profile>
+  </profiles>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.snapshots</id>
+      <name>Apache Snapshot Plugin Repository</name>
+      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+     </snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+
+	<reporting>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-site-plugin</artifactId>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-project-info-reports-plugin</artifactId>
+				<reportSets>
+					<reportSet><reports/></reportSet>
+				</reportSets>
+			</plugin>
+
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.1</version>
+        <configuration>
+          <descriptors>
+            <descriptor>
+              src/main/assembly/source.xml
+            </descriptor>
+          </descriptors>
+					<finalName>slf4j-${project.version}</finalName>
+					<appendAssemblyId>false</appendAssemblyId>
+					<outputDirectory>target/site/dist/</outputDirectory>
+				</configuration>
+			</plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jxr-plugin</artifactId>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>jxr</report>
+              <report>test-jxr</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+        <configuration>
+          <aggregate>true</aggregate>
+          <javadocDir>target/site/api/</javadocDir>
+          <linkJavadoc>true</linkJavadoc>
+        </configuration>
+      </plugin>
+
+
+    </plugins>
+
+	</reporting>
+
+
+  <scm>
+		<connection>scm:svn:http://svn.slf4j.org/repos/slf4j/trunk</connection>
+		<developerConnection>scm:svn:https://svn.slf4j.org/repos/slf4j/trunk</developerConnection>
+		<url>http://svn.slf4j.org/viewvc/slf4j/trunk/</url>
+	</scm>
+
+	<distributionManagement>
+		<site>
+			<id>pixie</id>
+			<url>scp://pixie/var/www/www.slf4j.org/htdocs/</url>
+		</site>
+
+    <repository>
+      <id>pixie</id>
+      <url>scp://pixie/var/mvnrepo/</url>
+    </repository>
+
+	</distributionManagement>
+
+</project>
\ No newline at end of file

Deleted: trunk/maven-repo-helper/src/test/resources/updated.pom
===================================================================
--- trunk/maven-repo-helper/src/test/resources/updated.pom	2009-06-05 21:46:00 UTC (rev 8318)
+++ trunk/maven-repo-helper/src/test/resources/updated.pom	2009-06-07 12:53:01 UTC (rev 8319)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project>
-    <groupId>org.debian</groupId>
-    <artifactId>debian-parent</artifactId>
-    <version>1.0-SNAPSHOT</version>
-    <properties>
-        <library.jar.debian.package>libtest-java</library.jar.debian.package>
-        <library.jar.debian.version>1.1</library.jar.debian.version>
-    </properties>
-</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/wagon-http-lightweight.cleaned
===================================================================
--- trunk/maven-repo-helper/src/test/resources/wagon-http-lightweight.cleaned	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/wagon-http-lightweight.cleaned	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.apache.maven.wagon</groupId>
+	<artifactId>wagon-http-lightweight</artifactId>
+	<version>debian</version>
+	<packaging>jar</packaging>
+	<parent>
+		<groupId>org.apache.maven.wagon</groupId>
+		<artifactId>wagon-providers</artifactId>
+		<version>debian</version>
+	</parent>
+	<properties>
+		<debian.originalVersion>1.0-beta-5</debian.originalVersion>
+		<debian.package>libwagon-java</debian.package>
+	</properties>
+
+	<name>Maven Wagon Lightweight HTTP Provider</name>
+	<description>Wagon that gets and puts artifacts through http using standard Java library</description>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.maven.wagon</groupId>
+			<artifactId>wagon-http-shared</artifactId>
+			<version>debian</version>
+			<exclusions>
+				<exclusion>
+					<groupId>commons-httpclient</groupId>
+					<artifactId>commons-httpclient</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+	</dependencies>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/wagon-http-lightweight.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/wagon-http-lightweight.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/wagon-http-lightweight.xml	2009-06-07 12:53:01 UTC (rev 8319)
@@ -0,0 +1,30 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.wagon</groupId>
+    <artifactId>wagon-providers</artifactId>
+    <version>1.0-beta-5</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>wagon-http-lightweight</artifactId>
+  <name>Maven Wagon Lightweight HTTP Provider</name>
+  <description>
+    Wagon that gets and puts artifacts through http using standard Java library
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <artifactId>wagon-http-shared</artifactId>
+      <version>${pom.version}</version>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-httpclient</groupId>
+          <artifactId>commons-httpclient</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file




More information about the pkg-java-commits mailing list