Add resolving from jnidir and java-jni

This commit is contained in:
Stanislav Ochotnicky 2011-07-04 14:25:05 +02:00
parent 2aea90da84
commit b755aadc15
2 changed files with 41 additions and 43 deletions

View File

@ -28,7 +28,7 @@ public class JavadirWorkspaceReader implements WorkspaceReader {
MavenJPackageDepmap.debug("=============JAVADIRREADER-FIND_ARTIFACT: " MavenJPackageDepmap.debug("=============JAVADIRREADER-FIND_ARTIFACT: "
+ artifact.getArtifactId()); + artifact.getArtifactId());
StringBuffer path = new StringBuffer(); StringBuffer path = new StringBuffer();
File ret = new File("");
String artifactId = artifact.getArtifactId(); String artifactId = artifact.getArtifactId();
String groupId = artifact.getGroupId(); String groupId = artifact.getGroupId();
String version = artifact.getVersion(); String version = artifact.getVersion();
@ -49,22 +49,24 @@ public class JavadirWorkspaceReader implements WorkspaceReader {
if (artifact.getExtension().equals("pom")) { if (artifact.getExtension().equals("pom")) {
path = getPOMPath(groupId, artifactId); path = getPOMPath(groupId, artifactId);
} else if (artifact.getExtension().equals("signature")) { ret = new File(path.toString());
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 { } else {
path.append("/usr/share/maven/repository/"); String repos[] = { "/usr/share/maven/repository/",
path.append(groupId).append('/'); "/usr/share/maven/repository-java-jni/",
path.append(artifactId).append(".jar"); "/usr/share/maven/repository-jni/" };
String relativeArtifactPath = groupId + "/" + artifactId + "."
+ artifact.getExtension();
for (String repo : repos) {
path = new StringBuffer(repo + relativeArtifactPath);
ret = new File(path.toString());
if (ret.isFile()) {
MavenJPackageDepmap.debug("Returning " + repo
+ relativeArtifactPath);
return ret;
}
}
} }
MavenJPackageDepmap.debug("Returning " + path.toString());
File ret = new File(path.toString());
// if file doesn't exist return null to delegate to other // if file doesn't exist return null to delegate to other
// resolvers (reactor/local repo) // resolvers (reactor/local repo)
if (ret.isFile()) { if (ret.isFile()) {
@ -87,24 +89,14 @@ public class JavadirWorkspaceReader implements WorkspaceReader {
String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-" String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-"
+ artifactId + ".pom"; + artifactId + ".pom";
File f; File f;
String[] pomRepos = { "/usr/share/maven2/poms/",
"/usr/share/maven/poms/", "/usr/share/maven-poms/" };
// let's try maven 2 repo first for (String pomRepo : pomRepos) {
f = new File("/usr/share/maven2/poms/" + fName); f = new File(pomRepo + fName);
if (f.exists()) { if (f.exists()) {
return new StringBuffer(f.getPath()); return new StringBuffer(f.getPath());
} }
// now maven 3 specific repository
f = new File("/usr/share/maven/poms/" + fName);
if (f.exists()) {
return new StringBuffer(f.getPath());
}
// now try new path in /usr. This will be the only check after all
// packages are rebuilt
f = new File("/usr/share/maven-poms/" + fName);
if (f.exists()) {
return new StringBuffer(f.getPath());
} }
// final fallback to m2 default poms // final fallback to m2 default poms

View File

@ -1,7 +1,7 @@
Name: maven Name: maven
Version: 3.0.3 Version: 3.0.3
Release: 8%{?dist} Release: 9%{?dist}
Summary: Java project management and project comprehension tool Summary: Java project management and project comprehension tool
Group: Development/Tools Group: Development/Tools
@ -93,10 +93,6 @@ Requires: hamcrest
Requires: apache-commons-parent Requires: apache-commons-parent
Requires(post): jpackage-utils
Requires(postun): jpackage-utils
%description %description
Maven is a software project management and comprehension tool. Based on the Maven is a software project management and comprehension tool. Based on the
concept of a project object model (POM), Maven can manage a project's build, concept of a project object model (POM), Maven can manage a project's build,
@ -234,6 +230,18 @@ install -dm 755 $RPM_BUILD_ROOT/%{_sysconfdir}/maven/fragments
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/repository install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/repository
ln -s %{_javadir} $RPM_BUILD_ROOT%{_datadir}/%{name}/repository/JPP ln -s %{_javadir} $RPM_BUILD_ROOT%{_datadir}/%{name}/repository/JPP
##############################
# /usr/share/java-jni repository #
##############################
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/repository-java-jni
ln -s %{_javajnidir} $RPM_BUILD_ROOT%{_datadir}/%{name}/repository-java-jni/JPP
##############################
# _libdir/java repository #
##############################
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/repository-jni
ln -s %{_jnidir} $RPM_BUILD_ROOT%{_datadir}/%{name}/repository-jni/JPP
################## ##################
# javadir/maven # # javadir/maven #
#*################ #*################
@ -286,13 +294,6 @@ install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name} cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%post
%update_maven_depmap
%postun
%update_maven_depmap
%files %files
%doc LICENSE.txt NOTICE.txt README.txt %doc LICENSE.txt NOTICE.txt README.txt
%attr(0755,root,root) %{_bindir}/mvn3 %attr(0755,root,root) %{_bindir}/mvn3
@ -310,6 +311,8 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%{_datadir}/%{name}/lib %{_datadir}/%{name}/lib
%{_datadir}/%{name}/poms %{_datadir}/%{name}/poms
%{_datadir}/%{name}/repository %{_datadir}/%{name}/repository
%{_datadir}/%{name}/repository-jni
%{_datadir}/%{name}/repository-java-jni
%config %{_mavendepmapfragdir}/%{name} %config %{_mavendepmapfragdir}/%{name}
%{_javadir}/%{name} %{_javadir}/%{name}
%{_datadir}/%{name}/repo-metadata.tar.xz %{_datadir}/%{name}/repo-metadata.tar.xz
@ -320,6 +323,9 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%changelog %changelog
* Mon Jul 4 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-9
- Add resolving from jnidir and java-jni
* Thu Jun 23 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-8 * Thu Jun 23 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-8
- Add maven-parent to BR/R - Add maven-parent to BR/R