Improve and clean up depmap handling for m2/m3 repos
This commit is contained in:
parent
abf9b4a49a
commit
2caba3e6ac
@ -39,7 +39,7 @@ public class JavadirWorkspaceReader
|
|||||||
|
|
||||||
MavenJPackageDepmap.debug("Wanted GROUPID=" + groupId);
|
MavenJPackageDepmap.debug("Wanted GROUPID=" + groupId);
|
||||||
MavenJPackageDepmap.debug("Wanted ARTIFACTID=" + artifactId);
|
MavenJPackageDepmap.debug("Wanted ARTIFACTID=" + artifactId);
|
||||||
|
|
||||||
if (!groupId.startsWith("JPP")) {
|
if (!groupId.startsWith("JPP")) {
|
||||||
MavenJPackageDepmap map = MavenJPackageDepmap.getInstance();
|
MavenJPackageDepmap map = MavenJPackageDepmap.getInstance();
|
||||||
Hashtable<String,String> newInfo = map.getMappedInfo(groupId, artifactId, version);
|
Hashtable<String,String> newInfo = map.getMappedInfo(groupId, artifactId, version);
|
||||||
@ -53,9 +53,13 @@ public class JavadirWorkspaceReader
|
|||||||
if (artifact.getExtension().equals("pom")) {
|
if (artifact.getExtension().equals("pom")) {
|
||||||
path = getPOMPath(groupId, artifactId);
|
path = getPOMPath(groupId, artifactId);
|
||||||
} else if (artifact.getExtension().equals("signature")) {
|
} else if (artifact.getExtension().equals("signature")) {
|
||||||
path.append("/usr/share/maven/repository/");
|
path.append("/usr/share/maven/repository/");
|
||||||
path.append( groupId ).append( '/' );
|
path.append( groupId ).append( '/' );
|
||||||
path.append( artifactId ).append( ".signature" );
|
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 {
|
} else {
|
||||||
path.append("/usr/share/maven/repository/");
|
path.append("/usr/share/maven/repository/");
|
||||||
path.append( groupId ).append( '/' );
|
path.append( groupId ).append( '/' );
|
||||||
@ -70,7 +74,7 @@ public class JavadirWorkspaceReader
|
|||||||
MavenJPackageDepmap.debug("Returning " + path.toString());
|
MavenJPackageDepmap.debug("Returning " + path.toString());
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
MavenJPackageDepmap.debug("Returning null for gid:aid" + groupId + ":" + artifactId);
|
MavenJPackageDepmap.debug("Returning null for gid:aid =>" + groupId + ":" + artifactId);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,22 +87,25 @@ public class JavadirWorkspaceReader
|
|||||||
|
|
||||||
private StringBuffer getPOMPath(String groupId, String artifactId) {
|
private StringBuffer getPOMPath(String groupId, String artifactId) {
|
||||||
|
|
||||||
StringBuffer path = new StringBuffer();
|
|
||||||
String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-" + artifactId + ".pom";
|
String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-" + artifactId + ".pom";
|
||||||
path.append(System.getProperty("maven.local.pom.path", "JPP/maven2/poms")).append("/").append(fName);
|
String m2path = System.getProperty("maven2.local.pom.path", "JPP/maven2/poms") + "/" + fName;
|
||||||
java.io.File f;
|
String m3path = System.getProperty("maven.local.pom.path", "JPP/maven/poms") + "/" + fName;
|
||||||
|
File f;
|
||||||
|
|
||||||
// NOTE: We are returning default_poms/ as the path for this pom
|
// let's try maven 2 repo first
|
||||||
// even though it may not exist there. This may cause an error,
|
f = new File(System.getProperty("maven2.local.default.repo", "/usr/share/maven2/repository") + "/" + m2path);
|
||||||
// but that is fine because if the pom is not there, there is
|
if ( f.exists() ) {
|
||||||
// a serious problem anyways..
|
return new StringBuffer(f.getPath());
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Name: maven
|
Name: maven
|
||||||
Version: 3.0.3
|
Version: 3.0.3
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: Java project management and project comprehension tool
|
Summary: Java project management and project comprehension tool
|
||||||
|
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
@ -308,6 +308,9 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue May 10 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-3
|
||||||
|
- Improve and clean up depmap handling for m2/m3 repos
|
||||||
|
|
||||||
* Mon Apr 18 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-2
|
* Mon Apr 18 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-2
|
||||||
- Enable MAVEN_OPTS override in scripts
|
- Enable MAVEN_OPTS override in scripts
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user