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: "
+ artifact.getArtifactId());
StringBuffer path = new StringBuffer();
File ret = new File("");
String artifactId = artifact.getArtifactId();
String groupId = artifact.getGroupId();
String version = artifact.getVersion();
@ -49,22 +49,24 @@ public class JavadirWorkspaceReader implements WorkspaceReader {
if (artifact.getExtension().equals("pom")) {
path = getPOMPath(groupId, artifactId);
} else if (artifact.getExtension().equals("signature")) {
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");
ret = new File(path.toString());
} else {
path.append("/usr/share/maven/repository/");
path.append(groupId).append('/');
path.append(artifactId).append(".jar");
String repos[] = { "/usr/share/maven/repository/",
"/usr/share/maven/repository-java-jni/",
"/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
// resolvers (reactor/local repo)
if (ret.isFile()) {
@ -87,24 +89,14 @@ public class JavadirWorkspaceReader implements WorkspaceReader {
String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-"
+ artifactId + ".pom";
File f;
String[] pomRepos = { "/usr/share/maven2/poms/",
"/usr/share/maven/poms/", "/usr/share/maven-poms/" };
// let's try maven 2 repo first
f = new File("/usr/share/maven2/poms/" + fName);
for (String pomRepo : pomRepos) {
f = new File(pomRepo + fName);
if (f.exists()) {
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

View File

@ -1,7 +1,7 @@
Name: maven
Version: 3.0.3
Release: 8%{?dist}
Release: 9%{?dist}
Summary: Java project management and project comprehension tool
Group: Development/Tools
@ -93,10 +93,6 @@ Requires: hamcrest
Requires: apache-commons-parent
Requires(post): jpackage-utils
Requires(postun): jpackage-utils
%description
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,
@ -234,6 +230,18 @@ install -dm 755 $RPM_BUILD_ROOT/%{_sysconfdir}/maven/fragments
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/repository
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 #
#*################
@ -286,13 +294,6 @@ install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%post
%update_maven_depmap
%postun
%update_maven_depmap
%files
%doc LICENSE.txt NOTICE.txt README.txt
%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}/poms
%{_datadir}/%{name}/repository
%{_datadir}/%{name}/repository-jni
%{_datadir}/%{name}/repository-java-jni
%config %{_mavendepmapfragdir}/%{name}
%{_javadir}/%{name}
%{_datadir}/%{name}/repo-metadata.tar.xz
@ -320,6 +323,9 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%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
- Add maven-parent to BR/R