You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by cameron fieber <ca...@fieber.ca> on 2004/05/06 19:51:42 UTC

patch for merlinx script to read maven properties

This patch modifies merlinx to read the maven properties files (project.properties, build.properties, $HOME/build.properties) to look for MAVEN_HOME_LOCAL and MAVEN_REPO_LOCAL in hopefully the same manner as maven, such that if you have overridden either maven.home.local or maven.repo.local in your maven environment it should find your local repository.

Sorry if my webmail client butchers the diff and sorry if my newbie shell scripting offends anyone that knows how to do it properly. :-)

Index: merlinx
===================================================================
RCS file: /home/cvspublic/avalon/merlin/cli/src/bin/merlinx,v
retrieving revision 1.1
diff -u -r1.1 merlinx
--- merlinx	18 Apr 2004 12:59:47 -0000	1.1
+++ merlinx	6 May 2004 17:44:02 -0000
@@ -8,6 +8,16 @@
 # respectively.
 #
 
+#usage VARIABLE=`find_maven_repo "property_file" "property_name" "default_value"`
+function find_property()
+{
+	VAL=${3}
+	if [ -f ${1} ] ; then
+		VAL=`cat ${1} | grep ^${2} | cut -d= -f2`
+	fi
+	echo ${VAL}
+}
+
 #
 # Compute the MERLIN_HOME if not already set.
 #
@@ -20,13 +30,20 @@
     export MERLIN_HOME="`dirname "$ABSOLUTE_PATH"`"
 fi
 
-# Checking for REPOSITORY
-if [ "$MAVEN_HOME_LOCAL" = "" ] ; then
-    REPOSITORY="$HOME/.maven/repository"
-else
-    REPOSITORY="$MAVEN_HOME_LOCAL/repository"
-fi
 
-export MERLIN_ARGS="$MERLIN_ARGS -system \"$REPOSITORY\" -repository \"$REPOSITORY\""
+MAVEN_HOME_LOCAL=${HOME}/.maven
+
+MAVEN_HOME_LOCAL=`find_property "project.properties" "maven.home.local" "${MAVEN_HOME_LOCAL}"`
+MAVEN_HOME_LOCAL=`find_property "build.properties" "maven.home.local" "${MAVEN_HOME_LOCAL}"`
+MAVEN_HOME_LOCAL=`find_property "${HOME}/build.properties" "maven.home.local" "${MAVEN_HOME_LOCAL}"`
+
+MAVEN_REPO_LOCAL=${MAVEN_HOME_LOCAL}/repository
+MAVEN_REPO_LOCAL=`find_property "project.properties" "maven.repo.local" "${MAVEN_REPO_LOCAL}"`
+MAVEN_REPO_LOCAL=`find_property "build.properties" "maven.repo.local" "${MAVEN_REPO_LOCAL}"`
+MAVEN_REPO_LOCAL=`find_property "${HOME}/build.properties" "maven.repo.local" "${MAVEN_REPO_LOCAL}"`
+
+echo "using MAVEN_REPO_LOCAL: ${MAVEN_REPO_LOCAL}"
+
+export MERLIN_ARGS="$MERLIN_ARGS -system \"${MAVEN_REPO_LOCAL}\" -repository \"${MAVEN_REPO_LOCAL}\""
 
 "$MERLIN_HOME/bin/merlin"  "$@"



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Re: patch for merlinx script to read maven properties

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Friday 07 May 2004 01:51, cameron fieber wrote:
> This patch modifies merlinx to read the maven properties files
> (project.properties, build.properties, $HOME/build.properties) to look for
> MAVEN_HOME_LOCAL and MAVEN_REPO_LOCAL in hopefully the same manner as
> maven, such that if you have overridden either maven.home.local or
> maven.repo.local in your maven environment it should find your local
> repository.

Patch applied and will make it for the Merlin 3.3 release...


Niclas
-- 
+---------//-------------------+
|   http://www.bali.ac         |
|  http://niclas.hedhman.org   |
+------//----------------------+

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org