With this patch, the launcher shell script will set JAVA_HOME if no value is defined. The default value is the JDK that got chosen by the ports system at install time. We will be able to improve the script further when ports/96050 gets commited. To reduce the complexity of the launcher, it is now a plain new shell script, configured via SUB_FILES. While I was here, I also switched pkg-message to SUB_FILES (although its content could now be altered given ${JAVA_HOME} is not mandatory to run Maven anymore). PORTREVISION bumped. Added file(s): - files/maven.sh.in - files/pkg-message.in Removed file(s): - pkg-message - files/patch-maven-home Port maintainer (jbq@caraldi.com) is cc'd. Generated with FreeBSD Port Tools 0.75
State Changed From-To: open->feedback Awaiting maintainers feedback
Responsible Changed From-To: freebsd-ports-bugs->hq Submitter is commiter
State Changed From-To: feedback->open Maintainer approved.
State Changed From-To: open->feedback New patch for maintainer to review, based on our previous discussion. Now maven will only try to set a default value for JAVA_HOME and MAVEN_HOME when none is already set. This should allow more flexibility over the current version because a user may launch Maven with no particular environement variables set. Moreover, the user always has the ability to override both MAVEN_HOME and JAVA_HOME. I tweaked pkg-message to reflect the fact that setting JAVA_HOME is no longer mandatory to run Maven. Index: Makefile =================================================================== RCS file: /home/ncvs/ports/devel/maven/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- Makefile 4 Apr 2006 08:08:47 -0000 1.9 +++ Makefile 9 May 2006 21:33:01 -0000 @@ -7,6 +7,7 @@ PORTNAME= maven PORTVERSION= 1.0.2 +PORTREVISION= 1 CATEGORIES= devel java MASTER_SITES= ${MASTER_SITE_APACHE} MASTER_SITE_SUBDIR= ${PORTNAME}/binaries @@ -20,7 +21,7 @@ NO_BUILD= yes DATADIR= ${JAVASHAREDIR}/${PORTNAME} PKGMESSAGE= ${WRKDIR}/pkg-message -SUBSTITUTIONS= -e 's,%%DATADIR%%,${DATADIR},g' +SUBSTITUTIONS= -e 's,%%DATADIR%%,${DATADIR},g ; s,%%JAVA_HOME%%,${JAVA_HOME},g' REINPLACE_FILES= ${WRKSRC}/bin/maven post-configure: Index: pkg-message =================================================================== RCS file: /home/ncvs/ports/devel/maven/pkg-message,v retrieving revision 1.5 diff -u -r1.5 pkg-message --- pkg-message 4 Apr 2006 08:08:47 -0000 1.5 +++ pkg-message 9 May 2006 21:33:01 -0000 @@ -1,11 +1,8 @@ -To work with Maven you need to set the following environment variable: - * JAVA_HOME - Set it to the base directory of your java installation. - -Then, you should initialize your repository with: +You may initialize your repository with: %%DATADIR%%/bin/install_repo.sh ~/.maven/repository If you are behind a proxy, create a ~/.mavenrc file with something like: MAVEN_OPTS="$MAVEN_OPTS -Dmaven.proxy.host=YOUR_PROXY_HOSTNAME -Dmaven.proxy.port=YOUR_PROXY_PORT" + Index: files/patch-maven-home =================================================================== RCS file: /home/ncvs/ports/devel/maven/files/patch-maven-home,v retrieving revision 1.1 diff -u -r1.1 patch-maven-home --- files/patch-maven-home 4 Apr 2006 08:08:47 -0000 1.1 +++ files/patch-maven-home 9 May 2006 21:33:01 -0000 @@ -1,10 +1,15 @@ +$FreeBSD$ + +Sets default values for both JAVA_HOME and MAVEN_HOME + --- bin/maven.orig Tue Dec 7 12:13:46 2004 -+++ bin/maven Sat Apr 1 00:07:23 2006 -@@ -19,6 +19,7 @@ ++++ bin/maven Tue May 9 23:22:51 2006 +@@ -19,6 +19,8 @@ # reserved. FOREHEAD_VERSION=1.0-beta-5 -+MAVEN_HOME=%%DATADIR%% ++: ${MAVEN_HOME="%%DATADIR%%"} ++: ${JAVA_HOME="%%JAVA_HOME%%"} if [ -z "$MAVEN_OPTS" ] ; then MAVEN_OPTS="-Xmx256m"
The last 9 May patch appears to be mangled: patch: **** malformed patch at line 10: PORTNAME= maven Could you please resubmit? -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/
The patch looks good! However, I can't find the syntax ${parameter=word} in sh(1) man page. It works, but this is an undocumented use of variable substitution... Apparently the right syntax is ${parameter:=word} for assigning a default value. -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/
State Changed From-To: feedback->open Patch approved.
State Changed From-To: open->feedback I just produced a new patch with the following changes: - Use new features from javavmwrapper 2.2 to set a default value for JAVA_HOME - Set JAVACMD to the executable from javavmwrapper - Set a default value for MAVEN_HOME only when not already defined - Update pkg-message to reflect these changes Could you please review it? Index: Makefile =================================================================== RCS file: /home/ncvs/ports/devel/maven/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- Makefile 4 Apr 2006 08:08:47 -0000 1.9 +++ Makefile 19 Jun 2006 16:15:31 -0000 @@ -14,13 +14,18 @@ MAINTAINER= jbq@caraldi.com COMMENT= Java project management and project comprehension tool +RUN_DEPENDS= java:${PORTSDIR}/java/javavmwrapper + USE_BZIP2= yes USE_JAVA= yes JAVA_VERSION= 1.3+ NO_BUILD= yes DATADIR= ${JAVASHAREDIR}/${PORTNAME} PKGMESSAGE= ${WRKDIR}/pkg-message -SUBSTITUTIONS= -e 's,%%DATADIR%%,${DATADIR},g' +SUBSTITUTIONS= -e 's,%%DATADIR%%,${DATADIR},g' + -e 's,%%LOCALBASE%%,${LOCALBASE},g' + -e 's,%%GREP%%,${GREP},g' + -e 's,%%CUT%%,${CUT},g' REINPLACE_FILES= ${WRKSRC}/bin/maven post-configure: Index: pkg-message =================================================================== RCS file: /home/ncvs/ports/devel/maven/pkg-message,v retrieving revision 1.5 diff -u -r1.5 pkg-message --- pkg-message 4 Apr 2006 08:08:47 -0000 1.5 +++ pkg-message 19 Jun 2006 16:15:31 -0000 @@ -1,9 +1,5 @@ -To work with Maven you need to set the following environment variable: - * JAVA_HOME - Set it to the base directory of your java installation. - -Then, you should initialize your repository with: +You may initialize your repository with: %%DATADIR%%/bin/install_repo.sh ~/.maven/repository If you are behind a proxy, create a ~/.mavenrc file with something like: Index: files/patch-maven-home =================================================================== RCS file: /home/ncvs/ports/devel/maven/files/patch-maven-home,v retrieving revision 1.1 diff -u -r1.1 patch-maven-home --- files/patch-maven-home 4 Apr 2006 08:08:47 -0000 1.1 +++ files/patch-maven-home 19 Jun 2006 16:15:31 -0000 @@ -1,10 +1,26 @@ +$FreeBSD$ + +. Set default FreeBSD values for MAVEN_HOME, JAVA_HOME and JAVACMD +. Use 'exec' to launch the JVM + --- bin/maven.orig Tue Dec 7 12:13:46 2004 -+++ bin/maven Sat Apr 1 00:07:23 2006 -@@ -19,6 +19,7 @@ ++++ bin/maven Mon Jun 19 17:31:50 2006 +@@ -19,6 +19,9 @@ # reserved. FOREHEAD_VERSION=1.0-beta-5 -+MAVEN_HOME=%%DATADIR%% ++: ${MAVEN_HOME="%%DATADIR%%"} ++: ${JAVA_HOME="`JAVAVM_DRYRUN=yes %%LOCALBASE%%/bin/java | %%GREP%% '^JAVA_HOME' | %%CUT%% -c11-`"} ++: ${JAVACMD="%%LOCALBASE%%/bin/java"} if [ -z "$MAVEN_OPTS" ] ; then MAVEN_OPTS="-Xmx256m" +@@ -150,7 +153,7 @@ + MAVEN_OPTS="$MAVEN_OPTS -Dmaven.home.local=${MAVEN_HOME_LOCAL}" + fi + +-"$JAVACMD" ++exec "$JAVACMD" + $MAVEN_OPTS + -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl + -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
* Hervé Quiroz: > > - Use new features from javavmwrapper 2.3 to set a default value for JAVA_HOME > - Set JAVACMD to the executable from javavmwrapper > - Set a default value for MAVEN_HOME only when not already defined > - Update pkg-message to reflect these changes Thanks for your patch, see comments below. > +RUN_DEPENDS= java:${PORTSDIR}/java/javavmwrapper The JDK already has this dependency. Is it really needed? > : ${JAVA_HOME="`JAVAVM_DRYRUN=yes %%LOCALBASE%%/bin/java | %%GREP%% '^JAVA_HOME' | %%CUT%% -c11-`"} To be more generic I would rewrite this as: > : ${JAVA_HOME="`JAVAVM_DRYRUN=yes %%LOCALBASE%%/bin/java | %%GREP%% '^JAVA_HOME' | %%CUT%% -d= -f2`"} <note> I tried another option which does not correctly work because literal values are not escaped: (JAVAVM_DRYRUN=yes javavm ; echo 'echo $JAVA_HOME' )| sh </note> Also you don't need to set both JAVACMD and JAVA_HOME, only JAVACMD is needed. -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/
State Changed From-To: feedback->closed Patch commited with modifications suggested by the maintainer.