Fix handling of fallback default_poms
- Add empty-dep into maven package to not require maven2 version
This commit is contained in:
parent
a170a2aaad
commit
3b2966e851
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -106,10 +106,6 @@ public class MavenJPackageDepmap {
|
||||
}
|
||||
|
||||
jppCombination = (String) jppArtifactMap.get(idToCheck);
|
||||
|
||||
// System.err.println("*** " + groupId+","+artifactId+","+version +
|
||||
// " => " + jppCombination);
|
||||
|
||||
jppDep = new Hashtable<String, String>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
maven-empty-dep.jar
Normal file
BIN
maven-empty-dep.jar
Normal file
Binary file not shown.
9
maven-empty-dep.pom
Normal file
9
maven-empty-dep.pom
Normal file
@ -0,0 +1,9 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>JPP/maven</groupId>
|
||||
<artifactId>empty-dep</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<name>Empty dependency</name>
|
||||
<description>This is an empty dependency. For use in local mode when one or more dependencies need elimination.</description>
|
||||
</project>
|
18
maven.spec
18
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 <sochotnicky@redhat.com> - 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 <sochotnicky@redhat.com> - 3.0.3-5
|
||||
- Process fragments directly instead of maven2-depmap.xml
|
||||
- Expect fragments in /usr/share/maven-fragments
|
||||
|
Loading…
Reference in New Issue
Block a user