Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 48 lines (35 sloc) 1.1 KB
#! /bin/bash
PKG=apache-maven
VERSION=3.6.0
BUILD=0
# from https://maven.apache.org/download.cgi
URL=http://mirror.checkdomain.de/apache/maven/maven-3/$VERSION/source/apache-maven-$VERSION-src.tar.gz
SRC=$( echo $URL | rev | cut -d/ -f1 | rev )
PREFIX=/pkg/$PKG-$VERSION-$BUILD
set -xe
umask 022
# Note: setting HOME doesn't prevent maven from placing files in
# /scratch/local/build_home/.m2/repository
exec </dev/null
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/package/bin:/usr/local/bin
mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$PATH
EOF
. $PREFIX/profile
# this won't work, maven commits suicide by deleting $PREFIX after a 'failed' clean -- oops :)
# BUILDDIR=$PREFIX/build
# I'm curious what will happen when the prefix is set to /usr.
COOKIE=$(mcookie)
BUILDDIR=/scratch/local2/maven_build-$COOKIE
mkdir -p $BUILDDIR
cd $BUILDDIR
test -e $SRC || wget $URL
test -d $PKG-$VERSION || tar xf $SRC
cd $PKG-$VERSION
# dear maven, you can not delete $PREFIX ...
mvn -DdistributionTargetDir="$PREFIX/__tmp__" clean package
mv $PREFIX/__tmp__/* $PREFIX
rmdir $PREFIX/__tmp__
rm -r $BUILDDIR
exit