Browse Source

devel/maven-wrapper: massively update port, align with devel/maven

- Submitter changes MAINTAINER to his @apache.org address
- Bump version to 2
- Use ETCDIR wherever possible
- Also install mvnDebug
- Burry long dead M2_HOME in favor of MAVEN_HOME which
  will *never* be propagated

PR: 265028, 265025
main
Michael Osipov 2 weeks ago committed by Kurt Jaeger
parent
commit
5f0ee47286
  1. 7
      UPDATING
  2. 21
      devel/maven-wrapper/files/mvn.sh.in
  3. 4
      devel/maven-wrapper/pkg-descr
  4. 3
      devel/maven-wrapper/pkg-plist
  5. 46
      devel/maven/files/mvn.sh.in

7
UPDATING

@ -18,6 +18,13 @@ you update your ports collection, before attempting any port upgrades.
# pkill stunnel;service stunnel start
after the upgrade has been completed.
202207XYZ:
AFFECTS: users of devel/maven-wrapper and devel/maven
AUTHOR: michaelo@apache.org
The environment variable M2_HOME has been replaced with more common
MAVEN_HOME which can be used to pass a custom Maven home directory.
20220628:
AFFECTS: users of Erlang and Elixir
AUTHOR: dch@FreeBSD.org

21
devel/maven-wrapper/files/mvn.sh.in

@ -2,26 +2,23 @@
set -e
if [ -f "%%PREFIX%%/etc/maven/setenv.sh" ] ; then
. "%%PREFIX%%/etc/maven/setenv.sh"
fi
SCRIPT_NAME="$(basename $0)"
if [ -z "${M2_HOME}" ] ; then
INSTANCES_DIRECTORY="/usr/local/etc/maven-wrapper/instances.d"
INSTANCE="`%%FIND%% -s "${INSTANCES_DIRECTORY}" -type f -mindepth 1 -maxdepth 1 | %%TAIL%% -n 1`"
if [ -z "${MAVEN_HOME}" ] ; then
INSTANCES_DIRECTORY="%%ETCDIR%%/instances.d"
INSTANCE="$(%%FIND%% -s "${INSTANCES_DIRECTORY}" -type f -mindepth 1 -maxdepth 1 | %%TAIL%% -n 1)"
if [ -z "${INSTANCE}" ] ; then
echo "could not find a Maven instance! (${INSTANCES_DIRECTORY})" >&2
echo "Could not find a Maven instance in ${INSTANCES_DIRECTORY}" >&2
exit 1
fi
M2_HOME="`%%CAT%% "${INSTANCE}"`"
MAVEN_HOME="$(%%CAT%% "${INSTANCE}")"
if [ ! -d "${M2_HOME}" ] ; then
echo "not a directory: ${M2_HOME}" >&2
if [ ! -d "${MAVEN_HOME}" ] ; then
echo "Not a directory: ${MAVEN_HOME}" >&2
exit 2
fi
fi
export M2_HOME
exec "${M2_HOME}/bin/mvn" "$@"
exec "${MAVEN_HOME}/bin/${SCRIPT_NAME}" "$@"

4
devel/maven-wrapper/pkg-descr

@ -1,7 +1,7 @@
The maven-wrapper provides a convenient way to switch between several Maven
installations.
- By setting the M2_HOME environment variable the user can select the Maven
- By setting the MAVEN_HOME environment variable the user can select the Maven
instance to use.
- A default Maven instance is selected according to the files in
/usr/local/etc/maven/instances.d/
/usr/local/etc/maven-wrapper/instances.d/

3
devel/maven-wrapper/pkg-plist

@ -1,2 +1,3 @@
bin/mvn
@dir etc/maven-wrapper/instances.d
bin/mvnDebug
@dir %%ETCDIR%%/instances.d

46
devel/maven/files/mvn.sh.in

@ -1,46 +0,0 @@
#!/bin/sh
#
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "${HOME}/.mavenrc" ] ; then
. "${HOME}/.mavenrc"
fi
M2_HOME=${M2_HOME:-"%%DATADIR%%"}
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir()
{
local basedir=$(pwd)
local wdir=$(pwd)
while [ "$wdir" != '/' ] ; do
wdir=$(cd "$wdir/.."; pwd)
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines()
{
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
exec "%%LOCALBASE%%/bin/java" $MAVEN_OPTS \
-classpath "${M2_HOME}/boot/%%CLASSWORLDS_JAR%%" \
"-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
"-Dmaven.home=${M2_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
org.codehaus.classworlds.Launcher "$@"
Loading…
Cancel
Save