From 3b2966e851c33c587481ac7fd1a02493d77ded01 Mon Sep 17 00:00:00 2001 From: Stanislav Ochotnicky Date: Wed, 22 Jun 2011 11:56:09 +0200 Subject: [PATCH] Fix handling of fallback default_poms - Add empty-dep into maven package to not require maven2 version --- JavadirWorkspaceReader.java | 15 +++------------ MavenJPackageDepmap.java | 13 +++---------- maven-empty-dep.jar | Bin 0 -> 341 bytes maven-empty-dep.pom | 9 +++++++++ maven.spec | 18 +++++++++++++++++- 5 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 maven-empty-dep.jar create mode 100644 maven-empty-dep.pom diff --git a/JavadirWorkspaceReader.java b/JavadirWorkspaceReader.java index b84974b..9fe54f1 100644 --- a/JavadirWorkspaceReader.java +++ b/JavadirWorkspaceReader.java @@ -84,25 +84,18 @@ public class JavadirWorkspaceReader implements WorkspaceReader { } private StringBuffer getPOMPath(String groupId, String artifactId) { - String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-" + artifactId + ".pom"; - String m2path = System.getProperty("maven2.local.pom.path", - "JPP/maven2/poms") + "/" + fName; - String m3path = System.getProperty("maven.local.pom.path", - "JPP/maven/poms") + "/" + fName; File f; // let's try maven 2 repo first - f = new File(System.getProperty("maven2.local.default.repo", - "/usr/share/maven2/repository") + "/" + m2path); + f = new File("/usr/share/maven2/poms/" + fName); if (f.exists()) { return new StringBuffer(f.getPath()); } // now maven 3 specific repository - f = new File(System.getProperty("maven.local.default.repo", - "/usr/share/maven/repository") + "/" + m3path); + f = new File("/usr/share/maven/poms/" + fName); if (f.exists()) { return new StringBuffer(f.getPath()); } @@ -115,8 +108,6 @@ public class JavadirWorkspaceReader implements WorkspaceReader { } // final fallback to m2 default poms - return new StringBuffer("/usr/share/maven2/repository/" - + System.getProperty("maven.local.default.repo", - "JPP/maven2/default_poms") + "/" + fName); + return new StringBuffer("/usr/share/maven2/default_poms/" + fName); } } diff --git a/MavenJPackageDepmap.java b/MavenJPackageDepmap.java index 7fdc2ab..2567c0c 100644 --- a/MavenJPackageDepmap.java +++ b/MavenJPackageDepmap.java @@ -106,10 +106,6 @@ public class MavenJPackageDepmap { } jppCombination = (String) jppArtifactMap.get(idToCheck); - - // System.err.println("*** " + groupId+","+artifactId+","+version + - // " => " + jppCombination); - jppDep = new Hashtable(); if (jppCombination != null && jppCombination != "") { @@ -255,13 +251,10 @@ public class MavenJPackageDepmap { + jppAD.artifactId + "," + jppAD.version); } } else { - debug("Number of jpp sub-elements is not 1. Dropping dependency"); - debug("*** Adding: " + mavenAD.groupId + "," - + mavenAD.artifactId + "," + " => " - + "JPP/maven2,empty-dep," + mavenAD.version - + " to map..."); + debug("Number of jpp sub-elements is not 1. Dropping dependency for " + + mavenAD.groupId + ":" + mavenAD.artifactId); jppArtifactMap.put(mavenAD.groupId + "," + mavenAD.artifactId, - "JPP/maven2,empty-dep," + mavenAD.version); + "JPP/maven,empty-dep," + mavenAD.version); } } } diff --git a/maven-empty-dep.jar b/maven-empty-dep.jar new file mode 100644 index 0000000000000000000000000000000000000000..7762e6d86b9dd053611caa040f12290d687353dd GIT binary patch literal 341 zcmWIWW@Zs#-~htxB?YDoNPv@pg~8V~#8KDN&rSc|DFy~+h5&DN4v-2asImZ@nni#r z;F^6M{XE@VgG2Ou-9G!CIql=Et9OytTUYDcne&^246YbIcv__A<*VcAd$DvC3+Iei zl1HQ^v@5DxHWWD;RO^#ja- rAU~i2xT8QmLf49HEXW54U<+izwIcZ^z?+o~q>2d$Yk~A35QhN(F|kBp literal 0 HcmV?d00001 diff --git a/maven-empty-dep.pom b/maven-empty-dep.pom new file mode 100644 index 0000000..2648e50 --- /dev/null +++ b/maven-empty-dep.pom @@ -0,0 +1,9 @@ + + 4.0.0 + JPP/maven + empty-dep + 2.0.4 + Empty dependency + This is an empty dependency. For use in local mode when one or more dependencies need elimination. + diff --git a/maven.spec b/maven.spec index ebddb71..d76d204 100644 --- a/maven.spec +++ b/maven.spec @@ -1,7 +1,7 @@ Name: maven Version: 3.0.3 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Java project management and project comprehension tool Group: Development/Tools @@ -16,6 +16,10 @@ Source0: http://www.apache.org/dyn/closer.cgi/maven/source/apache-%{name} Source100: JavadirWorkspaceReader.java Source101: MavenJPackageDepmap.java +# empty files for resolving to nothing +Source104: %{name}-empty-dep.pom +Source105: %{name}-empty-dep.jar + # 2xx for created non-buildable sources Source200: %{name}-script Source201: %{name}-script-local @@ -57,6 +61,9 @@ BuildRequires: google-guice >= 3.0 BuildRequires: hamcrest BuildRequires: apache-commons-parent +# temporary for default poms resolving fix +BuildRequires: maven2 + Requires: java >= 1:1.6.0 Requires: plexus-classworlds >= 2.4 Requires: apache-commons-cli @@ -235,6 +242,11 @@ install -dm 755 $RPM_BUILD_ROOT%{_javadir}/%{name} #*##################### ln -s %{_datadir}/%{name}/poms $RPM_BUILD_ROOT%{_javadir}/%{name}/poms +# for our custom resolver to remove dependencies we need empty jar and +# pom file +install -m 644 %{SOURCE104} $RPM_BUILD_ROOT%{_datadir}/%{name}/poms/JPP.maven-empty-dep.pom +install -m 644 %{SOURCE105} $RPM_BUILD_ROOT%{_javadir}/%{name}/empty-dep.jar + ############ # /usr/bin # ############ @@ -308,6 +320,10 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name} %changelog +* Tue Jun 21 2011 Stanislav Ochotnicky - 3.0.3-6 +- Fix handling of fallback default_poms +- Add empty-dep into maven package to not require maven2 version + * Fri Jun 10 2011 Stanislav Ochotnicky - 3.0.3-5 - Process fragments directly instead of maven2-depmap.xml - Expect fragments in /usr/share/maven-fragments