[pkg-java] r11483 - in trunk/maven-repo-helper: debian src/main/bin src/main/java/org/debian/maven/repo src/test/java/org/debian/maven/repo src/test/resources src/test/resources/org src/test/resources/org/apache src/test/resources/org/apache/maven src/test/resources/org/apache/maven/project

Ludovic Claude ludovicc-guest at alioth.debian.org
Mon Feb 1 22:16:28 UTC 2010


Author: ludovicc-guest
Date: 2010-02-01 22:16:19 +0000 (Mon, 01 Feb 2010)
New Revision: 11483

Added:
   trunk/maven-repo-helper/src/test/resources/antlr3-parent.transformed
   trunk/maven-repo-helper/src/test/resources/antlr3-parent.xml
   trunk/maven-repo-helper/src/test/resources/antlr3-tools.transformed
   trunk/maven-repo-helper/src/test/resources/antlr3-tools.xml
   trunk/maven-repo-helper/src/test/resources/antlr3.transformed
   trunk/maven-repo-helper/src/test/resources/antlr3.xml
   trunk/maven-repo-helper/src/test/resources/org/
   trunk/maven-repo-helper/src/test/resources/org/apache/
   trunk/maven-repo-helper/src/test/resources/org/apache/maven/
   trunk/maven-repo-helper/src/test/resources/org/apache/maven/project/
   trunk/maven-repo-helper/src/test/resources/org/apache/maven/project/pom-4.0.0.xml
Modified:
   trunk/maven-repo-helper/debian/changelog
   trunk/maven-repo-helper/debian/control
   trunk/maven-repo-helper/src/main/bin/mh_cleanpom
   trunk/maven-repo-helper/src/main/bin/mh_patchpoms
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRule.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.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/POMTransformer.java
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Repository.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
Log:
* Bump up Standards-Version to 3.8.4
* Fix NPE on mh_transformpoms
* Looks like I missed many files while merging changes
  to Debian, it's now fixed.

Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/debian/changelog	2010-02-01 22:16:19 UTC (rev 11483)
@@ -1,3 +1,12 @@
+maven-repo-helper (1.0.1) unstable; urgency=low
+
+  * Bump up Standards-Version to 3.8.4
+  * Fix NPE on mh_transformpoms
+  * Looks like I missed many files while merging changes
+    to Debian, it's now fixed.
+
+ -- Ludovic Claude <ludovic.claude at laposte.net>  Mon, 01 Feb 2010 23:02:27 +0100
+
 maven-repo-helper (1.0) unstable; urgency=low
 
   * Add more unit tests

Modified: trunk/maven-repo-helper/debian/control
===================================================================
--- trunk/maven-repo-helper/debian/control	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/debian/control	2010-02-01 22:16:19 UTC (rev 11483)
@@ -4,7 +4,7 @@
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: Ludovic Claude <ludovic.claude at laposte.net>, Damien Raude-Morvan <drazzib at debian.org>
 Build-Depends: debhelper (>= 7), cdbs, default-jdk, ant, help2man, libstax-java
-Standards-Version: 3.8.3
+Standards-Version: 3.8.4
 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/maven-repo-helper/
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/maven-repo-helper/
 Homepage: https://launchpad.net/maven-packaging-support

Modified: trunk/maven-repo-helper/src/main/bin/mh_cleanpom
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/main/bin/mh_cleanpom	2010-02-01 22:16:19 UTC (rev 11483)
@@ -37,8 +37,17 @@
    echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
    echo -e "\t  extra rules use to remove certain dependencies from the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
+   echo -e "\t-c<rules> --clean-ignore-rules=<rules>: path to the file containing the"
+   echo -e "\t  rules use to remove certain dependencies from the cleaned POM,"
+   echo -e "\t  in addition to the ignore rules specified previously. This is"
+   echo -e "\t  useful in situations such as when the Maven clean target requires more"
+   echo -e "\t  dependencies or plugins to ignore than the build target"
+   echo -e "\t  Optional, the default location is debian/maven.cleanIgnoreRules"
    echo -e "\t-s --no-rules: don't apply any rules for converting versions,"
    echo -e "\t  do not even convert versions to the default 'debian' version"
+   echo -e "\t-m<repo root>--maven-repo=<repo root>: location of the Maven repository,"
+   echo -e "\t  used to force the versions of the Maven plugins used in the current"
+   echo -e "\t  POM file with the versions found in the repository"
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
    echo -e ""
@@ -108,7 +117,7 @@
    exit 1
 }
 
-ARGS="p package o no-parent k keep-pom-version e set-version r rules u published-rules i ignore-rules s no-rules v verbose n no-act" parseargs "$@"
+ARGS="p package o no-parent k keep-pom-version e set-version r rules u published-rules i ignore-rules c clean-ignore-rules s no-rules v verbose n no-act m maven-repo" parseargs "$@"
 
 if [ "$ARGC" -lt "1" ]; then
    syntax
@@ -120,7 +129,9 @@
 RULES=$(getarg r rules)
 PUBLISHED_RULES=$(getarg u published-rules)
 IGNORE_RULES=$(getarg i ignore-rules)
+CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
+MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
 VERBOSE=$(getarg v verbose)
@@ -146,14 +157,23 @@
         IGNORE_RULES="debian/maven.ignoreRules"
     fi
 fi
-
+if [ -z "$CLEAN_IGNORE_RULES" ]; then
+    if [ -f debian/maven.cleanIgnoreRules ]; then
+        CLEAN_IGNORE_RULES="debian/maven.cleanIgnoreRules"
+    fi
+fi
 if [ -z "$RULES" ]; then
     if [ -f debian/maven.rules ]; then
         RULES="debian/maven.rules"
     fi
 fi
+if [ -z "$MAVEN_REPO" ]; then
+    if [ -f /usr/share/maven-repo ]; then
+        MAVEN_REPO="/usr/share/maven-repo"
+    fi
+fi
 
-CLEAN_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${KEEPVERSION:+--keep-pom-version} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${NORULES:+--no-rules}"
+CLEAN_ARGS="--package=${PACKAGE} ${VERBOSE:+--verbose} ${NOPARENT:+--no-parent} ${KEEPVERSION:+--keep-pom-version} ${SETVERSION:+--set-version=$SETVERSION} ${RULES:+--rules=$RULES} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO}"
 
 if [ -z "$NOACT" ]; then
 	java -cp $CLASSPATH $JAVA_OPTIONS org.debian.maven.repo.POMCleaner $CLEAN_ARGS $POM $TARGET $POM_PROPS

Modified: trunk/maven-repo-helper/src/main/bin/mh_patchpoms
===================================================================
--- trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/main/bin/mh_patchpoms	2010-02-01 22:16:19 UTC (rev 11483)
@@ -23,37 +23,69 @@
    echo -e "\t  extra rules to publish in the property debian.mavenRules in the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.publishedRules"
    echo -e "\t-i<rules> --ignore-rules=<rules>: path to the file containing the"
-   echo -e "\t  extra rules use to remove certain dependencies from the cleaned POM"
+   echo -e "\t  rules use to remove certain dependencies from the cleaned POM"
    echo -e "\t  Optional, the default location is debian/maven.ignoreRules"
+   echo -e "\t-c<rules> --clean-ignore-rules=<rules>: path to the file containing the"
+   echo -e "\t  rules use to remove certain dependencies from the cleaned POM,"
+   echo -e "\t  in addition to the ignore rules specified previously. This is"
+   echo -e "\t  useful in situations such as when the Maven clean target requires more"
+   echo -e "\t  dependencies or plugins to ignore than the build target"
+   echo -e "\t  Optional, it is ignored by default"
    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-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-d --debian-build: transform during a Debian build, which means that"
+   echo -e "\t  some POM elements will be removed"
+   echo -e "\t-b --build-no-docs: transform during a build where no documentation is generated,"
+   echo -e "\t  which means that some POM elements will be removed"
+   echo -e "\t-m<repo root>--maven-repo=<repo root>: location of the Maven repository,"
+   echo -e "\t  used to force the versions of the Maven plugins used in the current"
+   echo -e "\t  POM file with the versions found in the repository"
    echo -e "\t-v --verbose: show more information while running"
    echo -e "\t-n --no-act: don't actually do anything, just print the results"
    exit 1
 }
 
-ARGS="p package r rules u published-rules i ignore-rules s no-rules k keep-pom-version v verbose n no-act" parseargs "$@"
+ARGS="p package r rules u published-rules i ignore-rules c clean-ignore-rules s no-rules k keep-pom-version v verbose n no-act d debian-build b build-no-docs m maven-repo" parseargs "$@"
 
 RULES=$(getarg r rules)
 PUBLISHED_RULES=$(getarg u published-rules)
 IGNORE_RULES=$(getarg i ignore-rules)
+CLEAN_IGNORE_RULES=$(getarg c clean-ignore-rules)
 NORULES=$(getarg s no-rules)
 KEEP_POM_VERSION=$(getarg k keep-pom-version)
+MAVEN_REPO=$(getarg m maven-repo)
 PACKAGE=$(getarg p package)
 PACKAGE=${PACKAGE:?"Package parameter (-p) is mandatory"}
 VERBOSE=$(getarg v verbose)
 NOACT=$(getarg n no-act)
+DEBIAN_BUILD=$(getarg d debian-build)
+BUILD_NO_DOCS=$(getarg b build-no-docs)
 
+if [ -z "$PUBLISHED_RULES" ]; then
+    if [ -f debian/maven.publishedRules ]; then
+        PUBLISHED_RULES="debian/maven.publishedRules"
+    fi
+fi
+if [ -z "$IGNORE_RULES" ]; then
+    if [ -f debian/maven.ignoreRules ]; then
+        IGNORE_RULES="debian/maven.ignoreRules"
+    fi
+fi
 if [ -z "$RULES" ]; then
     if [ -f debian/maven.rules ]; then
         RULES="debian/maven.rules"
     fi
 fi
+if [ -z "$MAVEN_REPO" ]; then
+    if [ -f /usr/share/maven-repo ]; then
+        MAVEN_REPO="/usr/share/maven-repo"
+    fi
+fi
 
 DH_OPTS="${VERBOSE:+-v}"
-MH_ARGS="--package=${PACKAGE} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${NORULES:+--no-rules}"
+MH_ARGS="--package=${PACKAGE} ${RULES:+--rules=$RULES} ${KEEP_POM_VERSION:+--keep-pom-version} ${PUBLISHED_RULES:+--published-rules=$PUBLISHED_RULES} ${IGNORE_RULES:+--ignore-rules=$IGNORE_RULES} ${CLEAN_IGNORE_RULES:+--ignore-rules=$CLEAN_IGNORE_RULES} ${NORULES:+--no-rules} ${DEBIAN_BUILD:+--debian-build} ${BUILD_NO_DOCS:+--build-no-docs} ${MAVEN_REPO:+--maven-repo=$MAVEN_REPO}"
 
 if [ -z "$NOACT" ]; then
     cat debian/$PACKAGE.poms | while read POM OPT1 OPT2; do

Modified: trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRule.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRule.java	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/DependencyRule.java	2010-02-01 22:16:19 UTC (rev 11483)
@@ -47,6 +47,26 @@
         }
     }
 
+    public Rule getArtifactRule() {
+        return artifactRule;
+    }
+
+    public Rule getGroupRule() {
+        return groupRule;
+    }
+
+    public Rule getScopeRule() {
+        return scopeRule;
+    }
+
+    public Rule getTypeRule() {
+        return typeRule;
+    }
+
+    public Rule getVersionRule() {
+        return versionRule;
+    }
+
     public boolean matches(Dependency dependency) {
         return groupRule.match(dependency.getGroupId()) && artifactRule.match(dependency.getArtifactId()) && typeRule.match(dependency.getType()) 
                 && versionRule.match(dependency.getVersion()) && scopeRule.match(dependency.getScope());

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	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMCleaner.java	2010-02-01 22:16:19 UTC (rev 11483)
@@ -70,6 +70,14 @@
         }
     }
 
+    protected void transformingPom(POMInfo pom) {
+        if (pom.getThisPom().getType().equals("maven-plugin")) {
+            addIgnoreRule(new DependencyRule(pom.getThisPom().getGroupId() + " "
+                    + pom.getThisPom().getArtifactId() + " maven-plugin s/.*/"
+                    + pom.getThisPom().getVersion() + "/"));
+        }
+    }
+
     protected boolean isWriteIgnoredElement(String element) {
         if (keepAllElements) {
             return super.isWriteIgnoredElement(element);
@@ -99,7 +107,10 @@
             System.out.println("  -u<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("  -i<rules>, --ignore-rules=<rules>: path to the file containing the");
-            System.out.println("    extra rules use to remove certain dependencies from the cleaned POM");
+            System.out.println("    extra rules use to remove certain dependencies from the transformed POM");
+            System.out.println("    This option can be repeated, in order to have multiple sets of");
+            System.out.println("    dependencies to ignore, useful in situations such as when the Maven clean");
+            System.out.println("    target requires more dependencies or plugins to ignore than the build target");
             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("  -e<version>, --set-version=<version>: set the version for the POM,");
@@ -108,6 +119,9 @@
             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("  -m<repo root>--maven-repo=<repo root>: location of the Maven repository,");
+            System.out.println("    used to force the versions of the Maven plugins used in the current");
+            System.out.println("    POM file with the versions found in the repository");
             System.out.println("");
             System.out.println("Arguments:");
             System.out.println("  original-pom: location of the original POM");
@@ -179,6 +193,7 @@
         File rulesFile = null;
         File publishedRulesFile = new File("debian/maven.publishedRules");
         File ignoreRulesFile = new File("debian/maven.ignoreRules");
+        File mavenRepo = null;
         while (i < args.length && (args[i].trim().startsWith("-") || args[i].trim().length() == 0)) {
             String arg = args[i].trim();
             if ("--verbose".equals(arg) || "-v".equals(arg)) {
@@ -203,14 +218,26 @@
                 publishedRulesFile = new File(arg.substring(2));
             } else if (arg.startsWith("--published-rules=")) {
                 publishedRulesFile = new File(arg.substring("--published-rules=".length()));
-            } else if (arg.startsWith("-i")) {
-                ignoreRulesFile = new File(arg.substring(2));
-            } else if (arg.startsWith("--ignore-rules=")) {
-                ignoreRulesFile = new File(arg.substring("--ignore-rules=".length()));
+            } else if (arg.startsWith("-i") || arg.startsWith("--ignore-rules=")) {
+                if (arg.startsWith("-i")) {
+                    ignoreRulesFile = new File(arg.substring(2));
+                } else {
+                    ignoreRulesFile = new File(arg.substring("--ignore-rules=".length()));
+                }
+                if (ignoreRulesFile.exists()) {
+                    cleaner.addIgnoreRules(ignoreRulesFile);
+                } else {
+                    System.err.println("Cannot find file: " + ignoreRulesFile);
+                }
+
             } else if (arg.startsWith("-e")) {
                 setVersion = arg.substring(2);
             } else if (arg.startsWith("--set-version=")) {
                 setVersion = arg.substring("--set-version=".length());
+            } else if (arg.startsWith("-m")) {
+                mavenRepo = new File(arg.substring(2));
+            } else if (arg.startsWith("--maven-repo=")) {
+                mavenRepo = new File(arg.substring("--maven-repo=".length()));
             }
             i = inc(i, args);
         }
@@ -238,8 +265,11 @@
                 cleaner.addPublishedRules(publishedRulesFile);
             }
         }
-        if (ignoreRulesFile != null && ignoreRulesFile.exists()) {
-            cleaner.addIgnoreRules(ignoreRulesFile);
+
+        if (mavenRepo != null) {
+            Repository repository = new Repository(mavenRepo);
+            cleaner.setRepository(repository);
+            cleaner.addPluginRulesFromRepository();
         }
 
         cleaner.setKeepAllElements(keepAllElements);

Modified: 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	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMInfo.java	2010-02-01 22:16:19 UTC (rev 11483)
@@ -1,5 +1,6 @@
 package org.debian.maven.repo;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
@@ -19,6 +20,7 @@
     public static final String PLUGINS = "Plugins";
     public static final String PLUGIN_MANAGEMENT = "PluginManagement";
     public static final String EXTENSIONS = "Extensions";
+    public static final String MODULES = "Modules";
 
     private String originalParentVersion;
     private Dependency originalPom;
@@ -35,6 +37,7 @@
     private List profileDependencyManagement;
     private List profilePluginDependencies;
     private Map properties;
+    private POMInfo parentPOM;
 
     public Dependency getOriginalPom() {
         return originalPom;
@@ -229,11 +232,27 @@
         result.setProfilePluginDependencies(Dependency.applyRules(getProfilePluginDependencies(), rules));
         result.setProfileDependencyManagement(Dependency.applyRules(getProfileDependencyManagement(), rules));
         result.setProperties(getProperties());
+        result.setModules(getModules());
 
         return result;
     }
 
+    public void applyRulesOnDependenciesAndPlugins(Collection rules) {
+        setDependencies(Dependency.applyRules(getDependencies(), rules));
+        setDependencyManagement(Dependency.applyRules(getDependencyManagement(), rules));
+        setExtensions(Dependency.applyRules(getExtensions(), rules));
+        setPlugins(Dependency.applyRules(getPlugins(), rules));
+        setPluginDependencies(Dependency.applyRules(getPluginDependencies(), rules));
+        setPluginManagement(Dependency.applyRules(getPluginManagement(), rules));
+        setProfileDependencies(Dependency.applyRules(getProfileDependencies(), rules));
+        setProfilePluginDependencies(Dependency.applyRules(getProfilePluginDependencies(), rules));
+        setProfileDependencyManagement(Dependency.applyRules(getProfileDependencyManagement(), rules));
+        setProperties(getProperties());
+        setModules(getModules());
+    }
+
     public void mergeManagement(POMInfo parentPOM) {
+        this.parentPOM = parentPOM;
         if (parentPOM != null) {
             mergeManagement(dependencyManagement, parentPOM.getDependencyManagement());
             mergeManagement(pluginManagement, parentPOM.getPluginManagement());
@@ -256,6 +275,26 @@
         }
     }
 
+    public String getVersionFromManagementDependency(Dependency dependency) {
+        List allManagementLists = new ArrayList();
+        allManagementLists.addAll(getDependencyList(DEPENDENCY_MANAGEMENT_LIST));
+        allManagementLists.addAll(getDependencyList(PLUGIN_MANAGEMENT));
+        for (Iterator i = allManagementLists.iterator(); i.hasNext();) {
+            Dependency mgtDep = (Dependency)i.next();
+            if (mgtDep.getGroupId().equals(dependency.getGroupId()) &&
+                    mgtDep.getArtifactId().equals(dependency.getArtifactId()) ) {
+                if (mgtDep.getVersion() != null) {
+                    return mgtDep.getVersion();
+                }
+            }
+        }
+
+        if (parentPOM != null) {
+            return parentPOM.getVersionFromManagementDependency(dependency);
+        }
+        return null;
+    }
+
     private void resolveVersions(List deps, List management) {
         for (Iterator i = management.iterator(); i.hasNext();) {
             Dependency parentDep = (Dependency)i.next();
@@ -301,6 +340,9 @@
         if (EXTENSIONS.equals(listSelector)) {
             return getExtensions();
         }
+        if (MODULES.equals(listSelector)) {
+            return getModules();
+        }
         return null;
     }
 }

Modified: 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	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/POMTransformer.java	2010-02-01 22:16:19 UTC (rev 11483)
@@ -13,6 +13,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -36,16 +37,75 @@
     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 DEBIAN_BUILD_IGNORED_ELEMENTS = Arrays.asList(new String[]{
+                "distributionManagement", "repositories", "pluginRepositories"});
+    private static final List DEBIAN_DOC_IGNORED_ELEMENTS = Arrays.asList(new String[]{
+                "reports", "reporting", "site"});
     private static final List INFO_ELEMENTS = Arrays.asList(new String[]{"groupId",
                 "artifactId", "packaging", "version"});
     private Set rules = new TreeSet();
+    private Set automaticRules = new TreeSet();
     private Set publishedRules = new TreeSet();
     private Set ignoreRules = new TreeSet();
+    private Map ignoredModules = new HashMap();
+    private Repository repository;
     private boolean verbose;
+    private boolean isDebianBuild;
+    private boolean isBuildWithoutDoc;
 
     public POMTransformer() {
     }
 
+    public Repository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(Repository repository) {
+        this.repository = repository;
+    }
+
+    public boolean isBuildWithoutDoc() {
+        return isBuildWithoutDoc;
+    }
+
+    public void setBuildWithoutDoc(boolean isBuildWithoutDoc) {
+        this.isBuildWithoutDoc = isBuildWithoutDoc;
+    }
+
+    public boolean isDebianBuild() {
+        return isDebianBuild;
+    }
+
+    public void setDebianBuild(boolean isDebianBuild) {
+        this.isDebianBuild = isDebianBuild;
+    }
+
+    public void addPluginRulesFromRepository() {
+        repository.scanOnce();
+        for (Iterator i = repository.resolvedPomsIterator(); i.hasNext();) {
+            POMInfo pom = (POMInfo) i.next();
+            if (pom.getThisPom().getType().equals("maven-plugin")) {
+                Set pomRules = pom.getPublishedRules(true);
+                boolean found = false;
+                for (Iterator j = pomRules.iterator(); j.hasNext();) {
+                    DependencyRule rule = (DependencyRule) j.next();
+                    if (rule.matches(pom.getThisPom()) && rule.apply(pom.getThisPom()).equals(pom.getThisPom())
+                            && !rule.getGroupRule().isGeneric() && !rule.getArtifactRule().isGeneric()) {
+                        automaticRules.add(rule);
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found) {
+                    DependencyRule rule = new DependencyRule(pom.getThisPom().getGroupId() + " "
+                            + pom.getThisPom().getArtifactId() + " maven-plugin s/.*/"
+                            + pom.getThisPom().getVersion() + "/");
+                    automaticRules.add(rule);
+                }
+            }
+        }
+    }
+
     public void addDefaultRules() {
         addRule(DependencyRule.TO_DEBIAN_VERSION_RULE);
         addRule(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE);
@@ -84,6 +144,15 @@
         addRules(file, ignoreRules);
     }
 
+    public void addIgnoreModule(File pomFile, String module) {
+        Set modules = (Set) ignoredModules.get(pomFile);
+        if (modules == null) {
+            modules = new HashSet();
+            ignoredModules.put(pomFile, modules);
+        }
+        modules.add(module);
+    }
+
     private void addRules(File file, Set dest) {
         try {
             LineNumberReader lnr = new LineNumberReader(new FileReader(file));
@@ -113,6 +182,11 @@
                 Dependency pom = readPom(pomFile).getThisPom();
                 addRule(new DependencyRule(pom.getGroupId() + " " + pom.getArtifactId() + " " + pom.getType() + " " + pom.getVersion()));
             }
+
+            public void ignorePOM(File pomFile) throws Exception {
+                File parentPom = new File(pomFile.getParentFile().getParentFile(), "pom.xml");
+                addIgnoreModule(parentPom, pomFile.getParentFile().getName());
+            }
         });
     }
 
@@ -126,6 +200,9 @@
                 pomFile.delete();
                 targetFile.renameTo(pomFile);
             }
+
+            public void ignorePOM(File pomFile) throws Exception {
+            }
         });
     }
 
@@ -150,7 +227,15 @@
                 info.getThisPom().setVersion(setVersion);
             }
 
+            transformingPom(info);
+
             info = info.applyRules(rules);
+            info.applyRulesOnDependenciesAndPlugins(automaticRules);
+
+            if (repository != null) {
+                repository.registerPom(targetPom, info);
+            }
+
             Dependency parent = noParent ? null : info.getParent();
             Dependency pomInfo = info.getThisPom();
 
@@ -162,6 +247,7 @@
             int inPlugin = 0;
             int inProperty = 0;
             int inLevel = 0;
+            int inModule = 0;
             boolean sawVersion = false;
             List path = new ArrayList();
             Map dependencyIndexes = new HashMap();
@@ -188,47 +274,81 @@
                             inLevel++;
                             path.add(element);
 
-                            // Handle the special case of dependencies which can be ignored
+                            // Handle the special case of dependencies or plugins which can be ignored
                             // such as test dependencies during a clean operation
-                            if ("dependency".equals(element)) {
+                            if ("dependency".equals(element) || "plugin".equals(element) || "extension".equals(element)) {
                                 sawVersion = false;
-                                String parentElement = (String) path.get(path.size() - 2);
-                                String parentParentElement = (String) path.get(path.size() - 3);
-                                if ("dependencies".equals(parentElement)) {
-                                    String listSelector = null;
-                                    if ("dependencyManagement".equals(parentParentElement)) {
-                                        String p3Element = (String) path.get(path.size() - 4);
-                                        if ("project".equals(p3Element)) {
-                                            listSelector = POMInfo.DEPENDENCY_MANAGEMENT_LIST;
-                                        } else if ("profile".equals(p3Element)) {
-                                            listSelector = POMInfo.PROFILE_DEPENDENCY_MANAGEMENT_LIST;
+                                dependency = null;
+                                if ("dependency".equals(element)) {
+                                    String parentElement = (String) path.get(path.size() - 2);
+                                    String parentParentElement = (String) path.get(path.size() - 3);
+                                    if ("dependencies".equals(parentElement)) {
+                                        String listSelector = null;
+                                        if ("dependencyManagement".equals(parentParentElement)) {
+                                            String p3Element = (String) path.get(path.size() - 4);
+                                            if ("project".equals(p3Element)) {
+                                                listSelector = POMInfo.DEPENDENCY_MANAGEMENT_LIST;
+                                            } else if ("profile".equals(p3Element)) {
+                                                listSelector = POMInfo.PROFILE_DEPENDENCY_MANAGEMENT_LIST;
+                                            }
+                                        } else if ("project".equals(parentParentElement)) {
+                                            listSelector = POMInfo.DEPENDENCIES;
+                                        } else if ("profile".equals(parentParentElement)) {
+                                            listSelector = POMInfo.PROFILE_DEPENDENCIES;
+                                        } else if ("plugin".equals(parentParentElement)) {
+                                            String p5Element = (String) path.get(path.size() - 6);
+                                            if ("project".equals(p5Element)) {
+                                                listSelector = POMInfo.PLUGIN_DEPENDENCIES;
+                                            } else if ("profile".equals(p5Element)) {
+                                                listSelector = POMInfo.PROFILE_PLUGIN_DEPENDENCIES;
+                                            }
                                         }
-                                    } else if ("project".equals(parentParentElement)) {
-                                        listSelector = POMInfo.DEPENDENCIES;
-                                    } else if ("profile".equals(parentParentElement)) {
-                                        listSelector = POMInfo.PROFILE_DEPENDENCIES;
-                                    } else if ("plugin".equals(parentParentElement)) {
-                                        String p5Element = (String) path.get(path.size() - 6);
-                                        if ("project".equals(p5Element)) {
-                                            listSelector = POMInfo.PLUGIN_DEPENDENCIES;
-                                        } else if ("profile".equals(p5Element)) {
-                                            listSelector = POMInfo.PROFILE_PLUGIN_DEPENDENCIES;
+                                        if (listSelector != null) {
+                                            int index = inc(dependencyIndexes, listSelector);
+                                            List dependencyList = info.getDependencyList(listSelector);
+                                            dependency = (Dependency) dependencyList.get(index);
                                         }
                                     }
-                                    if (listSelector != null) {
+                                } else if ("plugin".equals(element)) {
+                                    sawVersion = false;
+                                    String parentElement = (String) path.get(path.size() - 2);
+                                    String parentParentElement = (String) path.get(path.size() - 3);
+                                    if ("plugins".equals(parentElement)) {
+                                        String listSelector = POMInfo.PLUGINS;
+                                        if ("pluginManagement".equals(parentParentElement)) {
+                                            listSelector = POMInfo.PLUGIN_MANAGEMENT;
+                                        }
                                         int index = inc(dependencyIndexes, listSelector);
                                         List dependencyList = info.getDependencyList(listSelector);
                                         dependency = (Dependency) dependencyList.get(index);
-                                        if (!acceptDependency(dependency, info)) {
-                                            inIgnoredElement++;
-                                            inLevel--;
-                                            path.remove(path.size() - 1);
-                                            dependency = null;
-                                            continue;
-                                        }
                                     }
+                                } else if ("extension".equals(element)) {
+                                    sawVersion = false;
+                                    int index = inc(dependencyIndexes, POMInfo.EXTENSIONS);
+                                    dependency = (Dependency) info.getExtensions().get(index);
                                 }
+                                if (!acceptDependency(dependency, info)) {
+                                    inIgnoredElement++;
+                                    inLevel--;
+                                    path.remove(path.size() - 1);
+                                    dependency = null;
+                                    continue;
+                                }
                             }
+                            if ("module".equals(element)) {
+                                String parentElement = (String) path.get(path.size() - 2);
+                                String parentParentElement = (String) path.get(path.size() - 3);
+                                if ("modules".equals(parentElement) && "project".equals(parentParentElement)) {
+                                    int index = inc(dependencyIndexes, POMInfo.MODULES);
+                                    String module = (String) info.getModules().get(index);
+                                    if (!acceptModule(module, originalPom)) {
+                                        inIgnoredElement++;
+                                        inLevel--;
+                                        path.remove(path.size() - 1);
+                                        continue;
+                                    }
+                                }
+                            }
 
                             indent(writer, inLevel - 1);
                             writer.writeStartElement(element);
@@ -240,6 +360,10 @@
                                 inProperty++;
                             } else if (inProperty > 0) {
                                 inProperty++;
+                            } else if (inLevel == 2 && "modules".equals(element)) {
+                                inModule++;
+                            } else if (inModule > 0) {
+                                inModule++;
                             } else if ("dependency".equals(element)) {
                                 inDependency++;
                             } else if (inExclusion > 0) {
@@ -248,30 +372,14 @@
                                 if ("exclusion".equals(element)) {
                                     inExclusion++;
                                 } else {
-                                    if ("version".equals(element)) {
-                                        sawVersion = true;
-                                    }
                                     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)) {
-                                    String listSelector = POMInfo.PLUGINS;
-                                    if ("pluginManagement".equals(parentParentElement)) {
-                                        listSelector = POMInfo.PLUGIN_MANAGEMENT;
-                                    }
-                                    int index = inc(dependencyIndexes, listSelector);
-                                    List dependencyList = info.getDependencyList(listSelector);
-                                    dependency = (Dependency) dependencyList.get(index);
-                                }
                             } else if (inPlugin > 0) {
                                 inPlugin++;
                             } else if ("extension".equals(element)) {
                                 inExtension++;
-                                int index = inc(dependencyIndexes, POMInfo.EXTENSIONS);
-                                dependency = (Dependency) info.getExtensions().get(index);
                             } else if (inExtension > 0) {
                                 inExtension++;
                             }
@@ -285,18 +393,28 @@
                             inIgnoredElement--;
                         } else {
                             // Attempt to repair missing version information on dependencies
-                            if (dependency != null && inDependency == 1 && !sawVersion && parent == null) {
-                                if (dependency.getVersion() == null) {
-                                    dependency.setVersion("debian");
-                                    // Give a chance to customize the version
-                                    // In maven.rules, you can write:
-                                    // myDependencyGroup myDependencyArtifact * s/.*/myVersion/
-                                    dependency = dependency.applyRules(rules);
+                            if (dependency != null && !sawVersion) {
+                                if ((inDependency == 1 || inPlugin == 1 || inExtension == 1)
+                                        && ((parent == null && repository == null) || (repository != null && info.getVersionFromManagementDependency(dependency) == null))) {
+                                    String oldVersion = dependency.getVersion();
+                                    if (oldVersion == null) {
+                                        dependency.setVersion("debian");
+                                        oldVersion = "debian";
+                                        // Give a chance to customize the version
+                                        // In maven.rules, you can write:
+                                        // myDependencyGroup myDependencyArtifact * s/.*/myVersion/
+                                        dependency = dependency.applyRules(rules);
+                                        dependency = dependency.applyRules(automaticRules);
+                                    }
+                                    // If we try to fix the version for a plugin, the fix is valid
+                                    // only if a real version (not 'debian') is forced on that plugin
+                                    if (inPlugin != 1 || !oldVersion.equals(dependency.getVersion())) {
+                                        indent(writer, inLevel);
+                                        writer.writeStartElement("version");
+                                        writer.writeCharacters(dependency.getVersion());
+                                        writer.writeEndElement();
+                                    }
                                 }
-                                indent(writer, inLevel);
-                                writer.writeStartElement("version");
-                                writer.writeCharacters(dependency.getVersion());
-                                writer.writeEndElement();
                             }
 
                             inLevel--;
@@ -309,6 +427,8 @@
                                 inPlugin--;
                             } else if (inExtension > 0) {
                                 inExtension--;
+                            } else if (inModule > 0) {
+                                inModule--;
                             }
                             if (inDependency + inPlugin + inExtension == 0) {
                                 dependency = null;
@@ -332,7 +452,7 @@
                     case XMLStreamConstants.CHARACTERS: {
                         if (inIgnoredElement == 0) {
                             String value = parser.getText().trim();
-                            if (dependency != null && (inDependency == 2 || inPlugin == 2 || inExtension == 2) && inExclusion == 0 ) {
+                            if (dependency != null && (inDependency == 2 || inPlugin == 2 || inExtension == 2) && inExclusion == 0) {
                                 if ("groupId".equals(element)) {
                                     value = dependency.getGroupId();
                                 } else if ("artifactId".equals(element)) {
@@ -341,6 +461,7 @@
                                     value = dependency.getType();
                                 } else if ("version".equals(element)) {
                                     value = dependency.getVersion();
+                                    sawVersion = true;
                                 }
                             }
                             writer.writeCharacters(value);
@@ -463,6 +584,12 @@
     }
 
     protected boolean isWriteIgnoredElement(String element) {
+        if (isDebianBuild() && DEBIAN_BUILD_IGNORED_ELEMENTS.contains(element)) {
+            return true;
+        }
+        if (isBuildWithoutDoc() && DEBIAN_DOC_IGNORED_ELEMENTS.contains(element)) {
+            return true;
+        }
         return WRITE_IGNORED_ELEMENTS.contains(element);
     }
 
@@ -502,9 +629,11 @@
             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 (info.getOriginalPom() != null) {
+            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);
@@ -529,9 +658,22 @@
         this.verbose = verbose;
     }
 
+    private boolean acceptModule(String module, File pomFile) {
+        Set modulesToSkip = (Set) ignoredModules.get(pomFile);
+        if (modulesToSkip == null) {
+            return true;
+        }
+        return !modulesToSkip.contains(module);
+    }
+
+    protected void transformingPom(POMInfo info) {
+    }
+
     private interface POMHandler {
 
         void handlePOM(File pomFile, boolean noParent) throws Exception;
+
+        void ignorePOM(File pomFile) throws Exception;
     }
 
     private static void foreachPoms(File poms, POMHandler handler) {
@@ -539,16 +681,39 @@
             LineNumberReader reader = new LineNumberReader(new FileReader(poms));
             String line;
             while ((line = reader.readLine()) != null) {
+                line = line.trim();
                 StringTokenizer st = new StringTokenizer(line, " \t");
-                if (!st.hasMoreTokens()) {
+                if (!st.hasMoreTokens() || line.startsWith("#")) {
                     continue;
                 }
                 String pom = st.nextToken();
                 File pomFile = new File(pom);
+                while (st.hasMoreTokens()) {
+                    String option = st.nextToken();
+                    if ("--ignore".equals(option)) {
+                        handler.ignorePOM(pomFile);
+                        break;
+                    }
+                }
+            }
+
+            reader = new LineNumberReader(new FileReader(poms));
+            newline:
+            while ((line = reader.readLine()) != null) {
+                line = line.trim();
+                StringTokenizer st = new StringTokenizer(line, " \t");
+                if (!st.hasMoreTokens() || line.startsWith("#")) {
+                    continue;
+                }
+                String pom = st.nextToken();
+                File pomFile = new File(pom);
                 boolean noParent = false;
-                if (st.hasMoreTokens()) {
-                    if ("--no-parent".equals(st.nextToken())) {
+                while (st.hasMoreTokens()) {
+                    String option = st.nextToken();
+                    if ("--no-parent".equals(option)) {
                         noParent = true;
+                    } else if ("--ignore".equals(option)) {
+                        break newline;
                     }
                 }
                 handler.handlePOM(pomFile, noParent);
@@ -569,6 +734,10 @@
                 }
                 pomOptions.put(pomFile.getAbsoluteFile(), option);
             }
+
+            public void ignorePOM(File pomFile) throws Exception {
+                pomOptions.put(pomFile.getAbsoluteFile(), "--ignore");
+            }
         });
 
         return pomOptions;
@@ -591,12 +760,22 @@
             System.out.println("    extra rules to publish in the property debian.mavenRules in the cleaned POM");
             System.out.println("  -i<rules>, --ignore-rules=<rules>: path to the file containing the");
             System.out.println("    extra rules use to remove certain dependencies from the transformed POM");
+            System.out.println("    This option can be repeated, in order to have multiple sets of");
+            System.out.println("    dependencies to ignore, useful in situations such as when the Maven clean");
+            System.out.println("    target requires more dependencies or plugins to ignore than the build target");
             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("  -e<version>, --set-version=<version>: set the version for the POM,");
             System.out.println("    do not use the version declared in the POM file.");
             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("  --debian-build: transform during a Debian build, which means that");
+            System.out.println("    some POM elements will be removed");
+            System.out.println("  --build-no-docs: transform during a build where no documentation is generated,");
+            System.out.println("    which means that some POM elements will be removed");
+            System.out.println("  -m<repo root>--maven-repo=<repo root>: location of the Maven repository,");
+            System.out.println("    used to force the versions of the Maven plugins used in the current");
+            System.out.println("    POM file with the versions found in the repository");
             System.out.println("");
             System.out.println("Arguments:");
             System.out.println("  poms: location of file containing the list of POM files to process.");
@@ -618,6 +797,8 @@
         File rulesFile = null;
         File publishedRulesFile = null;
         File ignoreRulesFile = null;
+        File mavenRepo = null;
+
         while (i < args.length && (args[i].trim().startsWith("-") || args[i].trim().length() == 0)) {
             String arg = args[i].trim();
             if ("--verbose".equals(arg) || "-v".equals(arg)) {
@@ -626,6 +807,10 @@
                 noRules = true;
             } else if ("--keep-pom-version".equals(arg)) {
                 keepPomVersion = true;
+            } else if (arg.equals("--debian-build")) {
+                transformer.setDebianBuild(true);
+            } else if (arg.equals("--build-no-docs")) {
+                transformer.setBuildWithoutDoc(true);
             } else if (arg.startsWith("-p")) {
                 debianPackage = arg.substring(2);
             } else if (arg.startsWith("--package=")) {
@@ -638,20 +823,34 @@
                 publishedRulesFile = new File(arg.substring(2));
             } else if (arg.startsWith("--published-rules=")) {
                 publishedRulesFile = new File(arg.substring("--published-rules=".length()));
-            } else if (arg.startsWith("-i")) {
-                ignoreRulesFile = new File(arg.substring(2));
-            } else if (arg.startsWith("--ignore-rules=")) {
-                ignoreRulesFile = new File(arg.substring("--ignore-rules=".length()));
+            } else if (arg.startsWith("-i") || arg.startsWith("--ignore-rules=")) {
+                if (arg.startsWith("-i")) {
+                    ignoreRulesFile = new File(arg.substring(2));
+                } else {
+                    ignoreRulesFile = new File(arg.substring("--ignore-rules=".length()));
+                }
+                if (ignoreRulesFile.exists()) {
+                    transformer.addIgnoreRules(ignoreRulesFile);
+                } else {
+                    System.err.println("Cannot find file: " + ignoreRulesFile);
+                }
+
             } else if (arg.startsWith("-e")) {
                 setVersion = arg.substring(2);
             } else if (arg.startsWith("--set-version=")) {
                 setVersion = arg.substring("--set-version=".length());
+            } else if (arg.startsWith("-m")) {
+                mavenRepo = new File(arg.substring(2));
+            } else if (arg.startsWith("--maven-repo=")) {
+                mavenRepo = new File(arg.substring("--maven-repo=".length()));
             }
             i = inc(i, args);
         }
+
         transformer.setVerbose(verbose);
 
         File poms;
+
         if (i + 1 < args.length) {
             poms = new File(args[i++].trim());
         } else {
@@ -667,19 +866,33 @@
                     if (verbose) {
                         System.err.println("Cannot find file: " + rulesFile);
                     }
+
                 } else {
                     transformer.addRules(rulesFile);
                 }
+
+            } else {
+                System.out.println("No rules file");
             }
+
             if (keepPomVersion) {
                 transformer.keepPomVersions(poms, debianPackage);
             }
-            if (publishedRulesFile != null && publishedRulesFile.exists()) {
-                transformer.addPublishedRules(publishedRulesFile);
+
+            if (publishedRulesFile != null) {
+                if (publishedRulesFile.exists()) {
+                    transformer.addPublishedRules(publishedRulesFile);
+                } else {
+                    System.err.println("Cannot find file: " + publishedRulesFile);
+                }
+
             }
         }
-        if (ignoreRulesFile != null && ignoreRulesFile.exists()) {
-            transformer.addIgnoreRules(ignoreRulesFile);
+
+        if (mavenRepo != null) {
+            Repository repository = new Repository(mavenRepo);
+            transformer.setRepository(repository);
+            transformer.addPluginRulesFromRepository();
         }
 
         transformer.transformPoms(poms, debianPackage, keepPomVersion, setVersion);

Modified: 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	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Repository.java	2010-02-01 22:16:19 UTC (rev 11483)
@@ -37,6 +37,7 @@
     private Map resolvedPoms = new HashMap();
     private POMInfo superPom;
     private POMReader pomReader = new POMReader();
+    private boolean scanned = false;
 
     public Repository(File baseDir) {
         this.baseDir = baseDir;
@@ -77,7 +78,7 @@
 
         // Map<DependencyRule,POMInfo>
         Map potentialMatches = new TreeMap();
-        for (Iterator i = resolvedPoms.values().iterator(); i.hasNext();) {
+        for (Iterator i = resolvedPomsIterator(); i.hasNext();) {
             POMInfo testPom = (POMInfo) i.next();
             Set rules = testPom.getPublishedRules(true);
             for (Iterator j = rules.iterator(); j.hasNext();) {
@@ -94,6 +95,10 @@
         return null;
     }
 
+    public Iterator resolvedPomsIterator() {
+        return resolvedPoms.values().iterator();
+    }
+
     public List searchMatchingPOMsIgnoreVersion(Dependency dependency) {
         List result = new ArrayList();
         POMInfo pom = searchMatchingPOM(dependency);
@@ -102,7 +107,7 @@
             return result;
         }
 
-        for (Iterator i = resolvedPoms.values().iterator(); i.hasNext();) {
+        for (Iterator i = resolvedPomsIterator(); i.hasNext();) {
             POMInfo testPom = (POMInfo) i.next();
             if (testPom.getThisPom().equalsIgnoreVersion(dependency)) {
                 result.add(testPom);
@@ -111,6 +116,14 @@
         return result;
     }
 
+    public void scanOnce() {
+        if (scanned) {
+            return;
+        }
+        scanned = true;
+        scan();
+    }
+
     public void scan() {
         File[] files = baseDir.listFiles();
         scan(files);

Modified: 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	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMReaderTest.java	2010-02-01 22:16:19 UTC (rev 11483)
@@ -62,6 +62,11 @@
         assertEquals(2, info.getProperties().size());
         assertEquals("2.1.0-SNAPSHOT", info.getProperties().get("mavenVersion"));
         assertEquals("1.0-beta-5", info.getProperties().get("wagonVersion"));
+
+        assertNotNull(info.getModules());
+        assertTrue(info.getModules().contains("maven-artifact"));
+        assertTrue(info.getModules().contains("maven-core"));
+
     }
 
 }
\ No newline at end of file

Modified: 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	2010-02-01 16:38:20 UTC (rev 11482)
+++ trunk/maven-repo-helper/src/test/java/org/debian/maven/repo/POMTransformerTest.java	2010-02-01 22:16:19 UTC (rev 11483)
@@ -4,6 +4,8 @@
  */
 package org.debian.maven.repo;
 
+import java.io.File;
+
 /**
  *
  * @author ludo
@@ -89,4 +91,75 @@
         assertXMLEqual(read("doxia-module-fml.transformed"), read(updatedPom));
     }
 
-}
\ No newline at end of file
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testTransformAntlr3Pom() throws Exception {
+        usePom("antlr3.xml");
+        boolean noParent = false;
+        POMTransformer instance = new POMTransformer();
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("org.antlr stringtemplate * s/3\\..*/3.x/ *"));
+        instance.addRule(new DependencyRule("antlr antlr jar s/2\\..*/2.x/ *"));
+        instance.addRule(new DependencyRule("junit junit jar s/4\\..*/4.x/ *"));
+        instance.addRule(new DependencyRule("org.antlr antlr3-maven-plugin maven-plugin s/.*/3.2/"));
+        instance.addRule(new DependencyRule("org.antlr stringtemplate jar s/3\\..*/3.x/ *"));
+        instance.addIgnoreRule(new DependencyRule("org.codehaus.mojo findbugs-maven-plugin maven-plugin *"));
+        instance.transformPom(pom, updatedPom, noParent, true, null, "libantlr3-java");
+        assertXMLEqual(read("antlr3.transformed"), read(updatedPom));
+    }
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testTransformAntlr3ParentPom() throws Exception {
+        usePom("antlr3-parent.xml");
+        boolean noParent = false;
+        POMTransformer instance = new POMTransformer();
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("org.antlr stringtemplate * s/3\\..*/3.x/ *"));
+        instance.addRule(new DependencyRule("antlr antlr jar s/2\\..*/2.x/ *"));
+        instance.addRule(new DependencyRule("junit junit jar s/4\\..*/4.x/ *"));
+        instance.addRule(new DependencyRule("org.antlr stringtemplate jar s/3\\..*/3.x/ *"));
+        instance.addRule(new DependencyRule("org.antlr antlr3-maven-plugin maven-plugin s/.*/3.2/"));
+        instance.addIgnoreRule(new DependencyRule("org.codehaus.mojo findbugs-maven-plugin maven-plugin *"));
+        instance.addIgnoreRule(new DependencyRule("org.codehaus.mojo buildnumber-maven-plugin maven-plugin *"));
+        instance.addIgnoreRule(new DependencyRule("* maven-assembly-plugin maven-plugin *"));
+        instance.addIgnoreRule(new DependencyRule("org.apache.maven.wagon * * *"));
+        instance.addIgnoreModule(pom, "gunit");
+        instance.addIgnoreModule(pom, "gunit-maven-plugin");
+
+        instance.transformPom(pom, updatedPom, noParent, true, null, "libantlr3-java");
+        assertXMLEqual(read("antlr3-parent.transformed"), read(updatedPom));
+    }
+
+    /**
+     * Test of cleanPom method, of class POMCleaner.
+     */
+    public void testTransformAntlr3ToolsPom() throws Exception {
+        usePom("antlr3-tools.xml");
+        boolean noParent = false;
+        POMTransformer instance = new POMTransformer();
+        Repository repository = new Repository(new File("/usr/share/maven-repo"));
+        instance.setRepository(repository);
+
+        instance.addDefaultRules();
+        instance.addRule(new DependencyRule("org.antlr stringtemplate * s/3\\..*/3.x/ *"));
+        instance.addRule(new DependencyRule("antlr antlr jar s/2\\..*/2.x/ *"));
+        instance.addRule(new DependencyRule("junit junit jar s/4\\..*/4.x/ *"));
+        instance.addRule(new DependencyRule("org.antlr stringtemplate jar s/3\\..*/3.x/ *"));
+        instance.addRule(new DependencyRule("org.antlr antlr3-maven-plugin maven-plugin s/.*/3.2/"));
+        instance.addPluginRulesFromRepository();
+        //instance.addRule(new DependencyRule("org.codehaus.mojo antlr-maven-plugin maven-plugin s/.*/2.1/"));
+        instance.addIgnoreRule(new DependencyRule("org.codehaus.mojo findbugs-maven-plugin maven-plugin *"));
+        instance.addIgnoreRule(new DependencyRule("org.codehaus.mojo buildnumber-maven-plugin maven-plugin *"));
+        instance.addIgnoreRule(new DependencyRule("* maven-assembly-plugin maven-plugin *"));
+        instance.addIgnoreRule(new DependencyRule("org.apache.maven.wagon * * *"));
+        instance.addIgnoreModule(pom, "gunit");
+        instance.addIgnoreModule(pom, "gunit-maven-plugin");
+
+        instance.transformPom(pom, updatedPom, noParent, true, null, "libantlr3-java");
+        assertXMLEqual(read("antlr3-tools.transformed"), read(updatedPom));
+    }
+
+}

Added: trunk/maven-repo-helper/src/test/resources/antlr3-parent.transformed
===================================================================
--- trunk/maven-repo-helper/src/test/resources/antlr3-parent.transformed	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/antlr3-parent.transformed	2010-02-01 22:16:19 UTC (rev 11483)
@@ -0,0 +1,92 @@
+<?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.antlr</groupId>
+	<artifactId>antlr-master</artifactId>
+	<version>3.2</version>
+	<packaging>pom</packaging>
+	<properties>
+		<debian.originalVersion>3.2</debian.originalVersion>
+		<debian.package>libantlr3-java</debian.package>
+	</properties>
+	
+	<name>ANTLR Master build control POM</name>
+	<url>http://maven.apache.org</url>
+	<modules>
+		<module>runtime/Java</module>
+		<module>tool</module>
+		<module>antlr3-maven-plugin</module>
+	</modules>
+	<distributionManagement>
+		<repository>
+			<id>antlr-repo</id>
+			<name>ANTLR Testing repository</name>
+			<url>scpexe://antlr.org/home/mavensync/antlr-repo</url>
+		</repository>
+		<snapshotRepository>
+			<id>antlr-snapshot</id>
+			<name>ANTLR Testing Snapshot Repository</name>
+			<url>scpexe://antlr.org/home/mavensync/antlr-snapshot</url>
+		</snapshotRepository>
+	</distributionManagement>
+	<repositories>
+		<repository>
+			<id>antlr-snapshot</id>
+			<name>ANTLR Testing Snapshot Repository</name>
+			<url>http://antlr.org/antlr-snapshot</url>
+			<snapshots>
+				<enabled>true</enabled>
+				<updatePolicy>always</updatePolicy>
+			</snapshots>
+		</repository>
+	</repositories>
+	<dependencyManagement>
+		<dependencies>
+			<dependency>
+				<groupId>junit</groupId>
+				<artifactId>junit</artifactId>
+				<version>4.x</version>
+				<scope>test</scope>
+			</dependency>
+			<dependency>
+				<groupId>antlr</groupId>
+				<artifactId>antlr</artifactId>
+				<version>2.x</version>
+				<scope>compile</scope>
+			</dependency>
+			<dependency>
+				<groupId>org.antlr</groupId>
+				<artifactId>stringtemplate</artifactId>
+				<version>3.x</version>
+				<scope>compile</scope>
+			</dependency>
+		</dependencies>
+	</dependencyManagement>
+	<build>
+		<defaultGoal>install</defaultGoal>
+		<filters>
+			<filter>antlr.config</filter>
+		</filters>
+		<resources>
+			<resource>
+				<directory>src/main/resources</directory>
+				<filtering>true</filtering>
+			</resource>
+		</resources>
+		<plugins>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>jsr14</target>
+					<sourceDirectory>src</sourceDirectory>
+				</configuration>
+			</plugin>
+			<plugin>
+				<artifactId>maven-surefire-plugin</artifactId>
+			</plugin>
+		</plugins>
+		<extensions>
+		</extensions>
+	</build>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/antlr3-parent.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/antlr3-parent.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/antlr3-parent.xml	2010-02-01 22:16:19 UTC (rev 11483)
@@ -0,0 +1,250 @@
+<?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.antlr</groupId>
+    <artifactId>antlr-master</artifactId>
+    <packaging>pom</packaging>
+    <version>3.2</version>
+    <name>ANTLR Master build control POM</name>
+    <url>http://maven.apache.org</url>
+
+  <!--
+    What version of ANTLR are we building? This sets the 
+    the version number for all other things that are built
+    as part of an ANTLR release, unless they override or
+    ignore it. We do this via a properites file for this
+    pom.
+    -->
+
+  <!--
+     This is the master pom for building the ANTLR
+     toolset and runtime (Java) at the specific level
+     defined above. Hence we specify here the modules that
+     this pom will build when we build this pom
+    -->
+
+    <modules>
+
+        <module>runtime/Java</module>
+        <module>tool</module>
+        <module>antlr3-maven-plugin</module>
+        <module>gunit</module>
+        <module>gunit-maven-plugin</module>
+    </modules>
+  <!--
+
+    Define where the ANTLR releated jars are deployed both for
+    the main ANTLR repository, which syncs with the maven main
+    repository, and the snapshot repository, which can be
+    used by developers that need the latest development version of
+    something, but is used here to show maven where to deploy
+    snapshots and releases.
+    -->
+    <distributionManagement>
+
+        <repository>
+            <id>antlr-repo</id>
+            <name>ANTLR Testing repository</name>
+            <url>scpexe://antlr.org/home/mavensync/antlr-repo</url>
+        </repository>
+      
+        <snapshotRepository>
+            <id>antlr-snapshot</id>
+            <name>ANTLR Testing Snapshot Repository</name>
+            <url>scpexe://antlr.org/home/mavensync/antlr-snapshot</url>
+        </snapshotRepository>
+
+    </distributionManagement>
+  
+  <!--
+  
+    Inform Maven of the ANTLR snapshot repository, which it will
+    need to consult to get the latest snapshot build of the runtime
+    if it was not built and installed locally.
+    -->
+    <repositories>
+
+      <!--
+        This is the ANTLR repository.
+        -->
+        <repository>
+            <id>antlr-snapshot</id>
+            <name>ANTLR Testing Snapshot Repository</name>
+            <url>http://antlr.org/antlr-snapshot</url>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>always</updatePolicy>
+            </snapshots>
+        </repository>
+      
+    </repositories>
+
+  <!--
+
+    Tell Maven which other artifacts we need in order to
+    build, run and test the ANTLR jars.
+    This is the master pom, and so it only contains those
+    dependencies that are common to all the modules below
+    or are just included for test
+    -->
+    <dependencyManagement>
+
+        <dependencies>
+
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>4.5</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>antlr</groupId>
+                <artifactId>antlr</artifactId>
+                <version>2.7.7</version>
+                <scope>compile</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.antlr</groupId>
+                <artifactId>stringtemplate</artifactId>
+                <version>3.2.1</version>
+                <scope>compile</scope>
+            </dependency>
+
+        </dependencies>
+        
+    </dependencyManagement>
+
+    <build>
+      
+        <defaultGoal>install</defaultGoal>
+
+        <!--
+            The following filter definition means that both the master
+            project and the sub projects will read in a file in the same
+            directory as the pom.xml is located and set any properties
+            that are defined there in the standard x=y format. These
+            properties can then be referenced via ${x} in any resource
+            file specified in any pom. So, there is a master antlr.config
+            file in the same location as this pom.xml file and here you can
+            define anything that is relevant to all the modules that we
+            build here. However each module also has an antlr.config file
+            where you can override property values from the master file or
+            define things that are only relevant to that module. 
+          -->
+        <filters>
+            <filter>antlr.config</filter>
+        </filters>
+
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+        
+        <plugins>
+
+             <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>buildnumber-maven-plugin</artifactId>
+                <configuration>
+                  <format>{0,date,MMM dd, yyyy} {0,time,kk:mm:ss}</format>
+                  <items>
+                    <item>timestamp</item>
+                  </items>
+                </configuration>
+                <executions>
+                  <execution>
+                    <phase>validate</phase>
+                    <goals>
+                      <goal>create</goal>
+                    </goals>
+                  </execution>
+                </executions>
+             </plugin>
+
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>jsr14</target>
+                    <sourceDirectory>src</sourceDirectory>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <configuration>
+                    <findbugsXmlOutput>true</findbugsXmlOutput>
+                    <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
+                    <xmlOutput>true</xmlOutput>
+                </configuration>
+            </plugin>
+
+            <plugin>
+
+                <!--
+
+                    Build an uber-jar for the ANTLR Tool that is packaged with all the other dependencies,
+                    such as the antlr-runtime and stringtemplate etc. This will be useful
+                    for developers, who then do not need to download anything else or
+                    remember that they need stringtemplate.jar in their CLASSPATH and so
+                    on.
+
+                    This does not preclude any of the module generated jars from
+                    being used on their own of course.
+
+                    Here, we also build a master source jar as I was unable to pursuade
+                    this plugin to use multiple configurations and not have the thing
+                    screw up because of multiple modules :-(
+                    
+                  -->
+
+                <artifactId>maven-assembly-plugin</artifactId>
+
+                <!-- 
+                    Do not make the child modules build an assembly
+                  -->
+                <inherited>false</inherited>
+           
+                <configuration>
+                    <descriptors>
+                        <descriptor>antlrjar.xml</descriptor>
+                        <descriptor>antlrsources.xml</descriptor>
+                    </descriptors>
+                        <!--
+
+                            Specify that we want the resulting jar to be executable
+                            via java -jar, which we do by modifying the manifest
+                            of course.
+                          -->
+                    <archive>
+                        <manifest>
+                            <mainClass>org.antlr.Tool</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+
+
+
+            </plugin>
+
+        </plugins>
+
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-ssh-external</artifactId>
+                <version>1.0-beta-2</version>
+            </extension>
+        </extensions>
+
+    </build>
+</project>

Added: trunk/maven-repo-helper/src/test/resources/antlr3-tools.transformed
===================================================================
--- trunk/maven-repo-helper/src/test/resources/antlr3-tools.transformed	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/antlr3-tools.transformed	2010-02-01 22:16:19 UTC (rev 11483)
@@ -0,0 +1,78 @@
+<?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.antlr</groupId>
+	<artifactId>antlr</artifactId>
+	<version>3.2</version>
+	<packaging>jar</packaging>
+	<parent>
+		<groupId>org.antlr</groupId>
+		<artifactId>antlr-master</artifactId>
+		<version>3.2</version>
+	</parent>
+	<properties>
+		<debian.originalVersion>3.2</debian.originalVersion>
+		<debian.package>libantlr3-java</debian.package>
+	</properties>
+
+	<name>ANTLR Grammar Tool</name>
+	<url>http://antlr.org</url>
+	<dependencies>
+		<dependency>
+			<groupId>org.antlr</groupId>
+			<artifactId>antlr-runtime</artifactId>
+			<version>debian</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.x</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+	<build>
+		<defaultGoal>install</defaultGoal>
+		<plugins>
+			<plugin>
+				<groupId>org.antlr</groupId>
+				<artifactId>antlr3-maven-plugin</artifactId>
+				<version>3.2</version>
+				<configuration>
+					<libDirectory>target/generated-sources/antlr/org/antlr/grammar/v3</libDirectory>
+				</configuration>
+				<executions>
+					<execution>
+						<goals>
+							<goal>antlr</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>antlr-maven-plugin</artifactId>
+				<configuration>
+					<sourceDirectory>src/main/antlr2/org/antlr/grammar/v2</sourceDirectory>
+					<grammars>antlr.g codegen.g, antlr.print.g, assign.types.g, buildnfa.g, define.g</grammars>
+				</configuration>
+				<executions>
+					<execution>
+						<goals>
+							<goal>generate</goal>
+						</goals>
+					</execution>
+				</executions>
+				<version>2.1</version>
+			</plugin>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+					<sourceDirectory>src</sourceDirectory>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/antlr3-tools.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/antlr3-tools.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/antlr3-tools.xml	2010-02-01 22:16:19 UTC (rev 11483)
@@ -0,0 +1,106 @@
+<?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.antlr</groupId>
+    <artifactId>antlr</artifactId>
+    <packaging>jar</packaging>
+    <name>ANTLR Grammar Tool</name>
+    <url>http://antlr.org</url>
+
+
+  <!--
+
+    Inherit from the ANTLR master pom, which tells us what
+    version we are and allows us to inherit dependencies
+    and so on.
+
+    -->
+    <parent>
+        <groupId>org.antlr</groupId>
+        <artifactId>antlr-master</artifactId>
+        <version>3.2</version>
+    </parent>
+    <dependencies>
+        <dependency>
+            <groupId>org.antlr</groupId>
+            <artifactId>antlr-runtime</artifactId>
+            <version>${project.version}</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+  <!--
+
+    Tell Maven which other artifacts we need in order to
+    build, run and test the ANTLR Tool. The ANTLR Tool uses earlier versions
+    of ANTLR at runtime (for the moment), uses the current
+    released version of ANTLR String template, but obviously is
+    reliant on the latest snapshot of the runtime, which will either be
+    taken from the antlr-snapshot repository, or your local .m2
+    repository if you built and installed that locally.
+
+    -->
+
+
+    <build>
+
+        <defaultGoal>install</defaultGoal>
+
+        <plugins>
+
+            <plugin>
+
+                <groupId>org.antlr</groupId>
+                <artifactId>antlr3-maven-plugin</artifactId>
+                <version>3.1.3-1</version>
+                <configuration>
+                    <libDirectory>target/generated-sources/antlr/org/antlr/grammar/v3</libDirectory>
+                </configuration>
+                <executions>
+                    <execution>
+
+                        <goals>
+                            <goal>antlr</goal>
+                        </goals>
+                    </execution>
+                </executions>
+
+            </plugin>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>antlr-maven-plugin</artifactId>
+                <configuration>
+                    <sourceDirectory>src/main/antlr2/org/antlr/grammar/v2</sourceDirectory>
+                    <grammars>antlr.g codegen.g, antlr.print.g, assign.types.g, buildnfa.g, define.g</grammars>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                    <sourceDirectory>src</sourceDirectory>
+                </configuration>
+            </plugin>
+
+        </plugins>
+
+
+    </build>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/antlr3.transformed
===================================================================
--- trunk/maven-repo-helper/src/test/resources/antlr3.transformed	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/antlr3.transformed	2010-02-01 22:16:19 UTC (rev 11483)
@@ -0,0 +1,93 @@
+<?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.antlr</groupId>
+	<artifactId>antlr-runtime</artifactId>
+	<version>3.2</version>
+	<packaging>jar</packaging>
+	<parent>
+		<groupId>org.antlr</groupId>
+		<artifactId>antlr-master</artifactId>
+		<version>3.2</version>
+	</parent>
+
+	<properties>
+		<debian.originalVersion>3.2</debian.originalVersion>
+		<debian.package>libantlr3-java</debian.package>
+		<debian.mavenRules>org.antlr antlr-master pom 3.2 *,
+		org.antlr antlr-runtime jar 3.2 *</debian.mavenRules>
+		<debian.originalVersion>3.2</debian.originalVersion>
+		<debian.package>libantlr3-java</debian.package>
+	</properties>
+	<name>Antlr 3 Runtime</name>
+	<description>A framework for constructing recognizers, compilers, and translators from grammatical descriptions containing Java, C#, C++, or Python actions.</description>
+	<url>http://www.antlr.org</url>
+	<developers>
+		<developer>
+			<name>Terence Parr</name>
+			<organization>USFCA</organization>
+			<organizationUrl>http://www.cs.usfca.edu</organizationUrl>
+			<email>parrt at antlr.org</email>
+			<roles>
+				<role>Project Leader</role>
+				<role>Developer - Java Target</role>
+			</roles>
+			<timezone>PST</timezone>
+		</developer>
+		<developer>
+			<name>Jim Idle</name>
+			<organization>Temporal Wave LLC</organization>
+			<organizationUrl>http://www.temporal-wave.com</organizationUrl>
+			<email>jimi at temporal-wave.com</email>
+			<roles>
+				<role>Developer - Maven stuff</role>
+				<role>Developer - C Target</role>
+			</roles>
+			<timezone>PST</timezone>
+		</developer>
+	</developers>
+	<scm>
+		<url>http://fisheye2.cenqua.com/browse/antlr</url>
+		<connection>http://fisheye2.cenqua.com/browse/antlr</connection>
+	</scm>
+	<distributionManagement>
+		<repository>
+			<id>antlr-repo</id>
+			<name>ANTLR Testing repository</name>
+			<url>scpexe://antlr.org/home/mavensync/antlr-repo</url>
+		</repository>
+		<snapshotRepository>
+			<id>antlr-snapshot</id>
+			<name>ANTLR Testing Snapshot Repository</name>
+			<url>scpexe://antlr.org/home/mavensync/antlr-snapshot</url>
+		</snapshotRepository>
+	</distributionManagement>
+	<dependencies>
+		<dependency>
+			<groupId>org.antlr</groupId>
+			<artifactId>stringtemplate</artifactId>
+			<version>3.x</version>
+			<scope>compile</scope>
+		</dependency>
+	</dependencies>
+	<build>
+		<defaultGoal>install</defaultGoal>
+		<extensions>
+			<extension>
+				<groupId>org.apache.maven.wagon</groupId>
+				<artifactId>wagon-ssh-external</artifactId>
+				<version>debian</version>
+			</extension>
+		</extensions>
+		<plugins>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.0.2</version>
+				<configuration>
+					<source>1.5</source>
+					<target>jsr14</target>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/antlr3.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/antlr3.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/antlr3.xml	2010-02-01 22:16:19 UTC (rev 11483)
@@ -0,0 +1,100 @@
+<?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.antlr</groupId>
+	<artifactId>antlr-runtime</artifactId>
+	<version>3.2</version>
+	<packaging>jar</packaging>
+	<parent>
+		<groupId>org.antlr</groupId>
+		<artifactId>antlr-master</artifactId>
+		<version>3.2</version>
+	</parent>
+	<properties>
+		<debian.originalVersion>3.2</debian.originalVersion>
+		<debian.package>libantlr3-java</debian.package>
+		<debian.mavenRules><![CDATA[org.antlr antlr-master pom 3.2 *,
+		org.antlr antlr-runtime jar 3.2 *]]></debian.mavenRules>
+	</properties>
+
+	<name>Antlr 3 Runtime</name>
+	<description>A framework for constructing recognizers, compilers, and translators from grammatical descriptions containing Java, C#, C++, or Python actions.</description>
+	<url>http://www.antlr.org</url>
+	<developers>
+		<developer>
+			<name>Terence Parr</name>
+			<organization>USFCA</organization>
+			<organizationUrl>http://www.cs.usfca.edu</organizationUrl>
+			<email>parrt at antlr.org</email>
+			<roles>
+				<role>Project Leader</role>
+				<role>Developer - Java Target</role>
+			</roles>
+			<timezone>PST</timezone>
+		</developer>
+		<developer>
+			<name>Jim Idle</name>
+			<organization>Temporal Wave LLC</organization>
+			<organizationUrl>http://www.temporal-wave.com</organizationUrl>
+			<email>jimi at temporal-wave.com</email>
+			<roles>
+				<role>Developer - Maven stuff</role>
+				<role>Developer - C Target</role>
+			</roles>
+			<timezone>PST</timezone>
+		</developer>
+	</developers>
+	<scm>
+		<url>http://fisheye2.cenqua.com/browse/antlr</url>
+		<connection>http://fisheye2.cenqua.com/browse/antlr</connection>
+	</scm>
+	<distributionManagement>
+		<repository>
+			<id>antlr-repo</id>
+			<name>ANTLR Testing repository</name>
+			<url>scpexe://antlr.org/home/mavensync/antlr-repo</url>
+		</repository>
+		<snapshotRepository>
+			<id>antlr-snapshot</id>
+			<name>ANTLR Testing Snapshot Repository</name>
+			<url>scpexe://antlr.org/home/mavensync/antlr-snapshot</url>
+		</snapshotRepository>
+	</distributionManagement>
+	<dependencies>
+		<dependency>
+			<groupId>org.antlr</groupId>
+			<artifactId>stringtemplate</artifactId>
+			<version>3.2.1</version>
+			<scope>compile</scope>
+		</dependency>
+	</dependencies>
+	<build>
+		<defaultGoal>install</defaultGoal>
+		<extensions>
+			<extension>
+				<groupId>org.apache.maven.wagon</groupId>
+				<artifactId>wagon-ssh-external</artifactId>
+				<version>debian</version>
+			</extension>
+		</extensions>
+		<plugins>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.0.2</version>
+				<configuration>
+					<source>1.5</source>
+					<target>jsr14</target>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>findbugs-maven-plugin</artifactId>
+				<configuration>
+					<findbugsXmlOutput>true</findbugsXmlOutput>
+					<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
+					<xmlOutput>true</xmlOutput>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Added: trunk/maven-repo-helper/src/test/resources/org/apache/maven/project/pom-4.0.0.xml
===================================================================
--- trunk/maven-repo-helper/src/test/resources/org/apache/maven/project/pom-4.0.0.xml	                        (rev 0)
+++ trunk/maven-repo-helper/src/test/resources/org/apache/maven/project/pom-4.0.0.xml	2010-02-01 22:16:19 UTC (rev 11483)
@@ -0,0 +1,209 @@
+<!--
+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.
+-->
+
+<!-- START SNIPPET: superpom -->
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <name>Maven Default Project</name>
+
+  <repositories>
+    <repository>
+      <id>central</id>
+      <name>Maven Repository Switchboard</name>
+      <layout>default</layout>
+      <url>http://repo1.maven.org/maven2</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <pluginRepositories>
+    <pluginRepository>
+      <id>central</id>
+      <name>Maven Plugin Repository</name>
+      <url>http://repo1.maven.org/maven2</url>
+      <layout>default</layout>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+        <updatePolicy>never</updatePolicy>
+      </releases>
+    </pluginRepository>
+  </pluginRepositories>
+
+  <build>
+    <directory>${project.basedir}/target</directory>
+    <outputDirectory>${project.build.directory}/classes</outputDirectory>
+    <finalName>${project.artifactId}-${project.version}</finalName>
+    <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
+    <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
+    <!-- TODO: MNG-3731 maven-plugin-tools-api < 2.4.4 expect this to be relative... -->
+    <scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
+    <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
+    <resources>
+      <resource>
+        <directory>${project.basedir}/src/main/resources</directory>
+      </resource>
+    </resources>
+    <testResources>
+      <testResource>
+        <directory>${project.basedir}/src/test/resources</directory>
+      </testResource>
+    </testResources>
+   <pluginManagement>
+       <plugins>
+         <plugin>
+           <artifactId>maven-antrun-plugin</artifactId>
+           <version>1.3</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-assembly-plugin</artifactId>
+           <version>2.2-beta-4</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-clean-plugin</artifactId>
+           <version>2.3</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-compiler-plugin</artifactId>
+           <version>2.0.2</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-dependency-plugin</artifactId>
+           <version>2.1</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-deploy-plugin</artifactId>
+           <version>2.4</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-ear-plugin</artifactId>
+           <version>2.3.2</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-ejb-plugin</artifactId>
+           <version>2.2</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-install-plugin</artifactId>
+           <version>2.3</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-jar-plugin</artifactId>
+           <version>2.2</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-javadoc-plugin</artifactId>
+           <version>2.5</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-plugin-plugin</artifactId>
+           <version>2.5</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-rar-plugin</artifactId>
+           <version>2.2</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-release-plugin</artifactId>
+           <version>2.0-beta-8</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-resources-plugin</artifactId>
+           <version>2.3</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-site-plugin</artifactId>
+           <version>2.0</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-source-plugin</artifactId>
+           <version>2.0.4</version>
+         </plugin>
+         <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <version>2.4.3</version>
+         </plugin>
+         <plugin>
+           <artifactId>maven-war-plugin</artifactId>
+           <version>2.1-beta-1</version>
+         </plugin>
+       </plugins>
+     </pluginManagement>
+  </build>
+
+  <reporting>
+    <outputDirectory>${project.build.directory}/site</outputDirectory>
+  </reporting>
+  <profiles>
+    <profile>
+      <id>release-profile</id>
+
+      <activation>
+        <property>
+          <name>performRelease</name>
+          <value>true</value>
+        </property>
+      </activation>
+
+      <build>
+        <plugins>
+          <plugin>
+            <inherited>true</inherited>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-source-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-sources</id>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <inherited>true</inherited>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>attach-javadocs</id>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <inherited>true</inherited>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-deploy-plugin</artifactId>
+            <configuration>
+              <updateReleaseInfo>true</updateReleaseInfo>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+</project>
+<!-- END SNIPPET: superpom -->
\ No newline at end of file




More information about the pkg-java-commits mailing list