[pkg-java] r13130 - in trunk/maven-debian-helper: bin debian maven-debian-helper/src/main/java/org/debian/maven maven-debian-plugin/src/main/java/org/debian/maven/plugin maven-packager-utils/src/main/java/org/debian/maven/packager maven-packager-utils/src/main/resources maven-packager-utils/src/test/java/org/debian/maven/packager maven-packager-utils/src/test/resources share/maven-debian-helper

Ludovic Claude ludovicc-guest at alioth.debian.org
Thu Dec 2 22:45:44 UTC 2010


Author: ludovicc-guest
Date: 2010-12-02 22:45:44 +0000 (Thu, 02 Dec 2010)
New Revision: 13130

Added:
   trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build-classpath.vm
   trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build.xml.vm
   trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/GenerateDebianFilesMojoTest.java
   trunk/maven-debian-helper/maven-packager-utils/src/test/resources/openmrs-api.rules
   trunk/maven-debian-helper/maven-packager-utils/src/test/resources/openmrs-api.substvars
Modified:
   trunk/maven-debian-helper/bin/mh_make
   trunk/maven-debian-helper/debian/changelog
   trunk/maven-debian-helper/debian/control
   trunk/maven-debian-helper/maven-debian-helper/src/main/java/org/debian/maven/Wrapper.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallDocMojo.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveCompileMojo.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveNoneMojo.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveRuntimeMojo.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveTestMojo.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallDocMojo.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java
   trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysUninstallMojo.java
   trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesMojo.java
   trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
   trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
   trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build.properties.ant.vm
   trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.ant.vm
   trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.vm
   trunk/maven-debian-helper/maven-packager-utils/src/main/resources/copyright.vm
   trunk/maven-debian-helper/maven-packager-utils/src/main/resources/rules.ant.vm
   trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/DependenciesSolverTest.java
   trunk/maven-debian-helper/maven-packager-utils/src/test/resources/libplexus-active-collections-java.substvars
   trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh
Log:
* d/control: Add Recommends on devscripts (which provides licensecheck)
* mh_make: 
   - Improve generated copyright
   - Fix generated rules for a build using ant
   - When ignoring dependencies, don't fail the build
   - When ant is used as the build tool, generate the build.xml file
     required for multi projects.
   - use licensecheck as an additional source of information for licenses

Modified: trunk/maven-debian-helper/bin/mh_make
===================================================================
--- trunk/maven-debian-helper/bin/mh_make	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/bin/mh_make	2010-12-02 22:45:44 UTC (rev 13130)
@@ -110,7 +110,7 @@
     read -p "[y]/n > " RUN
     RUN_TESTS="true"
     if [ "$RUN" == "n" ]; then
-        RUN_TESTS="false"
+        RUN_TESTS=
     fi
 fi
 
@@ -120,12 +120,41 @@
     read -p "[y]/n > " GEN
     GEN_JAVADOC="true"
     if [ "$GEN" == "n" ]; then
-        GEN_JAVADOC="false"
+        GEN_JAVADOC=
     fi
 fi
 
+echo
+echo "Checking that apt-file is installed and has been configured..."
+if [ -f /usr/bin/apt-file ]; then
+    apt-file search /usr/bin/mvnDebug | grep maven > /dev/null
+    if [ $? != 0 ]; then
+        echo "Warning: apt-file doesn't seem to be configured"
+        echo "Running sudo apt-file update"
+        sudo apt-file update
+    else
+        echo '[ok]'
+    fi
+else
+    echo "Warning: apt-file doesn't seem to be installed"
+    echo "Installing apt-file using sudo apt-get install apt-file"
+    sudo apt-get install apt-file
+    sudo apt-file update
+fi
+
+echo
+echo "Checking that licensecheck is installed..."
+if [ ! -f /usr/bin/licensecheck ]; then
+    echo "Warning: licensecheck doesn't seem to be installed"
+    echo "Installing licensecheck using sudo apt-get install devscripts"
+    sudo apt-get install devscripts
+else
+    echo '[ok]'
+fi
+
 if [ -n "$FROM_SVN" ]; then
 	echo
+	echo "Downloading the upstream sources..."
 	SVN_OPTIONS=
 	if [[ "$FROM_SVN" =~ https://.*\.dev\.java\.net/.* ]]; then
 		echo "Press enter if a password is asked"
@@ -139,26 +168,26 @@
 	mh_unpatchpoms -p$BIN_PACKAGE
 fi
 
-echo
-echo "Checking that apt-file is installed and has been configured..."
-if [ -f /usr/bin/apt-file ]; then
-    apt-file search /usr/bin/mvnDebug | grep maven > /dev/null
-    if [ $? != 0 ]; then
-        echo "Warning: apt-file doesn't seem to be configured"
-        echo "Running sudo apt-file update"
-        sudo apt-file update
-    fi
-else
-    echo "Warning: apt-file doesn't seem to be installed"
-    echo "Installing apt-file using sudo apt-get install apt-file"
-    sudo apt-get install apt-file
-    sudo apt-file update
+# Restore state after a brutal stop
+if [ -f debian/$BIN_PACKAGE.poms ]; then
+    mh_unpatchpoms -p$BIN_PACKAGE
 fi
+if [ -f debian/patches/series ]; then
+    quilt pop -a
+fi
 
+# Apply existing quilt patchs as source 3(quilt) is used in the package
+if [ -f debian/patches/series ]; then
+    quilt push -a
+fi
+
 echo
-java -cp /usr/share/java/maven-project.jar:/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar:/usr/share/maven2/lib/maven-debian-uber.jar org.debian.maven.packager.DependenciesSolver --package="$BIN_PACKAGE" ${ANT:+--ant} ${GEN_JAVADOC:+--generate-javadoc} ${RUN_TESTS:+--run-tests} ${VERBOSE:+--verbose} --maven-repo=/usr/share/maven-repo
+java -cp /usr/share/java/maven-project.jar:/usr/share/java/maven-repo-helper.jar:/usr/share/java/maven-packager-utils.jar:/usr/share/maven2/lib/maven-debian-uber.jar org.debian.maven.packager.DependenciesSolver --verbose --package="$BIN_PACKAGE" ${ANT:+--ant} ${GEN_JAVADOC:+--generate-javadoc} ${RUN_TESTS:+--run-tests} ${VERBOSE:+--verbose} --maven-repo=/usr/share/maven-repo
 
 if [ $? != 0 ]; then
+    if [ -f debian/patches/series ]; then
+        quilt pop -a
+    fi
     exit 1
 fi
 
@@ -169,6 +198,12 @@
 mvn org.debian.maven:maven-packager-utils:$MH_VERSION:generate -Demail="$DEBEMAIL" -Dpackager="$DEBFULLNAME" -DpackagerLicense="$DEBLICENSE" -Dpackage="$PACKAGE" -Dbin.package="$BIN_PACKAGE" -DrunTests="$RUN_TESTS" -DgenerateJavadoc="$GEN_JAVADOC" -Dmaven.repo.local=/usr/share/maven-repo ${ANT:+-DpackageType=ant} ${FROM_SVN:+-DdownloadUrl=scm:svn:$FROM_SVN} --offline
 
 if [ $? != 0 ]; then
+    if [ -f debian/$BIN_PACKAGE.poms ]; then
+        mh_unpatchpoms -p$BIN_PACKAGE
+    fi
+    if [ -f debian/patches/series ]; then
+        quilt pop -a
+    fi
     exit 1
 fi
 
@@ -177,5 +212,12 @@
     dch --create --newversion=${debianVersion}-1 --package=$PACKAGE "Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>"
 fi
 
-mh_unpatchpoms -p$BIN_PACKAGE
-rm -f debian/*.substvars
\ No newline at end of file
+if [ -f debian/$BIN_PACKAGE.poms ]; then
+    mh_unpatchpoms -p$BIN_PACKAGE
+fi
+if [ -f debian/patches/series ]; then
+    quilt pop -a
+fi
+
+rm -f debian/*.substvars
+rm -f .debianVersion

Modified: trunk/maven-debian-helper/debian/changelog
===================================================================
--- trunk/maven-debian-helper/debian/changelog	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/debian/changelog	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,3 +1,16 @@
+maven-debian-helper (1.4) experimental; urgency=low
+
+  * d/control: Add Recommends on devscripts (which provides licensecheck)
+  * mh_make: 
+     - Improve generated copyright
+     - Fix generated rules for a build using ant
+     - When ignoring dependencies, don't fail the build
+     - When ant is used as the build tool, generate the build.xml file
+       required for multi projects.
+     - use licensecheck as an additional source of information for licenses
+
+ -- Ludovic Claude <ludovic.claude at laposte.net>  Fri, 12 Nov 2010 12:26:37 +0100
+
 maven-debian-helper (1.3) experimental; urgency=low
 
   * ${maven:Depends} and similar substitution vars: add

Modified: trunk/maven-debian-helper/debian/control
===================================================================
--- trunk/maven-debian-helper/debian/control	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/debian/control	2010-12-02 22:45:44 UTC (rev 13130)
@@ -18,7 +18,7 @@
  libmaven-clean-plugin-java, libmaven-resources-plugin-java,
  libmaven-compiler-plugin-java, libmaven-jar-plugin-java, libmaven-site-plugin-java,
  libsurefire-java, velocity, libplexus-velocity-java
-Recommends: apt-file, subversion
+Recommends: apt-file, devscripts, subversion
 Suggests: libmaven-javadoc-plugin-java
 Description: Helper tools for building Debian packages with Maven
  Maven is a software project management and comprehension tool. Based on the

Modified: trunk/maven-debian-helper/maven-debian-helper/src/main/java/org/debian/maven/Wrapper.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-helper/src/main/java/org/debian/maven/Wrapper.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-helper/src/main/java/org/debian/maven/Wrapper.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven;
 
+/*
+ * Copyright 2009 Torsten Werner.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.Enumeration;

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallDocMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallDocMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallDocMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven.plugin;
 
+/*
+ * Copyright 2009 Torsten Werner.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import java.io.File;
 
 /**

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/InstallMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven.plugin;
 
+/*
+ * Copyright 2009 Torsten Werner.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import java.io.File;
 
 /**

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveCompileMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveCompileMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveCompileMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven.plugin;
 
+/*
+ * Copyright 2009 Torsten Werner.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /**
  * resolves compile dependencies
  *

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveNoneMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveNoneMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveNoneMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven.plugin;
 
+/*
+ * Copyright 2009 Torsten Werner.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveRuntimeMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveRuntimeMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveRuntimeMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven.plugin;
 
+/*
+ * Copyright 2009 Torsten Werner.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /**
  * resolves runtime dependencies
  *

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveTestMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveTestMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/ResolveTestMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven.plugin;
 
+/*
+ * Copyright 2009 Torsten Werner.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /**
  * resolves test dependencies
  *

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallDocMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallDocMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallDocMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -2,6 +2,22 @@
 
 import java.io.IOException;
 
+/*
+ * Copyright 2009 Torsten Werner, Ludovic Claude.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /**
  * Install the javadoc jar.
  * 

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven.plugin;
 
+/*
+ * Copyright 2009 Torsten Werner, Ludovic Claude.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;

Modified: trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysUninstallMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysUninstallMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-debian-plugin/src/main/java/org/debian/maven/plugin/SysUninstallMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,21 @@
 package org.debian.maven.plugin;
 
+/*
+ * Copyright 2009 Torsten Werner, Ludovic Claude.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 import java.io.IOException;
 import org.codehaus.plexus.util.FileUtils;
 

Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 

Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 import java.io.*;
 import java.util.*;
 import java.util.logging.Level;
@@ -133,6 +134,7 @@
     private List toResolve = new ArrayList();
     private Set knownProjectDependencies = new TreeSet();
     private Set ignoredDependencies = new TreeSet();
+    private Set notIgnoredDependencies = new TreeSet();
     private Set compileDepends = new TreeSet();
     private Set testDepends = new TreeSet();
     private Set runtimeDepends = new TreeSet();
@@ -164,6 +166,7 @@
         cleanIgnoreRules.setDescription(readResource("maven.cleanIgnoreRules.description"));
         cleanIgnoreRules.setWarnRulesFileNotFound(false);
         cleanIgnoreRules.setVerbose(true);
+        cleanIgnoreRules.setDontDuplicate(pomTransformer.getIgnoreRules());        
 
         Rule toDebianRule = new Rule("s/.*/debian/");
         toDebianRule.setDescription("Change the version to the symbolic 'debian' version");
@@ -193,6 +196,10 @@
         return sb.toString();
     }
 
+    public boolean isRunTests() {
+        return runTests;
+    }
+
     public void setRunTests(boolean b) {
         this.runTests = b;
     }
@@ -201,7 +208,11 @@
         this.offline = offline;
     }
 
-    private void setGenerateJavadoc(boolean b) {
+    public boolean isGenerateJavadoc() {
+        return generateJavadoc;
+    }
+
+    public void setGenerateJavadoc(boolean b) {
         this.generateJavadoc = b;
     }
 
@@ -262,7 +273,7 @@
     }
 
     private boolean askIgnoreDependency(String sourcePomLoc, Dependency dependency, String message, boolean defaultToIgnore) {
-        if (!interactive) {
+        if (!interactive || notIgnoredDependencies.contains(dependency)) {
             return false;
         }
         System.out.println();
@@ -275,11 +286,11 @@
             System.out.print("y/[n] > ");
         }
         String s = readLine().toLowerCase();
-        if (defaultToIgnore) {
-            return !s.startsWith("n");
-        } else {
-            return s.startsWith("y");
+        boolean ignore = defaultToIgnore ? !s.startsWith("n") : s.startsWith("y");
+        if (!ignore) {
+            notIgnoredDependencies.add(dependency);
         }
+        return ignore;
     }
 
     public boolean isInteractive() {
@@ -332,10 +343,16 @@
     }
 
     public void saveMavenRules() {
+        // Don't save implicit rules
+        pomTransformer.getRules().remove(DependencyRule.TO_DEBIAN_VERSION_RULE);
+        pomTransformer.getRules().remove(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE);
         pomTransformer.getRules().save();
     }
 
     public void saveMavenPublishedRules() {
+        // Don't save implicit rules
+        pomTransformer.getPublishedRules().remove(DependencyRule.TO_DEBIAN_VERSION_RULE);
+        pomTransformer.getPublishedRules().remove(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE);
         pomTransformer.getPublishedRules().save();
     }
 
@@ -540,7 +557,9 @@
                 pom.setParent(null);
             } else if (pom.getParent() != null) {
                 boolean oldNoParent = getPOMOptions(projectPom).isNoParent();
-                pom.setParent(resolveDependency(pom.getParent(), projectPom, true, false, false, true));
+                // Don't mark the parent dependency as 'build time' dependency because once installed,
+                // the POM for this project will always need the parent POM to be available
+                pom.setParent(resolveDependency(pom.getParent(), projectPom, false, false, false, true));
                 if (getPOMOptions(projectPom).isNoParent() != oldNoParent) {
                     resetPOM(projectPom);
                     pom = getPOM(projectPom);
@@ -548,6 +567,13 @@
             }
 
             getRepository().registerPom(projectPom, pom);
+            // Also register automatically the test jar which may accompany the current jar and be
+            // used in another module of the same project
+            if ("jar".equals(pom.getThisPom().getType())) {
+                POMInfo testPom = (POMInfo) pom.clone();
+                testPom.getThisPom().setType("test-jar");
+                getRepository().registerPom(projectPom, testPom);
+            }
 
             knownProjectDependencies.add(pom.getThisPom());
 
@@ -590,7 +616,7 @@
                     i.hasNext(); ) {
                 DependencyRule previousRule = (DependencyRule) i.next();
                 if (!previousRule.equals(DependencyRule.TO_DEBIAN_VERSION_RULE) &&
-                        !previousRule.equals(DependencyRule.TO_DEBIAN_VERSION_RULE) &&
+                        !previousRule.equals(DependencyRule.MAVEN_PLUGINS_KEEP_VERSION_RULE) &&
                         previousRule.matches(pom.getThisPom())) {
                     explicitlyMentionedInRules = true;
                     break;
@@ -716,6 +742,7 @@
             noParent = options.isNoParent();
             hasPackageVersion = options.getHasPackageVersion();
         }
+
         info = pomTransformer.transformPom(projectPom, tmpDest, noParent, hasPackageVersion, false, false, null, null, true);
         pomInfoCache.put(projectPom.getAbsolutePath(), info);
         return info;
@@ -780,24 +807,32 @@
         String baseDirPath = baseDir.getAbsolutePath();
         sourcePomLoc = sourcePomLoc.substring(baseDirPath.length() + 1, sourcePomLoc.length());
         if (verbose) {
-            System.out.println("Resolving " + dependency);
+            String msg = "Resolving " + dependency;
+            if (dependency.getScope() != null) {
+                msg += " of scope " + dependency.getScope();
+            }
+            System.out.println(msg + "...");
         }
+
+        // First let the packager mark as ignored those dependencies which should be ignored
         boolean ignoreDependency = false;
-        if ("maven-plugin".equals(dependency.getType()) && packageType.equals("ant")) {
-            ignoreDependency = true;
-        } else if (canIgnorePlugin(dependency)) {
+        if (!ignoreDependency && canIgnorePlugin(dependency)) {
             ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This plugin is not useful for the build or its use is against Debian policies. Ignore this plugin?");
-        } else if (canIgnoreExtension(dependency)) {
+        }
+        if (!ignoreDependency && canIgnoreExtension(dependency)) {
             ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This extension is not useful for the build or its use is against Debian policies. Ignore this extension?");
-        } else if (canBeIgnoredPlugin(dependency)) {
+        }
+        if (!ignoreDependency && canBeIgnoredPlugin(dependency)) {
             ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This plugin may be ignored in some cases. Ignore this plugin?");
-        } else if (!runTests) {
+        }
+        if (!ignoreDependency && !runTests) {
             if ("test".equals(dependency.getScope())) {
                 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "Tests are turned off. Ignore this test dependency?");
             } else if (isTestPlugin(dependency)) {
                 ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "Tests are turned off. Ignore this test plugin?");
             }
-        } else if (!generateJavadoc && isDocumentationOrReportPlugin(dependency)) {
+        }
+        if (!ignoreDependency && !generateJavadoc && isDocumentationOrReportPlugin(dependency)) {
             ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "Documentation is turned off. Ignore this documentation plugin?");
         }
 
@@ -805,9 +840,55 @@
             ignoredDependencies.add(dependency);
             String ruleDef = dependency.getGroupId() + " " + dependency.getArtifactId() + " * *";
             pomTransformer.getIgnoreRules().add(new DependencyRule(ruleDef));
+            if (verbose) {
+                System.out.println("[ignored]");
+            }
             return null;
         }
 
+        // Automatically skip some dependencies when ant packaging is used
+        boolean skipDependency = false;
+        String skipReason = "";
+        if (packageType.equals("ant")) {
+            if ("maven-plugin".equals(dependency.getType())) {
+                try {
+                    if (!getPOM(sourcePom).getThisPom().getType().equals("pom")) {
+                        skipDependency = true;
+                        skipReason = "Maven plugins are not used during a build with Ant";
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+            if (!runTests && "test".equals(dependency.getScope())) {
+                skipDependency = true;
+                skipReason = "Tests are not executed during the build";
+            }
+        }
+        if (skipDependency) {
+            // Even if we skip the dependency, try to locate its associated maven rules,
+            // as this may be useful later - but never fail if the dependency is not found.
+            POMInfo pom = getRepository().searchMatchingPOM(dependency);
+            if (pom != null) {
+                String mavenRules = (String) pom.getProperties().get("debian.mavenRules");
+                if (mavenRules != null) {
+                    StringTokenizer st = new StringTokenizer(mavenRules, ",");
+                    while (st.hasMoreTokens()) {
+                        String ruleDef = st.nextToken().trim();
+                        pomTransformer.getRules().add(new DependencyRule(ruleDef));
+                    }
+                }
+            }
+            if (verbose) {
+                if (!skipReason.isEmpty()) {
+                    System.out.println("[skipped - " + skipReason + "]");
+                } else {
+                    System.out.println("[skipped]");
+                }
+            }
+            return null;
+        }
+
         POMInfo pom = getRepository().searchMatchingPOM(dependency);
         if (pom == null && dependency.getVersion() == null) {
             // Set a dummy version and try again
@@ -836,7 +917,15 @@
 
         if (pom == null) {
             if (management) {
+                if (verbose) {
+                    System.out.println("[skipped dependency or plugin management]");
+                }
                 return null;
+            } else if ("maven-plugin".equals(dependency.getType()) && packageType.equals("ant")) {
+                    if (verbose) {
+                        System.out.println("[skipped - not used in Ant build]");
+                    }
+                    return null;
             } else {
                 if (!ignoreDependency) {
                     if (resolvingParent) {
@@ -844,25 +933,35 @@
                                 "The parent POM cannot be found in the Maven repository for Debian. Ignore it?");
                         getPOMOptions(sourcePom).setNoParent(noParent);
                         if (noParent) {
+                            if (verbose) {
+                                System.out.println("[no-parent]");
+                            }
                             return null;
                         }
                     } else if (isDocumentationOrReportPlugin(dependency)) {
                         ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency,
                                 "This documentation or report plugin cannot be found in the Maven repository for Debian. Ignore this plugin?");
                     } else if ("maven-plugin".equals(dependency.getType())) {
-                        issues.add(sourcePomLoc + ": Plugin is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
-                                + dependency.getArtifactId() + ":" + dependency.getVersion());
                         ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This plugin cannot be found in the Debian Maven repository. Ignore this plugin?", false);
+                        if (!ignoreDependency) {
+                            issues.add(sourcePomLoc + ": Plugin is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
+                                    + dependency.getArtifactId() + ":" + dependency.getVersion());
+                        }
                     } else {
-                        issues.add(sourcePomLoc + ": Dependency is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
-                                + dependency.getArtifactId() + ":" + dependency.getVersion());
                         ignoreDependency = askIgnoreDependency(sourcePomLoc, dependency, "This dependency cannot be found in the Debian Maven repository. Ignore this dependency?", false);
+                        if (!ignoreDependency) {
+                            issues.add(sourcePomLoc + ": Dependency is not packaged in the Maven repository for Debian: " + dependency.getGroupId() + ":"
+                                    + dependency.getArtifactId() + ":" + dependency.getVersion());
+                        }
                     }
                 }
                 if (ignoreDependency) {
                     ignoredDependencies.add(dependency);
                     String ruleDef = dependency.getGroupId() + " " + dependency.getArtifactId() + " * *";
                     pomTransformer.getIgnoreRules().add(new DependencyRule(ruleDef));
+                    if (verbose) {
+                        System.out.println("[ignored]");
+                    }
                     return null;
                 } else {
                     String pkg = searchPkg(new File("/usr/share/maven-repo/"
@@ -880,6 +979,9 @@
                             return resolveDependency(dependency, sourcePom, buildTime, mavenExtension, management);
                         } 
                     }
+                    if (verbose) {
+                        System.out.println("[error]");
+                    }
                     throw new DependencyNotFoundException(dependency);
                 }
             }
@@ -947,6 +1049,9 @@
                 pomTransformer.getRules().add(new DependencyRule(ruleDef));
             }
         }
+        if (verbose) {
+            System.out.println("[ok]");
+        }
         return pom.getThisPom();
     }
 
@@ -1114,6 +1219,9 @@
             System.out.println("  --generate-javadoc: generate Javadoc");
             System.out.println("  --non-interactive: non interactive session");
             System.out.println("  --offline: offline mode for Debian build compatibility");
+            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");
             return;
         }
         DependenciesSolver solver = new DependenciesSolver();
@@ -1126,6 +1234,7 @@
         boolean verbose = false;
         String debianPackage = "";
         String packageType = "maven";
+        File mavenRepo = null;
         while (i < args.length && (args[i].trim().startsWith("-") || args[i].trim().isEmpty())) {
             String arg = args[i].trim();
             if ("--verbose".equals(arg) || "-v".equals(arg)) {
@@ -1144,6 +1253,10 @@
                 solver.setInteractive(false);
             } else if (arg.equals("--offline")) {
                 solver.setOffline(true);
+            } 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);
         }
@@ -1154,8 +1267,21 @@
         solver.setExploreProjects(true);
         solver.setListOfPoms(poms);
 
+        if (mavenRepo != null) {
+            Repository repository = new Repository(mavenRepo);
+            solver.getPomTransformer().setRepository(repository);
+            solver.getPomTransformer().usePluginVersionsFromRepository();
+        }
+
         if (verbose) {
-            System.out.println("Solving dependencies for package " + debianPackage);
+            String msg = "Solving dependencies for package " + debianPackage;
+            if (solver.isRunTests()) {
+                msg += " (tests are included)";
+            }
+            if (solver.isGenerateJavadoc()) {
+                msg += " (documentation is included)";
+            }
+            System.out.println(msg);
             solver.setVerbose(true);
         }
 

Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/GenerateDebianFilesMojo.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 import org.apache.maven.model.Developer;
 import org.apache.maven.model.License;
 import org.apache.maven.plugin.AbstractMojo;
@@ -154,6 +155,7 @@
             context.put("packager", packager);
             context.put("packagerEmail", email);
             context.put("project", project);
+            context.put("collectedProjects", collectedProjects);
             context.put("runTests", Boolean.valueOf(runTests));
             context.put("generateJavadoc", Boolean.valueOf(generateJavadoc));
 
@@ -166,77 +168,7 @@
                 project.setUrl(readLine());
             }
 
-            Set licenses = new TreeSet();
-            for (Iterator i = project.getLicenses().iterator(); i.hasNext(); ) {
-                License license = (License) i.next();
-                String licenseName = "";
-                if (license.getName() != null) {
-                    licenseName = license.getName() + " ";
-                }
-                String licenseUrl = "";
-                if (license.getUrl() != null) {
-                    licenseUrl = license.getUrl().toLowerCase();
-                }
-                boolean recognized = false;
-                if (licenseName.indexOf("mit ") >= 0 || licenseUrl.indexOf("mit-license") >= 0) {
-                    licenses.add("MIT");
-                    recognized = true;
-                } else if (licenseName.indexOf("bsd ") >= 0 || licenseUrl.indexOf("bsd-license") >= 0) {
-                    licenses.add("BSD");
-                    recognized = true;
-                } else if (licenseName.indexOf("artistic ") >= 0 || licenseUrl.indexOf("artistic-license") >= 0) {
-                    licenses.add("Artistic");
-                    recognized = true;
-                } else if (licenseName.indexOf("apache ") >= 0 || licenseUrl.indexOf("apache") >= 0) {
-                    if (licenseName.indexOf("2.") >= 0 || licenseUrl.indexOf("2.") >= 0) {
-                        licenses.add("Apache-2.0");
-                        recognized = true;
-                    } else if (licenseName.indexOf("1.0") >= 0 || licenseUrl.indexOf("1.0") >= 0) {
-                        licenses.add("Apache-1.0");
-                        recognized = true;
-                    } else if (licenseName.indexOf("1.1") >= 0 || licenseUrl.indexOf("1.1") >= 0) {
-                        licenses.add("Apache-1.1");
-                        recognized = true;
-                    }
-                } else if (licenseName.indexOf("lgpl ") >= 0 || licenseUrl.indexOf("lgpl") >= 0) {
-                    if (licenseName.indexOf("2.1") >= 0 || licenseUrl.indexOf("2.1") >= 0) {
-                        licenses.add("LGPL-2.1");
-                        recognized = true;
-                    } else if (licenseName.indexOf("2") >= 0 || licenseUrl.indexOf("2") >= 0) {
-                        licenses.add("LGPL-2");
-                        recognized = true;
-                    } else if (licenseName.indexOf("3") >= 0 || licenseUrl.indexOf("3") >= 0) {
-                        licenses.add("LGPL-2");
-                        recognized = true;
-                    }
-                } else if (licenseName.indexOf("gpl ") >= 0 || licenseUrl.indexOf("gpl") >= 0) {
-                    if (licenseName.indexOf("2") >= 0 || licenseUrl.indexOf("2") >= 0) {
-                        licenses.add("GPL-2");
-                        recognized = true;
-                    } else if (licenseName.indexOf("3") >= 0 || licenseUrl.indexOf("3") >= 0) {
-                        licenses.add("GPL-3");
-                        recognized = true;
-                    }
-                }
-                if (!recognized) {
-                    System.out.println("License " + licenseName + licenseUrl + " was not recognized, please enter a license name preferably in one of:");
-                    System.out.println("Apache Artistic BSD FreeBSD ISC CC-BY CC-BY-SA CC-BY-ND CC-BY-NC CC-BY-NC-SA CC-BY-NC-ND CC0 CDDL CPL Eiffel");
-                    System.out.println("Expat GPL LGPL GFDL GFDL-NIV LPPL MPL Perl PSF QPL W3C-Software ZLIB Zope");
-                    String s = readLine();
-                    if (s.length() > 0) {
-                        licenses.add(s);
-                    }
-                }
-            }
-            if (licenses.isEmpty()) {
-                System.out.println("License was not found, please enter a license name preferably in one of:");
-                System.out.println("Apache Artistic BSD FreeBSD ISC CC-BY CC-BY-SA CC-BY-ND CC-BY-NC CC-BY-NC-SA CC-BY-NC-ND CC0 CDDL CPL Eiffel");
-                System.out.println("Expat GPL LGPL GFDL GFDL-NIV LPPL MPL Perl PSF QPL W3C-Software ZLIB Zope");
-                String s = readLine();
-                if (s.length() > 0) {
-                    licenses.add(s);
-                }
-            }
+            Set licenses = discoverLicenses();
             context.put("licenses", licenses);
 
             if (licenses.size() == 1) {
@@ -278,7 +210,6 @@
             if (projectTeam == null || projectTeam.isEmpty()) {
                 projectTeam = project.getName() + " developers";
             }
-            context.put("copyrightOwner", copyrightOwner);
             context.put("projectTeam", projectTeam);
 
             String copyrightYear;
@@ -383,6 +314,8 @@
                 context.put("compileDependencies", depends);
                 context.put("runtimeDependencies", split(substvars.getProperty("maven.Depends")));
                 context.put("optionalDependencies", split(substvars.getProperty("maven.OptionalDepends")));
+                context.put("javadocDependencies", split(substvars.getProperty("maven.DocDepends")));
+                context.put("javadocOptionalDependencies", split(substvars.getProperty("maven.DocOptionalDepends")));
 
                 if ("ant".equals(packageType)) {
                     Set buildJars = new TreeSet();
@@ -399,27 +332,10 @@
 
             if ("ant".equals(packageType)) {
                 ListOfPOMs listOfPOMs = new ListOfPOMs(new File(outputDirectory, binPackageName + ".poms"));
+                setupArtifactLocation(listOfPOMs, project);
                 for (Iterator i = collectedProjects.iterator(); i.hasNext();) {
                     MavenProject mavenProject = (MavenProject) i.next();
-                    String basedir = project.getBasedir().getAbsolutePath();
-                    String dirRelPath = mavenProject.getBasedir().getAbsolutePath().substring(basedir.length() + 1);
-                    if (! "pom".equals(mavenProject.getPackaging())) {
-                        String pomFile = dirRelPath + "/pom.xml";
-                        listOfPOMs.getOrCreatePOMOptions(pomFile).setJavaLib(true);
-                        String extension = mavenProject.getPackaging();
-                        if (extension.equals("bundle")) {
-                            extension = "jar";
-                        }
-                        if (extension.equals("webapp")) {
-                            extension = "war";
-                        }
-                        if (mavenProject.getArtifact() != null && mavenProject.getArtifact().getFile() != null) {
-                            extension = mavenProject.getArtifact().getFile().toString();
-                            extension = extension.substring(extension.lastIndexOf('.') + 1);
-                        }
-                        listOfPOMs.getOrCreatePOMOptions(pomFile).setArtifact(dirRelPath + "/" + mavenProject.getArtifactId() + "-*."
-                            + extension);
-                    }
+                    setupArtifactLocation(listOfPOMs, mavenProject);
                 }
                 listOfPOMs.save();
             }
@@ -465,16 +381,9 @@
                     context.put("tagMarker", tagMarker);
                     context.put("suffixUrl", suffixUrl);
 
-                    FileWriter out = new FileWriter(new File(outputDirectory, "watch"));
-                    Velocity.mergeTemplate("watch.svn.vm", "UTF8", context, out);
-                    out.flush();
-                    out.close();
+                    generateFile(context, "watch.svn.vm", outputDirectory, "watch");
+                    generateFile(context, "orig-tar.svn.vm", outputDirectory, "orig-tar.sh");
 
-                    out = new FileWriter(new File(outputDirectory, "orig-tar.sh"));
-                    Velocity.mergeTemplate("orig-tar.svn.vm", "UTF8", context, out);
-                    out.flush();
-                    out.close();
-
                     makeExecutable("debian/orig-tar.sh");
 
                 } else {
@@ -510,7 +419,29 @@
             }
 
             if ("ant".equals(packageType)) {
+                boolean containsJars = false;
+                boolean containsPlugins = false;
+                if (project.getPackaging().equals("pom") && project.getModules().size() > 0) {
+                    for (Iterator i = collectedProjects.iterator(); i.hasNext(); ) {
+                        MavenProject module = (MavenProject) i.next();
+                        if (module.getPackaging().equals("maven-plugin")) {
+                            containsPlugins = true;
+                        } else if (!module.getPackaging().equals("pom")) {
+                            containsJars = true;
+                        }
+                    }
+                    generateFile(context, "build.xml.vm", outputDirectory, "build.xml");
+                } else if (!project.getPackaging().equals("pom")) {
+                    if (project.getPackaging().equals("maven-plugin")) {
+                        containsPlugins = true;
+                    } else if (!project.getPackaging().equals("pom")) {
+                        containsJars = true;
+                    }
+                }
+                context.put("containsJars", Boolean.valueOf(containsJars));
+                context.put("containsPlugins", Boolean.valueOf(containsPlugins));
                 generateFile(context, "build.properties.ant.vm", outputDirectory, "build.properties");
+                generateFile(context, "build-classpath.vm", outputDirectory, "build-classpath");
             } else {
                 generateFile(context, "maven.properties.vm", outputDirectory, "maven.properties");
             }
@@ -523,6 +454,147 @@
         }
     }
 
+    private void setupArtifactLocation(ListOfPOMs listOfPOMs, MavenProject mavenProject) {
+        String basedir = project.getBasedir().getAbsolutePath();
+        String dirRelPath = mavenProject.getBasedir().getAbsolutePath().substring(basedir.length() + 1);
+        if (! "pom".equals(mavenProject.getPackaging())) {
+            String pomFile = dirRelPath + "/pom.xml";
+            listOfPOMs.getOrCreatePOMOptions(pomFile).setJavaLib(true);
+            String extension = mavenProject.getPackaging();
+            if (extension.equals("bundle")) {
+                extension = "jar";
+            }
+            if (extension.equals("webapp")) {
+                extension = "war";
+            }
+            if (mavenProject.getArtifact() != null && mavenProject.getArtifact().getFile() != null) {
+                extension = mavenProject.getArtifact().getFile().toString();
+                extension = extension.substring(extension.lastIndexOf('.') + 1);
+            }
+            ListOfPOMs.POMOptions pomOptions = listOfPOMs.getOrCreatePOMOptions(pomFile);
+            pomOptions.setArtifact(dirRelPath + "/target/" + mavenProject.getArtifactId() + "-*."
+                + extension);
+            if ("jar".equals(extension) && generateJavadoc && "ant".equals(packageType)) {
+                String artifactId = mavenProject.getArtifact().getArtifactId();
+                String docPom = dirRelPath + "/target/" + artifactId + ".javadoc.pom";
+                listOfPOMs.getOrCreatePOMOptions(docPom).setIgnorePOM(true);
+                listOfPOMs.getOrCreatePOMOptions(docPom).setArtifact(dirRelPath + "/target/" + artifactId + ".javadoc.jar");
+                listOfPOMs.getOrCreatePOMOptions(docPom).setClassifier("javadoc");
+                listOfPOMs.getOrCreatePOMOptions(docPom).setHasPackageVersion(pomOptions.getHasPackageVersion());
+                listOfPOMs.getOrCreatePOMOptions(docPom).setDestPackage(packageName + "-doc");
+            }
+            pomOptions.setJavaLib(true);
+            if (mavenProject.getArtifactId().matches(packageName + "\\d")) {
+                pomOptions.setUsjName(packageName);
+            }
+        }
+    }
+
+    private Set discoverLicenses() {
+        Set licenses = new TreeSet();
+        for (Iterator i = project.getLicenses().iterator(); i.hasNext(); ) {
+            License license = (License) i.next();
+            String licenseName = "";
+            if (license.getName() != null) {
+                licenseName = license.getName() + " ";
+            }
+            String licenseUrl = "";
+            if (license.getUrl() != null) {
+                licenseUrl = license.getUrl();
+            }
+            boolean recognized = recognizeLicense(licenses, licenseName, licenseUrl);
+            if (!recognized) {
+                System.out.println("License " + licenseName + licenseUrl + " was not recognized, please enter a license name preferably in one of:");
+                printAvailableLicenses();
+                System.out.print("> ");
+                String s = readLine();
+                if (s.length() > 0) {
+                    licenses.add(s);
+                }
+            }
+        }
+        LicenseCheckResult licenseResult = new LicenseCheckResult();
+        DependenciesSolver.executeProcess(new String[]{"/bin/sh", "-c", "licensecheck `find . -type f`"},
+                licenseResult);
+        for (Iterator i = licenseResult.getLicenses().iterator(); i.hasNext(); ) {
+            String license = (String) i.next();
+            boolean recognized = recognizeLicense(licenses, license, "");
+            if (!recognized) {
+                System.out.println("License " + license + " was not recognized, please enter a license name preferably in one of:");
+                printAvailableLicenses();
+                System.out.print("> ");
+                String s = readLine();
+                if (s.length() > 0) {
+                    licenses.add(s);
+                }
+            }
+        }
+
+        if (licenses.isEmpty()) {
+            System.out.println("License was not found, please enter a license name preferably in one of:");
+            printAvailableLicenses();
+            System.out.print("> ");
+            String s = readLine();
+            if (s.length() > 0) {
+                licenses.add(s);
+            }
+        }
+        return licenses;
+    }
+
+    private void printAvailableLicenses() {
+        System.out.println("Apache-2.0 Artistic BSD FreeBSD ISC CC-BY CC-BY-SA CC-BY-ND CC-BY-NC CC-BY-NC-SA");
+        System.out.println("CC-BY-NC-ND CC0 CDDL CPL Eiffel Expat GPL-2 GPL-3 LGPL-2 LGPL-2.1 LGPL-3");
+        System.out.println("GFDL-1.2 GFDL-1.3 GFDL-NIV LPPL MPL Perl PSF QPL W3C-Software ZLIB Zope");
+    }
+
+    boolean recognizeLicense(Set licenses, String licenseName, String licenseUrl) {
+        boolean recognized = false;
+        licenseName = licenseName.toLowerCase();
+        licenseUrl = licenseUrl.toLowerCase();
+        if (licenseName.indexOf("mit ") >= 0 || licenseUrl.indexOf("mit-license") >= 0) {
+            licenses.add("MIT");
+            recognized = true;
+        } else if (licenseName.indexOf("bsd ") >= 0 || licenseUrl.indexOf("bsd-license") >= 0) {
+            licenses.add("BSD");
+            recognized = true;
+        } else if (licenseName.indexOf("artistic ") >= 0 || licenseUrl.indexOf("artistic-license") >= 0) {
+            licenses.add("Artistic");
+            recognized = true;
+        } else if (licenseName.indexOf("apache ") >= 0 || licenseUrl.indexOf("apache") >= 0) {
+            if (licenseName.indexOf("2.") >= 0 || licenseUrl.indexOf("2.") >= 0) {
+                licenses.add("Apache-2.0");
+                recognized = true;
+            } else if (licenseName.indexOf("1.0") >= 0 || licenseUrl.indexOf("1.0") >= 0) {
+                licenses.add("Apache-1.0");
+                recognized = true;
+            } else if (licenseName.indexOf("1.1") >= 0 || licenseUrl.indexOf("1.1") >= 0) {
+                licenses.add("Apache-1.1");
+                recognized = true;
+            }
+        } else if (licenseName.indexOf("lgpl ") >= 0 || licenseUrl.indexOf("lgpl") >= 0) {
+            if (licenseName.indexOf("2.1") >= 0 || licenseUrl.indexOf("2.1") >= 0) {
+                licenses.add("LGPL-2.1");
+                recognized = true;
+            } else if (licenseName.indexOf("2") >= 0 || licenseUrl.indexOf("2") >= 0) {
+                licenses.add("LGPL-2");
+                recognized = true;
+            } else if (licenseName.indexOf("3") >= 0 || licenseUrl.indexOf("3") >= 0) {
+                licenses.add("LGPL-2");
+                recognized = true;
+            }
+        } else if (licenseName.indexOf("gpl ") >= 0 || licenseUrl.indexOf("gpl") >= 0) {
+            if (licenseName.indexOf("2") >= 0 || licenseUrl.indexOf("2") >= 0) {
+                licenses.add("GPL-2");
+                recognized = true;
+            } else if (licenseName.indexOf("3") >= 0 || licenseUrl.indexOf("3") >= 0) {
+                licenses.add("GPL-3");
+                recognized = true;
+            }
+        }
+        return recognized;
+    }
+
     private void generateFile(VelocityContext context, String templateName, File destDir, String fileName) throws Exception {
         destDir.mkdirs();
         FileWriter out = new FileWriter(new File(destDir, fileName));
@@ -575,6 +647,34 @@
         DependenciesSolver.executeProcess(new String[]{"chmod", "+x", file}, new DependenciesSolver.NoOutputHandler());
     }
 
+    static class LicenseCheckResult implements DependenciesSolver.OutputHandler {
+
+        private Set licenses = new TreeSet();
+        private Set copyrightOwners = new TreeSet();
+
+        public void newLine(String line) {
+            if (line.startsWith(".") && line.indexOf(":") > 0) {
+                int col = line.lastIndexOf(":");
+                String license = line.substring(col + 1).trim();
+                if (license.indexOf("UNKNOWN") >= 0) {
+                    return;
+                }
+                if (license.indexOf("*") >= 0) {
+                    license = license.substring(license.lastIndexOf("*") + 1).trim();
+                }
+                licenses.add(license);
+            }
+        }
+
+        public Set getLicenses() {
+            return licenses;
+        }
+
+        public Set getCopyrightOwners() {
+            return copyrightOwners;
+        }
+    }
+
     interface DownloadType {
 
         int UNKNOWN = 0;

Added: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build-classpath.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build-classpath.vm	                        (rev 0)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build-classpath.vm	2010-12-02 22:45:44 UTC (rev 13130)
@@ -0,0 +1,4 @@
+/usr/share/java/ant-nodeps.jar
+#foreach ($jar in $buildjars)
+/usr/share/java/${jar}.jar
+#end

Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build.properties.ant.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build.properties.ant.vm	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build.properties.ant.vm	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,8 @@
 build.directory=target
+#if($generateJavadoc)
 javadoc.dir=target/apidocs
+javadoc.generate=true
+#end
 #if(!$runTests)
 maven.test.skip=true
 #end

Added: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build.xml.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build.xml.vm	                        (rev 0)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/build.xml.vm	2010-12-02 22:45:44 UTC (rev 13130)
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+
+<project name="pkg-java" default="build-all" basedir="..">
+
+    <property file="debian/build.properties"/>
+    <property name="maven.build" value="/usr/share/maven-ant-helper/maven-build.xml"/>
+    <property file="/usr/share/maven-ant-helper/maven-defaults.properties"/>
+
+    <macrodef name="clean-module">
+        <attribute name="dir"/>
+        <sequential>
+          <ant target="clean" antfile="${maven.build}" dir="@{dir}">
+            <property name="debian.dir" location="debian" />
+            <property name="project.dir" value="@{dir}" />
+          </ant>
+        </sequential>
+    </macrodef>
+
+#if ($containsJars)
+    <macrodef name="package-module">
+        <attribute name="dir"/>
+        <sequential>
+          <ant target="package-and-local-install" antfile="${maven.build}" dir="@{dir}">
+            <property name="debian.dir" location="debian" />
+            <property name="project.dir" value="@{dir}" />
+            <property name="keep-cleaned-pom" value="true" />
+          </ant>
+        </sequential>
+    </macrodef>
+
+#end
+#if ($containsPlugins)
+    <macrodef name="package-plugin-module">
+        <attribute name="dir"/>
+        <sequential>
+          <ant target="package-and-local-install" antfile="${maven.build}" dir="@{dir}">
+            <property name="debian.dir" location="debian" />
+            <property name="project.dir" value="@{dir}" />
+            <property name="maven.generate.target" value="plugin:descriptor" />
+            <property name="keep-cleaned-pom" value="true" />
+            <property name="use-local-repo" value="true" />
+          </ant>
+        </sequential>
+    </macrodef>
+
+#end
+    <target name="clean">
+        <clean-module dir=""/>
+#foreach ($module in $collectedProjects)
+        <clean-module dir="${module.artifactId}"/>
+#end
+    </target>
+
+    <target name="package">
+        <package-module dir=""/>
+#foreach ($module in $collectedProjects)
+#if ($module.packaging == "maven-plugin")
+    <package-plugin-module dir="${module.artifactId}"/>
+#else
+        <package-module dir="${module.artifactId}"/>
+#end
+#end
+    </target>
+
+#if ($generateJavadoc)
+    <target name="javadoc">
+        <javadoc destdir="${javadoc.dir}">
+#foreach ($module in $collectedProjects)
+            <packageset dir="${module.artifactId}/src/main/java/"/>
+#end
+        </javadoc>
+    </target>
+
+    <target name="build-all" depends="package, javadoc" />
+#else
+    <target name="build-all" depends="package" />
+#end
+
+</project>
\ No newline at end of file

Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.ant.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.ant.vm	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.ant.vm	2010-12-02 22:45:44 UTC (rev 13130)
@@ -18,9 +18,10 @@
 Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: ${packager} <${packagerEmail}>
-Build-Depends: debhelper (>= 7), cdbs, default-jdk, ant-optional, maven-ant-helper (>> 6.7)
-Build-Depends-Indep: maven-repo-helper (>= 1.4),
-#printDependencies($compileDependencies)$space
+Build-Depends: debhelper (>= 7), default-jdk, maven-repo-helper (>= 1.4)#if ($project.packaging != "pom" || $project.modules.size() > 0), ant-optional, maven-ant-helper (>> 6.7)#end$space
+#if(!$compileDependencies.isEmpty())
+Build-Depends-Indep:#printDependencies($compileDependencies)$space
+#end
 Standards-Version: 3.9.1
 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/${package}
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/${package}
@@ -30,11 +31,13 @@
 Package: ${binPackage}
 Architecture: all
 ## libraries should not depend on runtime - default-jre-headless | java2-runtime-headless,
-Depends: ${dollar}{misc:Depends}, 
-#printDependencies($runtimeDependencies)
+Depends: ${dollar}{misc:Depends},#printDependencies($runtimeDependencies)$space
 #if(!$optionalDependencies.isEmpty())
 Recommends: #printDependencies($optionalDependencies)
 #end
+#if ($generateJavadoc)
+Suggests: ${binPackage}-doc
+#end
 Description: ${project.Name}
 #if ($description.isEmpty()) TODO - fill the description
 #else
@@ -51,8 +54,10 @@
 Package: ${binPackage}-doc
 Architecture: all
 Section: doc
-Depends: ${dollar}{misc:Depends}, ${dollar}{maven:DocDepends}
-Recommends: ${dollar}{maven:DocOptionalDepends}
+Depends: ${dollar}{misc:Depends}, $printDependencies($javadocDependencies)$space
+#if(!$javadocOptionalDependencies.isEmpty())
+Recommends: #printDependencies($javadocOptionalDependencies)
+#end
 Suggests: ${binPackage}
 Description: Documentation for ${project.Name}
 #if ($description.isEmpty()) TODO - fill the description

Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.vm	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/control.vm	2010-12-02 22:45:44 UTC (rev 13130)
@@ -19,7 +19,9 @@
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: ${packager} <${packagerEmail}>
 Build-Depends: debhelper (>= 7), cdbs, default-jdk, maven-debian-helper (>= 1.3)
+#if(!$compileDependencies.isEmpty())
 Build-Depends-Indep:#printDependencies($compileDependencies)$space
+#end
 Standards-Version: 3.9.1
 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/${package}
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/${package}
@@ -31,6 +33,9 @@
 ## libraries should not depend on runtime - default-jre-headless | java2-runtime-headless,
 Depends: ${dollar}{misc:Depends}, ${dollar}{maven:Depends}
 Recommends: ${dollar}{maven:OptionalDepends}
+#if ($generateJavadoc)
+Suggests: ${binPackage}-doc
+#end
 Description: ${project.Name}
 #if ($description.isEmpty()) TODO - fill the description
 #else

Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/copyright.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/copyright.vm	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/copyright.vm	2010-12-02 22:45:44 UTC (rev 13130)
@@ -2,24 +2,29 @@
 Format-Specification: http://dep.debian.net/deps/dep5/
 Name: ${project.Name}
 #set ($maintainerHeader = "Maintainer: ")
+#macro(printRoles $roles $defaultRole)
+#if ($roles.isEmpty())${defaultRole}
+#else
+#foreach ($role in $roles)
+${role}#if($velocityHasNext), #end
+#end
+#end
+#end
 #foreach ($developer in $project.Developers)
-${maintainerHeader} ${developer.Name} #if (${developer.Email})<${developer.Email}> as developer
-#set ($maintainerHeader = "           ")
-#else $space
+${maintainerHeader} ${developer.Name}#if (${developer.Email}) <${developer.Email}>#end as #printRoles($developer.Roles, "Developer")$space
+#set ($maintainerHeader = "            ")
 #end
-#end
 #foreach ($contributor in $project.Contributors)
-${maintainerHeader} ${contributor.Name} #if (${contributor.Email})<${contributor.Email}> as contributor
-#set ($maintainerHeader = "           ")
-#else $space
+${maintainerHeader} ${contributor.Name}#if (${contributor.Email}) <${contributor.Email}>#end as #printRoles($developer.Roles, "Contributor")$space
+#set ($maintainerHeader = "            ")
 #end
-#end
 Source: ${project.Url}
 
 Files: *
 Copyright: ${copyrightYear}, ${copyrightOwner}
 License: #foreach($license in $licenses)${license}#if($velocityHasNext) or #end#end
 
+
 Files: debian/*
 Copyright: ${currentYear}, ${packager} <${packagerEmail}>
 License: ${packagerLicense}
@@ -27,11 +32,12 @@
 
 #foreach ($license in $licenses)
 License: $license
+#set ($knownLicenses = ["Apache-2.0", "BSD", "GFDL-1.2", "GPL-2", "LGPL-2.1", "Artistic", "GPL-3", "LGPL-2", "LGPL-3"])
 #if ($knownLicenses.contains($license))
   On Debian GNU/Linux system you can find the complete text of the
   $license license in '/usr/share/common-licenses/$license'
 #else
-  TODO: include the full license text here
+  TODO: include the full text of the license here
 #end
 
 #end

Modified: trunk/maven-debian-helper/maven-packager-utils/src/main/resources/rules.ant.vm
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/main/resources/rules.ant.vm	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/resources/rules.ant.vm	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,40 +1,33 @@
 #!/usr/bin/make -f
 
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/ant.mk
-#set ($space=' ')
-#macro(printJars $jars)
-#set ($lineLength=0)
-#foreach ($jar in $jars)
-#if($lineLength==0)${space}#end${jar}#if($velocityHasNext)${space}#end
-#set ($lineLength = $lineLength + $jar.length() + 2)
-#if ($lineLength > 70)
-${space}\
-#set ($lineLength=0)
-#end
-#end
-#end
+DEB_SOURCE_PACKAGE   := $(shell dpkg-parsechangelog | grep '^Source:' | cut -f 2 -d ' ')
+DEB_UPSTREAM_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | cut -d: -f2- | sed 's/-[^-]*$$//')
 
-JAVA_HOME            := /usr/lib/jvm/default-java
-DEB_JARS             := ant-nodeps #if (!$buildJars.isEmpty()) #printJars($buildJars)#end $space
-DEB_ANT_BUILDFILE    := /usr/share/maven-ant-helper/maven-build.xml
-DEB_ANT_ARGS         := -Dbasedir=$(realpath .) -Dpackage=$(PACKAGE)
+#if ($project.packaging != "pom" || $project.modules.size() > 0)
+export JAVA_HOME=/usr/lib/jvm/default-java
+export CLASSPATH=$(shell for jar in `cat debian/build-classpath`; do if [ -f "$$jar" ]; then echo -n "$${jar}:"; fi; done)
+#if ($project.packaging == "pom" && $project.modules.size() > 0)
+export ANT_ARGS=-Dbasedir=$(realpath .) -Dpackage=$(DEB_SOURCE_PACKAGE) -f debian/build.xml
+#else
+export ANT_ARGS=-Dbasedir=$(realpath .) -Dpackage=$(DEB_SOURCE_PACKAGE) -f /usr/share/maven-ant-helper/maven-build.xml
+#end
 #if ($generateJavadoc)
 DEB_ANT_BUILD_TARGET := package javadoc
 API_DOCS             := target/docs/api
 #end
 
-get-orig-source:
-	uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename
+#end
+%:
+#if ($project.packaging == "pom" && $project.modules.size() == 0)
+	dh $@ --with maven_repo_helper
+#else
+	dh $@ --buildsystem=ant --with maven_repo_helper
+#end
 
-binary-post-install/$binPackage::
-	mh_install -p$binPackage
-
 #if ($generateJavadoc)
 binary-post-install/$binPackage-doc::
 	dh_install -p$binPackage-doc $(API_DOCS) usr/share/doc/$binPackage
 
 #end
-clean::
-	-mh_clean
-
+get-orig-source:
+	uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename

Modified: trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/DependenciesSolverTest.java
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/DependenciesSolverTest.java	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/DependenciesSolverTest.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,10 +1,21 @@
+package org.debian.maven.packager;
+
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright 2009 Ludovic Claude.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
-package org.debian.maven.packager;
-
 import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
@@ -26,10 +37,6 @@
 import org.debian.maven.repo.ListOfPOMs;
 import org.debian.maven.repo.Repository;
 
-/**
- *
- * @author ludo
- */
 public class DependenciesSolverTest extends TestCase {
 
     private File testDir = new File("tmp");
@@ -180,7 +187,7 @@
     }
 
     public void testSolveOpenMRSApiDependencies() throws Exception {
-        useFile("openmrs/pom.xml", pomFile);
+        useFile("openmrs/api/pom.xml", pomFile);
         DependenciesSolver solver = new DependenciesSolver();
         solver.setMavenRepo(getFileInClasspath("repository/root.dir").getParentFile());
         solver.setOutputDirectory(testDir);
@@ -202,15 +209,15 @@
         assertTrue("Did not expect any issues", solver.getIssues().isEmpty());
 
         solver.setBaseDir(testDir);
-        solver.setListOfPoms(new File(testDir, "openmrs.poms"));
+        solver.setListOfPoms(new File(testDir, "openmrs-api.poms"));
 
         solver.saveListOfPoms();
         solver.saveMavenRules();
         solver.saveSubstvars();
 
-        assertFileEquals("openmrs.poms", "openmrs.poms");
-        assertFileEquals("openmrs.substvars", "openmrs.substvars");
-        assertFileEquals("openmrs.rules", "maven.rules");
+        assertFileEquals("openmrs-api.poms", "openmrs-api.poms");
+        assertFileEquals("openmrs-api.substvars", "openmrs.substvars");
+        assertFileEquals("openmrs-api.rules", "maven.rules");
     }
 
     protected void assertFileEquals(String resource, String fileName) throws Exception {

Added: trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/GenerateDebianFilesMojoTest.java
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/GenerateDebianFilesMojoTest.java	                        (rev 0)
+++ trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/GenerateDebianFilesMojoTest.java	2010-12-02 22:45:44 UTC (rev 13130)
@@ -0,0 +1,30 @@
+package org.debian.maven.packager;
+
+import junit.framework.TestCase;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ludo
+ * Date: Nov 18, 2010
+ * Time: 11:56:33 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class GenerateDebianFilesMojoTest extends TestCase {
+
+    public void testRecognizeLicense() throws Exception {
+        GenerateDebianFilesMojo mojo = new GenerateDebianFilesMojo();
+
+        Set licenses = new HashSet();
+        assertTrue(mojo.recognizeLicense(licenses, "Apache (v2.0)", ""));
+        assertEquals("Apache-2.0", licenses.iterator().next());
+        licenses.clear();
+
+        assertTrue(mojo.recognizeLicense(licenses, "", "http://www.apache.org/licenses/LICENSE-2.0"));
+        assertEquals("Apache-2.0", licenses.iterator().next());
+        licenses.clear();
+                
+    }
+}

Modified: trunk/maven-debian-helper/maven-packager-utils/src/test/resources/libplexus-active-collections-java.substvars
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/test/resources/libplexus-active-collections-java.substvars	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/maven-packager-utils/src/test/resources/libplexus-active-collections-java.substvars	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,6 +1,6 @@
 #List of dependencies for libplexus-active-collections-java, generated for use by debian/control
 #Wed Jun 24 22:57:35 BST 2009
-maven.CompileDepends=libplexus-maven-plugin-java (>\= 1.3), libsurefire-java
+maven.CompileDepends=libplexus-maven-plugin-java (>\= 1.3.8), libsurefire-java
 maven.Depends=libplexus-component-api-java, libplexus-containers-java
 maven.OptionalDepends=
 maven.TestDepends=junit (>\= 3.8.1)

Added: trunk/maven-debian-helper/maven-packager-utils/src/test/resources/openmrs-api.rules
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/test/resources/openmrs-api.rules	                        (rev 0)
+++ trunk/maven-debian-helper/maven-packager-utils/src/test/resources/openmrs-api.rules	2010-12-02 22:45:44 UTC (rev 13130)
@@ -0,0 +1,2 @@
+
+junit junit jar s/4\..*/4.x/ * *

Added: trunk/maven-debian-helper/maven-packager-utils/src/test/resources/openmrs-api.substvars
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/src/test/resources/openmrs-api.substvars	                        (rev 0)
+++ trunk/maven-debian-helper/maven-packager-utils/src/test/resources/openmrs-api.substvars	2010-12-02 22:45:44 UTC (rev 13130)
@@ -0,0 +1,6 @@
+#List of dependencies for openmrs, generated for use by debian/control
+#Sun Oct 24 23:51:45 CEST 2010
+maven.CompileDepends=libmaven-javadoc-plugin-java
+maven.Depends=junit4
+maven.OptionalDepends=
+maven.TestDepends=
\ No newline at end of file

Modified: trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh
===================================================================
--- trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh	2010-12-02 22:33:25 UTC (rev 13129)
+++ trunk/maven-debian-helper/share/maven-debian-helper/copy-repo.sh	2010-12-02 22:45:44 UTC (rev 13130)
@@ -1,5 +1,19 @@
 #!/bin/sh
 
+# Copyright 2009 Torsten Werner.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 set -e
 
 SRC_REPO="/usr/share/maven-repo"




More information about the pkg-java-commits mailing list