I use the following bash function for selecting different maven versions:
usemvn ()
{
if [ -z "$1" -o ! -x "/opt/apache/apache-maven-$1/bin/mvn" ]; then
echo -n "Syntax: usemvn";
for i in /opt/apache/apache-maven-*;
do
if [ -x "$i/bin/mvn" ]; then
echo -n " $(basename $i | sed 's/^apache-maven-//') |";
fi;
done;
echo -e "\b ";
else
if [ -z "$MAVEN_HOME" ]; then
export PATH=/opt/apache/apache-maven-$1/bin:$PATH;
else
export PATH=$(echo $PATH|sed -e
"s:$MAVEN_HOME/bin:/opt/apache/apache-maven-$1/bin:g");
fi;
export MAVEN_HOME=/opt/apache/apache-maven-$1;
fi
}
It makes switching maven versions a lot easier. I use similar scripts
for java, ant and all the toolchains I use.
I don't know if that helps you at all though!
On 10 February 2011 10:39, Marc Rohlfs <[email protected]> wrote:
>
>
> On 09/02/11 16:16, Wayne Fay wrote:
>>>
>>> started working with an alias:
>>> > alias mvn='mvn -s .../settings.xml'
>>> > But this wouldn't work on Windows machines ...
>>
>> I've done something similar with "mvnclienta" and "mvnclientb". You
>> simply copy the mvn.bat file, rename it, and insert the "-s
>> .../settings-clienta.xml" into the call to mvn directly. This seems
>> like a reasonable approach to me on any OS.
>
> I'm starting the terminal with some additional, client-specific environment
> variables. This allows me to use different Maven, Java, etc. versions,
> depending on each client's specifications.
>
> With Your approach, I see 2 problems:
>
> 1. I wouldn't like to create new mvnclient* scripts on every version
> upgrade. And when I simply copy them from another Maven version, I'd first
> have to check if there aren't any changes in the original scripts.
>
> 2. Hudson offers automatic installation of Maven distributions. This is a
> very nice feature, because (especially in bigger organisations) admins often
> don't like to provide developers with access to the server hosts. But don't
> see a (reasonable) way the replicate the mvnclient* scripts in an
> automatically installed distribution.
>
> Marc
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]