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) {
|
private StringBuffer getPOMPath(String groupId, String artifactId) {
|
||||||
|
|
||||||
String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-"
|
String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-"
|
||||||
+ artifactId + ".pom";
|
+ 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;
|
File f;
|
||||||
|
|
||||||
// let's try maven 2 repo first
|
// let's try maven 2 repo first
|
||||||
f = new File(System.getProperty("maven2.local.default.repo",
|
f = new File("/usr/share/maven2/poms/" + fName);
|
||||||
"/usr/share/maven2/repository") + "/" + m2path);
|
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
return new StringBuffer(f.getPath());
|
return new StringBuffer(f.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
// now maven 3 specific repository
|
// now maven 3 specific repository
|
||||||
f = new File(System.getProperty("maven.local.default.repo",
|
f = new File("/usr/share/maven/poms/" + fName);
|
||||||
"/usr/share/maven/repository") + "/" + m3path);
|
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
return new StringBuffer(f.getPath());
|
return new StringBuffer(f.getPath());
|
||||||
}
|
}
|
||||||
@ -115,8 +108,6 @@ public class JavadirWorkspaceReader implements WorkspaceReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// final fallback to m2 default poms
|
// final fallback to m2 default poms
|
||||||
return new StringBuffer("/usr/share/maven2/repository/"
|
return new StringBuffer("/usr/share/maven2/default_poms/" + fName);
|
||||||
+ System.getProperty("maven.local.default.repo",
|
|
||||||
"JPP/maven2/default_poms") + "/" + fName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,6 @@ public class MavenJPackageDepmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jppCombination = (String) jppArtifactMap.get(idToCheck);
|
jppCombination = (String) jppArtifactMap.get(idToCheck);
|
||||||
|
|
||||||
// System.err.println("*** " + groupId+","+artifactId+","+version +
|
|
||||||
// " => " + jppCombination);
|
|
||||||
|
|
||||||
jppDep = new Hashtable<String, String>();
|
jppDep = new Hashtable<String, String>();
|
||||||
if (jppCombination != null && jppCombination != "") {
|
if (jppCombination != null && jppCombination != "") {
|
||||||
|
|
||||||
@ -255,13 +251,10 @@ public class MavenJPackageDepmap {
|
|||||||
+ jppAD.artifactId + "," + jppAD.version);
|
+ jppAD.artifactId + "," + jppAD.version);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug("Number of jpp sub-elements is not 1. Dropping dependency");
|
debug("Number of jpp sub-elements is not 1. Dropping dependency for "
|
||||||
debug("*** Adding: " + mavenAD.groupId + ","
|
+ mavenAD.groupId + ":" + mavenAD.artifactId);
|
||||||
+ mavenAD.artifactId + "," + " => "
|
|
||||||
+ "JPP/maven2,empty-dep," + mavenAD.version
|
|
||||||
+ " to map...");
|
|
||||||
jppArtifactMap.put(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
|
Name: maven
|
||||||
Version: 3.0.3
|
Version: 3.0.3
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
Summary: Java project management and project comprehension tool
|
Summary: Java project management and project comprehension tool
|
||||||
|
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
@ -16,6 +16,10 @@ Source0: http://www.apache.org/dyn/closer.cgi/maven/source/apache-%{name}
|
|||||||
Source100: JavadirWorkspaceReader.java
|
Source100: JavadirWorkspaceReader.java
|
||||||
Source101: MavenJPackageDepmap.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
|
# 2xx for created non-buildable sources
|
||||||
Source200: %{name}-script
|
Source200: %{name}-script
|
||||||
Source201: %{name}-script-local
|
Source201: %{name}-script-local
|
||||||
@ -57,6 +61,9 @@ BuildRequires: google-guice >= 3.0
|
|||||||
BuildRequires: hamcrest
|
BuildRequires: hamcrest
|
||||||
BuildRequires: apache-commons-parent
|
BuildRequires: apache-commons-parent
|
||||||
|
|
||||||
|
# temporary for default poms resolving fix
|
||||||
|
BuildRequires: maven2
|
||||||
|
|
||||||
Requires: java >= 1:1.6.0
|
Requires: java >= 1:1.6.0
|
||||||
Requires: plexus-classworlds >= 2.4
|
Requires: plexus-classworlds >= 2.4
|
||||||
Requires: apache-commons-cli
|
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
|
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 #
|
# /usr/bin #
|
||||||
############
|
############
|
||||||
@ -308,6 +320,10 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%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
|
* Fri Jun 10 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-5
|
||||||
- Process fragments directly instead of maven2-depmap.xml
|
- Process fragments directly instead of maven2-depmap.xml
|
||||||
- Expect fragments in /usr/share/maven-fragments
|
- Expect fragments in /usr/share/maven-fragments
|
||||||
|
Loading…
Reference in New Issue
Block a user