Added mvn-rpmbuild script to be used in spec files
- mvn-local is now mixed mode (online with javadir priority) - Changed mvn.jpp to mvn.local
This commit is contained in:
parent
19154e4096
commit
f5501c5008
@ -35,7 +35,7 @@ index cae3735..2d11d64 100644
|
||||
throws UnresolvableModelException
|
||||
{
|
||||
Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version );
|
||||
+ if ( System.getProperty("maven.jpp.mode") != null) {
|
||||
+ if ( System.getProperty("maven.local.mode") != null) {
|
||||
+ JavadirWorkspaceReader wReader = new JavadirWorkspaceReader();
|
||||
+ File pomFile = wReader.findArtifact(pomArtifact);
|
||||
+ // if pom file does not exist continue resolving using different
|
||||
@ -55,15 +55,15 @@ index 1f37d4f..d60dab8 100644
|
||||
throw new NullPointerException( "artifactId is null" );
|
||||
}
|
||||
- if ( version == null )
|
||||
+ // in jpp mode we ignore versions because these would only cause
|
||||
+ // in local mode we ignore versions because these would only cause
|
||||
+ // problems
|
||||
+ if ( version == null && System.getProperty("maven.jpp.mode") == null )
|
||||
+ if ( version == null && System.getProperty("maven.local.mode") == null )
|
||||
{
|
||||
throw new NullPointerException( "version is null" );
|
||||
}
|
||||
|
||||
- return groupId + ":" + artifactId + ":" + version;
|
||||
+ if( System.getProperty("maven.jpp.mode") == null ) {
|
||||
+ if( System.getProperty("maven.local.mode") == null ) {
|
||||
+ return groupId + ":" + artifactId + ":" + version;
|
||||
+ } else {
|
||||
+ return versionlessKey(groupId, artifactId);
|
||||
@ -88,7 +88,7 @@ index e892ee9..0222b01 100644
|
||||
}
|
||||
|
||||
+ // Set our own workspace reader to resolve from /usr/share/java
|
||||
+ if ( System.getProperty("maven.jpp.mode") != null)
|
||||
+ if ( System.getProperty("maven.local.mode") != null)
|
||||
+ {
|
||||
+ session.setWorkspaceReader(new JavadirWorkspaceReader());
|
||||
+ }
|
||||
@ -127,10 +127,10 @@ index 009635b..7d03748 100644
|
||||
}
|
||||
|
||||
- if ( !pluginArtifact.getBaseVersion().equals( pluginDescriptor.getVersion() ) )
|
||||
+ // ignore incorrect version in jpp mode (we can have different
|
||||
+ // ignore incorrect version in local mode (we can have different
|
||||
+ // versions in /usr/share/java
|
||||
+ if ( !pluginArtifact.getBaseVersion().equals( pluginDescriptor.getVersion() )
|
||||
+ && System.getProperty("maven.jpp.mode") == null)
|
||||
+ && System.getProperty("maven.local.mode") == null)
|
||||
{
|
||||
errors.add( "Plugin's descriptor contains the wrong version: " + pluginDescriptor.getVersion() );
|
||||
}
|
||||
@ -142,8 +142,8 @@ index fb074fb..bf2e703 100644
|
||||
throws PluginVersionResolutionException
|
||||
{
|
||||
logger.debug( "Resolving plugin version for " + request.getGroupId() + ":" + request.getArtifactId() );
|
||||
+ if (System.getProperty("maven.jpp.mode") != null) {
|
||||
+ // in jpp mode we always use "latest" as a resolved version
|
||||
+ if (System.getProperty("maven.local.mode") != null) {
|
||||
+ // in local mode we always use "latest" as a resolved version
|
||||
+ // (we ignore it anyway)
|
||||
+ DefaultPluginVersionResult result = new DefaultPluginVersionResult("latest");
|
||||
+ result.setRepository(request.getRepositorySession().getWorkspaceReader().getRepository());
|
||||
@ -170,7 +170,7 @@ index 403351a..2351620 100644
|
||||
if ( pomFile == null )
|
||||
{
|
||||
Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version );
|
||||
+ if ( System.getProperty("maven.jpp.mode") != null) {
|
||||
+ if ( System.getProperty("maven.local.mode") != null) {
|
||||
+ JavadirWorkspaceReader wReader = new JavadirWorkspaceReader();
|
||||
+ pomFile = wReader.findArtifact(pomArtifact);
|
||||
+ // if pom file does not exist continue resolving using different resolvers
|
||||
@ -193,7 +193,7 @@ index 066fbf3..a7cbf40 100644
|
||||
+ // Seems like plexus-container-default has some quirks that
|
||||
+ // cause it to lose version. Needs more looking into and fix it
|
||||
+ // properly
|
||||
+ if (dependency.getVersion() == null && System.getProperty("maven.jpp.mode") != null)
|
||||
+ if (dependency.getVersion() == null && System.getProperty("maven.local.mode") != null)
|
||||
+ {
|
||||
+ System.out.println("FIXING NULL VERSION:" + dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion());
|
||||
+ dependency.setVersion("1.0.0");
|
||||
@ -210,8 +210,8 @@ index 033211a..eec6caf 100644
|
||||
if ( !management )
|
||||
{
|
||||
- validateVersion( prefix + "version", problems, errOn30, d.getVersion(), d.getManagementKey(), d );
|
||||
+ // in jpp mode set version to "latest" and validate
|
||||
+ if(System.getProperty("maven.jpp.mode") != null && d.getVersion() == null)
|
||||
+ // in local mode set version to "latest" and validate
|
||||
+ if(System.getProperty("maven.local.mode") != null && d.getVersion() == null)
|
||||
+ d.setVersion("latest");
|
||||
+ else
|
||||
+ validateVersion( prefix + "version", problems, errOn30, d.getVersion(), d.getManagementKey(), d );
|
||||
@ -223,8 +223,8 @@ index 033211a..eec6caf 100644
|
||||
validateEffectiveDependency( problems, d, false, prefix, request );
|
||||
|
||||
- validateVersion( prefix + "version", problems, errOn30, d.getVersion(), d.getManagementKey(), d );
|
||||
+ // in jpp mode set version to "latest" and validate
|
||||
+ if(System.getProperty("maven.jpp.mode") != null && d.getVersion() == null)
|
||||
+ // in local mode set version to "latest" and validate
|
||||
+ if(System.getProperty("maven.local.mode") != null && d.getVersion() == null)
|
||||
+ d.setVersion("latest");
|
||||
+ else
|
||||
+ validateVersion( prefix + "version", problems, errOn30, d.getVersion(), d.getManagementKey(), d );
|
||||
@ -236,8 +236,8 @@ index 033211a..eec6caf 100644
|
||||
validateStringNotEmpty( prefix + "type", problems, Severity.ERROR, d.getType(), d.getManagementKey(), d );
|
||||
|
||||
- validateStringNotEmpty( prefix + "version", problems, Severity.ERROR, d.getVersion(), d.getManagementKey(),
|
||||
+ // in jpp mode ignore missing version completely
|
||||
+ if(System.getProperty("maven.jpp.mode") == null)
|
||||
+ // in local mode ignore missing version completely
|
||||
+ if(System.getProperty("maven.local.mode") == null)
|
||||
+ validateStringNotEmpty( prefix + "version", problems, Severity.ERROR, d.getVersion(), d.getManagementKey(),
|
||||
d );
|
||||
}
|
||||
|
@ -85,18 +85,18 @@ public class JavadirWorkspaceReader
|
||||
|
||||
StringBuffer path = new StringBuffer();
|
||||
String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-" + artifactId + ".pom";
|
||||
path.append(System.getProperty("maven.jpp.pom.path", "JPP/maven2/poms")).append("/").append(fName);
|
||||
path.append(System.getProperty("maven.local.pom.path", "JPP/maven2/poms")).append("/").append(fName);
|
||||
java.io.File f;
|
||||
|
||||
// NOTE: We are returning default_poms/ as the path for this pom
|
||||
// even though it may not exist there. This may cause an error,
|
||||
// but that is fine because if the pom is not there, there is
|
||||
// a serious problem anyways..
|
||||
f = new java.io.File(System.getProperty("maven.jpp.default.repo", "/usr/share/maven2/repository") + "/" + path.toString());
|
||||
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.jpp.default.pom.path", "JPP/maven2/default_poms")).append("/").append(fName);
|
||||
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;
|
||||
|
@ -51,7 +51,7 @@ public class MavenJPackageDepmap {
|
||||
Hashtable<String, String> jppDep;
|
||||
String idToCheck, jppCombination;
|
||||
|
||||
if (System.getProperty("maven.ignore.versions") == null && System.getProperty("maven.jpp.mode") == null) {
|
||||
if (System.getProperty("maven.ignore.versions") == null && System.getProperty("maven.local.mode") == null) {
|
||||
idToCheck = groupId+","+artifactId+","+version;
|
||||
} else {
|
||||
idToCheck = groupId+","+artifactId;
|
||||
@ -86,7 +86,7 @@ public class MavenJPackageDepmap {
|
||||
public boolean shouldEliminate(String groupId, String artifactId, String version) {
|
||||
String idToCheck;
|
||||
|
||||
if (System.getProperty("maven.ignore.versions") == null && System.getProperty("maven.jpp.mode") == null) {
|
||||
if (System.getProperty("maven.ignore.versions") == null && System.getProperty("maven.local.mode") == null) {
|
||||
idToCheck = groupId+","+artifactId+","+version;
|
||||
} else {
|
||||
idToCheck = groupId+","+artifactId;
|
||||
@ -98,7 +98,7 @@ public class MavenJPackageDepmap {
|
||||
|
||||
private static void buildJppArtifactMap() {
|
||||
|
||||
if (System.getProperty("maven.ignore.versions") != null || System.getProperty("maven.jpp.mode") != null) {
|
||||
if (System.getProperty("maven.ignore.versions") != null || System.getProperty("maven.local.mode") != null) {
|
||||
debug("Processing file: /usr/share/java-utils/xml/maven2-versionless-depmap.xml");
|
||||
processDepmapFile("/etc/maven/maven2-versionless-depmap.xml");
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class MavenJPackageDepmap {
|
||||
debug("Processing file: /usr/share/java-utils/xml/maven2-depmap.xml");
|
||||
processDepmapFile("/etc/maven/maven2-depmap.xml");
|
||||
|
||||
String customFileName = System.getProperty("maven.jpp.depmap.file", null);
|
||||
String customFileName = System.getProperty("maven.local.depmap.file", null);
|
||||
if (customFileName != null) {
|
||||
debug("Processing file: " + customFileName);
|
||||
processDepmapFile(customFileName);
|
||||
@ -158,7 +158,7 @@ public class MavenJPackageDepmap {
|
||||
|
||||
if (jppNodeList.getLength() == 1) {
|
||||
jppAD = getArtifactDefinition((Element) jppNodeList.item(0));
|
||||
if (System.getProperty("maven.ignore.versions") == null && System.getProperty("maven.jpp.mode") == null) {
|
||||
if (System.getProperty("maven.ignore.versions") == null && System.getProperty("maven.local.mode") == null) {
|
||||
debug("*** Adding: " + mavenAD.groupId + "," + mavenAD.artifactId + "," + mavenAD.version + " => "
|
||||
+ jppAD.groupId + "," + jppAD.artifactId + "," + jppAD.version + " to map...");
|
||||
|
||||
@ -207,7 +207,7 @@ public class MavenJPackageDepmap {
|
||||
|
||||
|
||||
public static void debug(String msg) {
|
||||
if (System.getProperty("maven.jpp.debug") != null)
|
||||
if (System.getProperty("maven.local.debug") != null)
|
||||
System.err.println(msg);
|
||||
}
|
||||
}
|
||||
|
@ -5,43 +5,12 @@ if [ -f /usr/share/java-utils/java-functions ] ; then
|
||||
set_javacmd
|
||||
fi
|
||||
|
||||
function install_metadata()
|
||||
{
|
||||
mkdir -p "$1"
|
||||
tar xf /usr/share/maven/repo-metadata.tar.xz -C "$1"
|
||||
}
|
||||
|
||||
|
||||
# add maven.repo.local if it's not defined already
|
||||
local_add="-Dmaven.repo.local=$(pwd)/.m2/"
|
||||
|
||||
function process_args()
|
||||
{
|
||||
while [ $# != 0 ]; do
|
||||
flag="$1"
|
||||
case "$flag" in
|
||||
*) ind=`expr match "$flag" -Dmaven.repo.local=`
|
||||
if [[ $ind != 0 ]];then
|
||||
install_metadata "${flag/-Dmaven.repo.local=/}/"
|
||||
local_add=""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
process_args "$@"
|
||||
|
||||
if [ -n "$local_add" ];then
|
||||
install_metadata "${local_add/-Dmaven.repo.local=/}/"
|
||||
fi
|
||||
|
||||
export M2_HOME=/usr/share/maven
|
||||
echo $JAVA_HOME
|
||||
export JAVA_HOME
|
||||
# can't put it on command line due to
|
||||
# http://jira.codehaus.org/browse/SUREFIRE-121
|
||||
export MAVEN_OPTS="-Dmaven.jpp.mode ${local_add}"
|
||||
export MAVEN_OPTS="-Dmaven.local.mode ${local_add}"
|
||||
echo "Running mvn in local mode. Please report bugs to http://bugzilla.redhat.com"
|
||||
|
||||
$M2_HOME/bin/mvn -o "$@"
|
||||
$M2_HOME/bin/mvn "$@"
|
||||
|
47
maven-script-rpmbuild
Normal file
47
maven-script-rpmbuild
Normal file
@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
if [ -f /usr/share/java-utils/java-functions ] ; then
|
||||
. /usr/share/java-utils/java-functions
|
||||
set_jvm
|
||||
set_javacmd
|
||||
fi
|
||||
|
||||
function install_metadata()
|
||||
{
|
||||
mkdir -p "$1"
|
||||
tar xf /usr/share/maven/repo-metadata.tar.xz -C "$1"
|
||||
}
|
||||
|
||||
|
||||
# add maven.repo.local if it's not defined already
|
||||
local_add="-Dmaven.repo.local=$(pwd)/.m2/"
|
||||
|
||||
function process_args()
|
||||
{
|
||||
while [ $# != 0 ]; do
|
||||
flag="$1"
|
||||
case "$flag" in
|
||||
*) ind=`expr match "$flag" -Dmaven.repo.local=`
|
||||
if [[ $ind != 0 ]];then
|
||||
install_metadata "${flag/-Dmaven.repo.local=/}/"
|
||||
local_add=""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
process_args "$@"
|
||||
|
||||
if [ -n "$local_add" ];then
|
||||
install_metadata "${local_add/-Dmaven.repo.local=/}/"
|
||||
fi
|
||||
|
||||
export M2_HOME=/usr/share/maven
|
||||
echo $JAVA_HOME
|
||||
export JAVA_HOME
|
||||
# can't put it on command line due to
|
||||
# http://jira.codehaus.org/browse/SUREFIRE-121
|
||||
export MAVEN_OPTS="-Dmaven.local.mode ${local_add}"
|
||||
|
||||
$M2_HOME/bin/mvn -o "$@"
|
10
maven.spec
10
maven.spec
@ -1,7 +1,7 @@
|
||||
|
||||
Name: maven
|
||||
Version: 3.0.2
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Java project management and project comprehension tool
|
||||
|
||||
Group: Development/Tools
|
||||
@ -17,6 +17,7 @@ Source101: MavenJPackageDepmap.java
|
||||
# 2xx for created non-buildable sources
|
||||
Source200: %{name}-script
|
||||
Source201: %{name}-script-local
|
||||
Source202: %{name}-script-rpmbuild
|
||||
|
||||
# Other included files
|
||||
Source250: repo-metadata.tar.xz
|
||||
@ -246,6 +247,7 @@ install -dm 755 $RPM_BUILD_ROOT%{_bindir}
|
||||
# Wrappers
|
||||
cp -af %{SOURCE200} $RPM_BUILD_ROOT%{_bindir}/mvn3
|
||||
cp -af %{SOURCE201} $RPM_BUILD_ROOT%{_bindir}/mvn-local
|
||||
cp -af %{SOURCE202} $RPM_BUILD_ROOT%{_bindir}/mvn-rpmbuild
|
||||
|
||||
###################
|
||||
# Individual jars #
|
||||
@ -286,6 +288,7 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
|
||||
%doc LICENSE.txt NOTICE.txt README.txt
|
||||
%attr(0755,root,root) %{_bindir}/mvn3
|
||||
%attr(0755,root,root) %{_bindir}/mvn-local
|
||||
%attr(0755,root,root) %{_bindir}/mvn-rpmbuild
|
||||
%dir %{_datadir}/%{name}
|
||||
%dir %{_datadir}/%{name}/bin
|
||||
%attr(0755,root,root) %{_datadir}/%{name}/bin/mvn
|
||||
@ -309,6 +312,11 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Feb 10 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.2-2
|
||||
- Added mvn-rpmbuild script to be used in spec files
|
||||
- mvn-local is now mixed mode (online with javadir priority)
|
||||
- Changed mvn.jpp to mvn.local
|
||||
|
||||
* Fri Jan 28 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.2-1
|
||||
- Update to latest version (3.0.2)
|
||||
- Ignore test failures temporarily
|
||||
|
Loading…
Reference in New Issue
Block a user