commit 2caba3e6ac4a01185d6060a9bbda858fbbc7a4c7
Author: Stanislav Ochotnicky <sochotnicky(a)redhat.com>
Date: Tue May 10 13:40:59 2011 +0200
Improve and clean up depmap handling for m2/m3 repos
JavadirWorkspaceReader.java | 43 +++++++++++++++++++++++++------------------
maven.spec | 5 ++++-
2 files changed, 29 insertions(+), 19 deletions(-)
---
diff --git a/JavadirWorkspaceReader.java b/JavadirWorkspaceReader.java
index 0fe02b7..8efd7e0 100644
--- a/JavadirWorkspaceReader.java
+++ b/JavadirWorkspaceReader.java
@@ -39,7 +39,7 @@ public class JavadirWorkspaceReader
MavenJPackageDepmap.debug("Wanted GROUPID=" + groupId);
MavenJPackageDepmap.debug("Wanted ARTIFACTID=" + artifactId);
-
+
if (!groupId.startsWith("JPP")) {
MavenJPackageDepmap map = MavenJPackageDepmap.getInstance();
Hashtable<String,String> newInfo = map.getMappedInfo(groupId,
artifactId, version);
@@ -53,9 +53,13 @@ public class JavadirWorkspaceReader
if (artifact.getExtension().equals("pom")) {
path = getPOMPath(groupId, artifactId);
} else if (artifact.getExtension().equals("signature")) {
- path.append("/usr/share/maven/repository/");
+ path.append("/usr/share/maven/repository/");
path.append( groupId ).append( '/' );
path.append( artifactId ).append( ".signature" );
+ } else if (artifact.getExtension().equals("zip")) {
+ path.append("/usr/share/maven/repository/");
+ path.append( groupId ).append( '/' );
+ path.append( artifactId ).append( ".zip" );
} else {
path.append("/usr/share/maven/repository/");
path.append( groupId ).append( '/' );
@@ -70,7 +74,7 @@ public class JavadirWorkspaceReader
MavenJPackageDepmap.debug("Returning " + path.toString());
return ret;
} else {
- MavenJPackageDepmap.debug("Returning null for gid:aid" + groupId +
":" + artifactId);
+ MavenJPackageDepmap.debug("Returning null for gid:aid =>" +
groupId + ":" + artifactId);
return null;
}
}
@@ -83,22 +87,25 @@ public class JavadirWorkspaceReader
private StringBuffer getPOMPath(String groupId, String artifactId) {
- StringBuffer path = new StringBuffer();
String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-" +
artifactId + ".pom";
- path.append(System.getProperty("maven.local.pom.path",
"JPP/maven2/poms")).append("/").append(fName);
- java.io.File f;
-
- // NOTE: We are returning default_poms/ as the path for this pom
- // even though it may not exist there. This may cause an error,
- // but that is fine because if the pom is not there, there is
- // a serious problem anyways..
- f = new java.io.File(System.getProperty("maven.local.default.repo",
"/usr/share/maven2/repository") + "/" + path.toString());
- //System.err.println("Checking path " + f.getAbsolutePath() + "
for the pom");
- if (!f.exists()) {
- path = new StringBuffer();
- path.append(System.getProperty("maven.local.default.pom.path",
"JPP/maven2/default_poms")).append("/").append(fName);
+ 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);
+ if ( f.exists() ) {
+ return new StringBuffer(f.getPath());
}
- path.insert(0, "/usr/share/maven2/repository/");
- return path;
+
+ f = new File(System.getProperty("maven.local.default.repo",
"/usr/share/maven/repository") + "/" + m3path);
+ if ( f.exists() ) {
+ return new StringBuffer(f.getPath());
+ }
+
+ // final fallback to m2 default poms
+ return new StringBuffer("/usr/share/maven2/repository/" +
+ System.getProperty("maven.local.default.repo",
"JPP/maven2/default_poms") +
+ "/" + fName);
}
}
diff --git a/maven.spec b/maven.spec
index 20847c8..e0033a0 100644
--- a/maven.spec
+++ b/maven.spec
@@ -1,7 +1,7 @@
Name: maven
Version: 3.0.3
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Java project management and project comprehension tool
Group: Development/Tools
@@ -308,6 +308,9 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%changelog
+* Tue May 10 2011 Stanislav Ochotnicky <sochotnicky(a)redhat.com> - 3.0.3-3
+- Improve and clean up depmap handling for m2/m3 repos
+
* Mon Apr 18 2011 Stanislav Ochotnicky <sochotnicky(a)redhat.com> - 3.0.3-2
- Enable MAVEN_OPTS override in scripts
Show replies by date