[pkg-java] r12984 - in trunk/maven-debian-helper: . debian maven-build-nodocs maven-debian-helper maven-debian-plugin maven-packager-utils maven-packager-utils/src/main/java/org/debian/maven/packager maven-packager-utils/src/test/java/org/debian/maven/packager share/cdbs/1/class
Ludovic Claude
ludovicc-guest at alioth.debian.org
Thu Sep 16 22:14:30 UTC 2010
Author: ludovicc-guest
Date: 2010-09-16 22:14:29 +0000 (Thu, 16 Sep 2010)
New Revision: 12984
Modified:
trunk/maven-debian-helper/debian/changelog
trunk/maven-debian-helper/debian/control
trunk/maven-debian-helper/maven-build-nodocs/pom.xml
trunk/maven-debian-helper/maven-debian-helper/pom.xml
trunk/maven-debian-helper/maven-debian-plugin/pom.xml
trunk/maven-debian-helper/maven-packager-utils/pom.xml
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/test/java/org/debian/maven/packager/DependenciesSolverTest.java
trunk/maven-debian-helper/pom.xml
trunk/maven-debian-helper/share/cdbs/1/class/maven.mk
Log:
* debian/control: Update Standards-Version to 3.9.1, no changes
for the report (Closes: #591513)
* mh_make: assist with the rules to transform the versions
* mh_make: use existing package.poms files if any
* maven.mk: all rules in maven.ignoreRules are also used during the
clean phase, so there is no need to duplicate them in
maven.cleanIgnoreRules also.
Modified: trunk/maven-debian-helper/debian/changelog
===================================================================
--- trunk/maven-debian-helper/debian/changelog 2010-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/debian/changelog 2010-09-16 22:14:29 UTC (rev 12984)
@@ -1,13 +1,19 @@
-maven-debian-helper (1.1.1) UNRELEASED; urgency=low
+maven-debian-helper (1.2) unstable; urgency=low
[ Ludovic Claude ]
+ * debian/control: Update Standards-Version to 3.9.1, no changes
* mh_make: fix issue when no-parent option is needed. Thanks Torsten
- for the report
+ for the report (Closes: #591513)
+ * mh_make: assist with the rules to transform the versions
+ * mh_make: use existing package.poms files if any
+ * maven.mk: all rules in maven.ignoreRules are also used during the
+ clean phase, so there is no need to duplicate them in
+ maven.cleanIgnoreRules also.
[ Damien Raude-Morvan ]
* DependenciesSolver: Fix ClassCastException when using mh_make.
- -- Damien Raude-Morvan <drazzib at debian.org> Sun, 05 Sep 2010 18:05:27 +0200
+ -- Ludovic Claude <ludovic.claude at laposte.net> Thu, 16 Sep 2010 23:28:02 +0200
maven-debian-helper (1.1) unstable; urgency=low
Modified: trunk/maven-debian-helper/debian/control
===================================================================
--- trunk/maven-debian-helper/debian/control 2010-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/debian/control 2010-09-16 22:14:29 UTC (rev 12984)
@@ -5,17 +5,17 @@
Uploaders: Torsten Werner <twerner at debian.org>, Ludovic Claude <ludovic.claude at laposte.net>,
Michael Koch <konqueror at gmx.de>, Damien Raude-Morvan <drazzib at debian.org>
Build-Depends: cdbs, debhelper (>= 7), default-jdk, maven-ant-helper (>> 4), ant-optional, help2man
-Build-Depends-Indep: maven-repo-helper (>= 1.2),
+Build-Depends-Indep: maven-repo-helper (>= 1.3),
junit, testng, libmaven-plugin-tools-java, libplexus-velocity-java, velocity,
libmaven2-core-java
-Standards-Version: 3.9.0
+Standards-Version: 3.9.1
Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/maven-debian-helper
Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/maven-debian-helper/
Homepage: http://wiki.debian.org/Java/MavenBuilder
Package: maven-debian-helper
Architecture: all
-Depends: ${misc:Depends}, default-jdk, maven-repo-helper (>= 1.2), maven2 (>= 2.2.1-5),
+Depends: ${misc:Depends}, default-jdk, maven-repo-helper (>= 1.3), maven2 (>= 2.2.1-5),
libmaven-clean-plugin-java, libmaven-resources-plugin-java,
libmaven-compiler-plugin-java, libmaven-jar-plugin-java, libmaven-site-plugin-java,
libsurefire-java, velocity, libplexus-velocity-java
Modified: trunk/maven-debian-helper/maven-build-nodocs/pom.xml
===================================================================
--- trunk/maven-debian-helper/maven-build-nodocs/pom.xml 2010-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/maven-build-nodocs/pom.xml 2010-09-16 22:14:29 UTC (rev 12984)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.debian.maven</groupId>
<artifactId>maven-debian</artifactId>
- <version>1.1</version>
+ <version>1.2</version>
</parent>
<artifactId>maven-build-nodocs</artifactId>
Modified: trunk/maven-debian-helper/maven-debian-helper/pom.xml
===================================================================
--- trunk/maven-debian-helper/maven-debian-helper/pom.xml 2010-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/maven-debian-helper/pom.xml 2010-09-16 22:14:29 UTC (rev 12984)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.debian.maven</groupId>
<artifactId>maven-debian</artifactId>
- <version>1.1</version>
+ <version>1.2</version>
</parent>
<artifactId>maven-debian-helper</artifactId>
@@ -19,4 +19,4 @@
<version>1.1</version>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
Modified: trunk/maven-debian-helper/maven-debian-plugin/pom.xml
===================================================================
--- trunk/maven-debian-helper/maven-debian-plugin/pom.xml 2010-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/maven-debian-plugin/pom.xml 2010-09-16 22:14:29 UTC (rev 12984)
@@ -5,7 +5,7 @@
<parent>
<artifactId>maven-debian</artifactId>
<groupId>org.debian.maven</groupId>
- <version>1.1</version>
+ <version>1.2</version>
</parent>
<artifactId>maven-debian-plugin</artifactId>
@@ -16,7 +16,7 @@
<dependency>
<groupId>org.debian.maven</groupId>
<artifactId>maven-repo-helper</artifactId>
- <version>1.1</version>
+ <version>1.3</version>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
Modified: trunk/maven-debian-helper/maven-packager-utils/pom.xml
===================================================================
--- trunk/maven-debian-helper/maven-packager-utils/pom.xml 2010-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/maven-packager-utils/pom.xml 2010-09-16 22:14:29 UTC (rev 12984)
@@ -5,7 +5,7 @@
<parent>
<artifactId>maven-debian</artifactId>
<groupId>org.debian.maven</groupId>
- <version>1.1</version>
+ <version>1.2</version>
</parent>
<artifactId>maven-packager-utils</artifactId>
@@ -47,7 +47,7 @@
<dependency>
<groupId>org.debian.maven</groupId>
<artifactId>maven-repo-helper</artifactId>
- <version>1.2</version>
+ <version>1.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
@@ -56,4 +56,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
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-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesMojo.java 2010-09-16 22:14:29 UTC (rev 12984)
@@ -82,10 +82,10 @@
*/
protected File mavenRepo;
/**
- * Type of the package (e.g. 'maven' or 'ant')
- * @parameter expression="${nonInteractive}" default-value="false"
+ * Interactive execution will ask questions to the user
+ * @parameter expression="${interactive}" default-value="true"
*/
- protected boolean nonInteractive;
+ protected boolean interactive;
public void execute()
throws MojoExecutionException {
@@ -112,7 +112,7 @@
solver.setOutputDirectory(outputDirectory);
solver.setPackageName(packageName);
solver.setPackageType(packageType);
- solver.setNonInteractive(nonInteractive);
+ solver.setInteractive(interactive);
solver.setListOfPoms(listOfPoms);
solver.solveDependencies();
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-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java 2010-09-16 22:14:29 UTC (rev 12984)
@@ -25,6 +25,8 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.debian.maven.repo.*;
@@ -93,6 +95,7 @@
{"org.codehaus.mojo", "dashboard-maven-plugin"},
{"org.codehaus.mojo", "emma-maven-plugin"},
{"org.codehaus.mojo", "sonar-maven-plugin"},
+ {"org.codehaus.mojo", "surefire-report-maven-plugin"},
{"org.jboss.maven.plugins", "maven-jdocbook-plugin"},
};
private static final String[][] TEST_PLUGINS = {
@@ -113,6 +116,7 @@
{"org.apache.maven.wagon", "wagon-http-lightweight"},
{"org.apache.maven.wagon", "wagon-scm"},
{"org.apache.maven.wagon", "wagon-webdav"},
+ {"org.apache.maven.wagon", "wagon-webdav-jackrabbit"},
{"org.jvnet.wagon-svn", "wagon-svn"},
};
@@ -128,8 +132,8 @@
private List issues = new ArrayList();
private List projectPoms = new ArrayList();
private List toResolve = new ArrayList();
- private Set knownProjectDependencies = new HashSet();
- private Set ignoredDependencies = new HashSet();
+ private Set knownProjectDependencies = new TreeSet();
+ private Set ignoredDependencies = new TreeSet();
private Set compileDepends = new TreeSet();
private Set testDepends = new TreeSet();
private Set runtimeDepends = new TreeSet();
@@ -139,10 +143,13 @@
private boolean checkedAptFile;
private boolean runTests;
private boolean generateJavadoc;
- private boolean nonInteractive;
+ private boolean interactive = true;
private boolean askedToFilterModules = false;
private boolean filterModules = false;
private Map pomInfoCache = new HashMap();
+ // Keep the previous selected rule for a given version
+ private Map versionToRules = new HashMap();
+ private List defaultRules = new ArrayList();
public DependenciesSolver() {
pomTransformer.setVerbose(true);
@@ -150,6 +157,16 @@
pomTransformer.getIgnoreRules().setDescription(readResource("maven.ignoreRules.description"));
pomTransformer.getPublishedRules().setDescription(readResource("maven.publishedRules.description"));
cleanIgnoreRules.setDescription(readResource("maven.cleanIgnoreRules.description"));
+
+ Rule toDebianRule = new Rule("s/.*/debian/");
+ toDebianRule.setDescription("Change the version to the symbolic 'debian' version");
+ Rule keepVersionRule = new Rule("*");
+ keepVersionRule.setDescription("Keep the version");
+ Rule customRule = new Rule("CUSTOM");
+ customRule.setDescription("Custom rule");
+ defaultRules.add(toDebianRule);
+ defaultRules.add(keepVersionRule);
+ defaultRules.add(customRule);
}
private static String readResource(String resource) {
@@ -226,7 +243,7 @@
}
private boolean askIgnoreDependency(String sourcePomLoc, Dependency dependency, String message, boolean defaultToIgnore) {
- if (nonInteractive) {
+ if (!interactive) {
return false;
}
System.out.println();
@@ -246,8 +263,8 @@
}
}
- public void setNonInteractive(boolean nonInteractive) {
- this.nonInteractive = nonInteractive;
+ public void setInteractive(boolean interactive) {
+ this.interactive = interactive;
}
private class ToResolve {
@@ -417,17 +434,22 @@
}
if (exploreProjects) {
- File pom = new File(baseDir, "pom.xml");
- if (pom.exists()) {
- projects.add(pom);
- } else {
- pom = new File(baseDir, "debian/pom.xml");
+ File pom;
+ if (pomTransformer.getListOfPOMs().getPomOptions().isEmpty()) {
+ pom = new File(baseDir, "pom.xml");
if (pom.exists()) {
projects.add(pom);
} else {
- System.err.println("Cannot find the POM file");
- return;
+ pom = new File(baseDir, "debian/pom.xml");
+ if (pom.exists()) {
+ projects.add(pom);
+ } else {
+ System.err.println("Cannot find the POM file");
+ return;
+ }
}
+ } else {
+ pom = new File(baseDir, pomTransformer.getListOfPOMs().getFirstPOM());
}
resolveDependencies(pom);
} else {
@@ -450,6 +472,11 @@
}
private void resolveDependencies(File projectPom) {
+
+ if (getPOMOptions(projectPom) != null && getPOMOptions(projectPom).isIgnore()) {
+ return;
+ }
+
String pomRelPath = projectPom.getAbsolutePath().substring(baseDir.getAbsolutePath().length() + 1);
boolean noParent = false;
@@ -463,7 +490,7 @@
getRepository().registerPom(projectPom, pom);
} catch (DependencyNotFoundException e) {
System.out.println("Cannot find parent dependency " + e.getDependency());
- if (!nonInteractive) {
+ if (interactive) {
noParent = askIgnoreDependency(pomRelPath, pom.getParent(), "Ignore the parent POM for this POM?");
if (noParent) {
pom.setParent(null);
@@ -504,6 +531,83 @@
}
}
+ // Previous rule from another run
+ boolean explicitlyMentionedInRules = false;
+ for (Iterator i = pomTransformer.getRules().findMatchingRules(pom.getThisPom()).iterator();
+ i.hasNext(); ) {
+ DependencyRule previousRule = (DependencyRule) i.next();
+ if (!previousRule.equals(DependencyRule.TO_DEBIAN_VERSION_RULE) &&
+ !previousRule.equals(DependencyRule.TO_DEBIAN_VERSION_RULE) &&
+ previousRule.matches(pom.getThisPom())) {
+ explicitlyMentionedInRules = true;
+ break;
+ }
+ }
+
+ if (interactive && !explicitlyMentionedInRules) {
+ String version = pom.getThisPom().getVersion();
+ System.out.println("Version of " + pom.getThisPom().getGroupId() + ":"
+ + pom.getThisPom().getArtifactId() + " is " + version);
+ System.out.println("Choose how it will be transformed:");
+ List choices = new ArrayList();
+
+ if (versionToRules.containsKey(version)) {
+ choices.add(versionToRules.get(version));
+ }
+
+ Pattern p = Pattern.compile("(\\d+)(\\..*)");
+ Matcher matcher = p.matcher(version);
+ if (matcher.matches()) {
+ String mainVersion = matcher.group(1);
+ Rule mainVersionRule = new Rule("s/" + mainVersion + "\\../" +
+ mainVersion + ".x/");
+ mainVersionRule.setDescription("Replace all versions starting with "
+ + mainVersion + ". by " + mainVersion + ".x");
+ if (!choices.contains(mainVersionRule)) {
+ choices.add(mainVersionRule);
+ }
+ }
+ for (Iterator i = defaultRules.iterator(); i.hasNext(); ) {
+ Rule rule = (Rule) i.next();
+ if (!choices.contains(rule)) {
+ choices.add(rule);
+ }
+ }
+
+ int count = 1;
+ for (Iterator i = choices.iterator(); i.hasNext(); count++) {
+ Rule rule = (Rule) i.next();
+ if (count == 1) {
+ System.out.print("[1]");
+ } else {
+ System.out.print(" " + count + " ");
+ }
+ System.out.println(" - " + rule.getDescription());
+ }
+ System.out.print("> ");
+ String s = readLine().trim().toLowerCase();
+ int choice = 1;
+ try {
+ choice = Integer.parseInt(s);
+ } catch (Exception ignore) {
+ }
+
+ Rule selectedRule = (Rule) choices.get(choice - 1);
+ versionToRules.put(version, selectedRule);
+ if (selectedRule.getPattern().equals("CUSTOM")) {
+ System.out.println("Enter the pattern for your custom rule (in the form s/regex/replace/)");
+ System.out.print("> ");
+ s = readLine().trim().toLowerCase();
+ selectedRule = new Rule(s);
+ selectedRule.setDescription("My custom rule " + s);
+ defaultRules.add(selectedRule);
+ }
+
+ String dependencyRule = pom.getThisPom().getGroupId() + " " + pom.getThisPom().getArtifactId()
+ + " " + pom.getThisPom().getType() + " " + selectedRule.toString();
+ pomTransformer.getRules().add(new DependencyRule(dependencyRule));
+ }
+
if (pom.getParent() != null) {
POMInfo parentPom = getRepository().searchMatchingPOM(pom.getParent());
if (parentPom == null || parentPom.equals(getRepository().getSuperPOM())) {
@@ -527,7 +631,7 @@
resolveDependenciesLater(projectPom, POMInfo.EXTENSIONS, true, true, false);
if (exploreProjects && !pom.getModules().isEmpty()) {
- if (!nonInteractive && !askedToFilterModules) {
+ if (interactive && !askedToFilterModules) {
System.out.println("This project contains modules. Include all modules?");
System.out.print("[y]/n > ");
String s = readLine().trim().toLowerCase();
@@ -552,8 +656,7 @@
}
File tmpDest = File.createTempFile("pom", ".tmp");
tmpDest.deleteOnExit();
- String pomRelPath = projectPom.getAbsolutePath().substring(baseDir.getAbsolutePath().length() + 1);
- ListOfPOMs.POMOptions options = pomTransformer.getListOfPOMs().getPOMOptions(pomRelPath);
+ ListOfPOMs.POMOptions options = getPOMOptions(projectPom);
boolean noParent = false;
if (options != null) {
noParent = options.isNoParent();
@@ -563,6 +666,12 @@
return info;
}
+ private ListOfPOMs.POMOptions getPOMOptions(File pom) {
+ String pomRelPath = pom.getAbsolutePath().substring(baseDir.getAbsolutePath().length() + 1);
+ ListOfPOMs.POMOptions options = pomTransformer.getListOfPOMs().getPOMOptions(pomRelPath);
+ return options;
+ }
+
private void resetPOM(File projectPom) {
pomInfoCache.remove(projectPom.getAbsolutePath());
}
@@ -640,6 +749,7 @@
}
}
}
+
if (pom == null && "maven-plugin".equals(dependency.getType())) {
List matchingPoms = getRepository().searchMatchingPOMsIgnoreVersion(dependency);
if (matchingPoms.size() > 1) {
@@ -652,6 +762,7 @@
// automatically at build time
}
}
+
if (pom == null) {
if (!management) {
if ("maven-plugin".equals(dependency.getType()) && packageType.equals("ant")) {
@@ -727,6 +838,7 @@
}
}
}
+
String mavenRules = (String) pom.getProperties().get("debian.mavenRules");
if (mavenRules != null) {
StringTokenizer st = new StringTokenizer(mavenRules, ",");
@@ -913,7 +1025,7 @@
} else if (arg.equals("--generate-javadoc")) {
solver.setGenerateJavadoc(true);
} else if (arg.equals("--non-interactive")) {
- solver.setNonInteractive(true);
+ solver.setInteractive(false);
}
i = inc(i, args);
}
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-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/maven-packager-utils/src/test/java/org/debian/maven/packager/DependenciesSolverTest.java 2010-09-16 22:14:29 UTC (rev 12984)
@@ -62,7 +62,7 @@
solver.setPackageName("libplexus-active-collections-java");
solver.setPackageType("maven");
solver.setListOfPoms(new File(testDir, "libplexus-active-collections-java.poms"));
- solver.setNonInteractive(true);
+ solver.setInteractive(false);
solver.solveDependencies();
Modified: trunk/maven-debian-helper/pom.xml
===================================================================
--- trunk/maven-debian-helper/pom.xml 2010-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/pom.xml 2010-09-16 22:14:29 UTC (rev 12984)
@@ -4,7 +4,7 @@
<groupId>org.debian.maven</groupId>
<artifactId>maven-debian</artifactId>
- <version>1.1</version>
+ <version>1.2</version>
<packaging>pom</packaging>
<name>helper tools for using Maven to build Debian packages</name>
Modified: trunk/maven-debian-helper/share/cdbs/1/class/maven.mk
===================================================================
--- trunk/maven-debian-helper/share/cdbs/1/class/maven.mk 2010-09-16 22:05:49 UTC (rev 12983)
+++ trunk/maven-debian-helper/share/cdbs/1/class/maven.mk 2010-09-16 22:14:29 UTC (rev 12984)
@@ -94,7 +94,7 @@
before-mvn-build::
after-mvn-build::
-cleanbuilddir:: DEB_PATCHPOMS_ARGS += --clean-ignore-rules=debian/maven.cleanIgnoreRules
+cleanbuilddir:: DEB_PATCHPOMS_ARGS += --ignore-rules=debian/maven.ignoreRules --clean-ignore-rules=debian/maven.cleanIgnoreRules
cleanbuilddir:: maven-sanity-check post-patches debian/maven-repo
-$(DEB_MAVEN_INVOKE) $(DEB_MAVEN_CLEAN_TARGET)
$(RM) -r $(DEB_MAVEN_REPO) debian/stamp-maven-build
More information about the pkg-java-commits
mailing list