svn-gvsig-desktop / tags / v1_9_Build_1253 / build / maven / bin / mvn @ 47746
History | View | Annotate | Download (4.46 KB)
1 | 20506 | jcampos | #!/bin/sh |
---|---|---|---|
2 | # ---------------------------------------------------------------------------- |
||
3 | # Licensed to the Apache Software Foundation (ASF) under one |
||
4 | # or more contributor license agreements. See the NOTICE file |
||
5 | # distributed with this work for additional information |
||
6 | # regarding copyright ownership. The ASF licenses this file |
||
7 | # to you under the Apache License, Version 2.0 (the |
||
8 | # "License"); you may not use this file except in compliance |
||
9 | # with the License. You may obtain a copy of the License at |
||
10 | # |
||
11 | # http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | # |
||
13 | # Unless required by applicable law or agreed to in writing, |
||
14 | # software distributed under the License is distributed on an |
||
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||
16 | # KIND, either express or implied. See the License for the |
||
17 | # specific language governing permissions and limitations |
||
18 | # under the License. |
||
19 | # ---------------------------------------------------------------------------- |
||
20 | |||
21 | # ---------------------------------------------------------------------------- |
||
22 | # Maven2 Start Up Batch script |
||
23 | # |
||
24 | # Required ENV vars: |
||
25 | # ------------------ |
||
26 | # JAVA_HOME - location of a JDK home dir |
||
27 | # |
||
28 | # Optional ENV vars |
||
29 | # ----------------- |
||
30 | # M2_HOME - location of maven2's installed home dir |
||
31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven |
||
32 | # e.g. to debug Maven itself, use |
||
33 | # set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
||
34 | # ---------------------------------------------------------------------------- |
||
35 | |||
36 | QUOTED_ARGS="" |
||
37 | while [ "$1" != "" ] ; do |
||
38 | |||
39 | QUOTED_ARGS="$QUOTED_ARGS \"$1\"" |
||
40 | shift |
||
41 | |||
42 | done |
||
43 | |||
44 | if [ -f /etc/mavenrc ] ; then |
||
45 | . /etc/mavenrc |
||
46 | fi |
||
47 | |||
48 | if [ -f "$HOME/.mavenrc" ] ; then |
||
49 | . "$HOME/.mavenrc" |
||
50 | fi |
||
51 | |||
52 | # OS specific support. $var _must_ be set to either true or false. |
||
53 | cygwin=false; |
||
54 | darwin=false; |
||
55 | mingw=false |
||
56 | case "`uname`" in |
||
57 | CYGWIN*) cygwin=true ;; |
||
58 | MINGW*) mingw=true;; |
||
59 | Darwin*) darwin=true |
||
60 | if [ -z "$JAVA_VERSION" ] ; then |
||
61 | JAVA_VERSION="CurrentJDK" |
||
62 | else |
||
63 | echo "Using Java version: $JAVA_VERSION" |
||
64 | fi |
||
65 | if [ -z "$JAVA_HOME" ] ; then |
||
66 | JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home |
||
67 | fi |
||
68 | ;; |
||
69 | esac |
||
70 | |||
71 | if [ -z "$JAVA_HOME" ] ; then |
||
72 | if [ -r /etc/gentoo-release ] ; then |
||
73 | JAVA_HOME=`java-config --jre-home` |
||
74 | fi |
||
75 | fi |
||
76 | |||
77 | if [ -z "$M2_HOME" ] ; then |
||
78 | ## resolve links - $0 may be a link to maven's home |
||
79 | PRG="$0" |
||
80 | |||
81 | # need this for relative symlinks |
||
82 | while [ -h "$PRG" ] ; do |
||
83 | ls=`ls -ld "$PRG"` |
||
84 | link=`expr "$ls" : '.*-> \(.*\)$'` |
||
85 | if expr "$link" : '/.*' > /dev/null; then |
||
86 | PRG="$link" |
||
87 | else |
||
88 | PRG="`dirname "$PRG"`/$link" |
||
89 | fi |
||
90 | done |
||
91 | |||
92 | saveddir=`pwd` |
||
93 | |||
94 | M2_HOME=`dirname "$PRG"`/.. |
||
95 | |||
96 | # make it fully qualified |
||
97 | M2_HOME=`cd "$M2_HOME" && pwd` |
||
98 | |||
99 | cd "$saveddir" |
||
100 | # echo Using m2 at $M2_HOME |
||
101 | fi |
||
102 | |||
103 | # For Cygwin, ensure paths are in UNIX format before anything is touched |
||
104 | if $cygwin ; then |
||
105 | [ -n "$M2_HOME" ] && |
||
106 | M2_HOME=`cygpath --unix "$M2_HOME"` |
||
107 | [ -n "$JAVA_HOME" ] && |
||
108 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` |
||
109 | [ -n "$CLASSPATH" ] && |
||
110 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` |
||
111 | fi |
||
112 | |||
113 | # For Migwn, ensure paths are in UNIX format before anything is touched |
||
114 | if $mingw ; then |
||
115 | [ -n "$M2_HOME" ] && |
||
116 | M2_HOME="`(cd "$M2_HOME"; pwd)`" |
||
117 | [ -n "$JAVA_HOME" ] && |
||
118 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" |
||
119 | # TODO classpath? |
||
120 | fi |
||
121 | |||
122 | if [ -z "$JAVACMD" ] ; then |
||
123 | if [ -n "$JAVA_HOME" ] ; then |
||
124 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
||
125 | # IBM's JDK on AIX uses strange locations for the executables |
||
126 | JAVACMD="$JAVA_HOME/jre/sh/java" |
||
127 | else |
||
128 | JAVACMD="$JAVA_HOME/bin/java" |
||
129 | fi |
||
130 | else |
||
131 | JAVACMD="`which java`" |
||
132 | fi |
||
133 | fi |
||
134 | |||
135 | if [ ! -x "$JAVACMD" ] ; then |
||
136 | echo "Error: JAVA_HOME is not defined correctly." |
||
137 | echo " We cannot execute $JAVACMD" |
||
138 | exit 1 |
||
139 | fi |
||
140 | |||
141 | if [ -z "$JAVA_HOME" ] ; then |
||
142 | echo "Warning: JAVA_HOME environment variable is not set." |
||
143 | fi |
||
144 | |||
145 | CLASSWORLDS_LAUNCHER=org.codehaus.classworlds.Launcher |
||
146 | |||
147 | # For Cygwin, switch paths to Windows format before running java |
||
148 | if $cygwin; then |
||
149 | [ -n "$M2_HOME" ] && |
||
150 | M2_HOME=`cygpath --path --windows "$M2_HOME"` |
||
151 | [ -n "$JAVA_HOME" ] && |
||
152 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` |
||
153 | [ -n "$HOME" ] && |
||
154 | HOME=`cygpath --path --windows "$HOME"` |
||
155 | fi |
||
156 | |||
157 | exec "$JAVACMD" \ |
||
158 | $MAVEN_OPTS \ |
||
159 | -classpath "${M2_HOME}"/boot/classworlds-*.jar \ |
||
160 | "-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \ |
||
161 | "-Dmaven.home=${M2_HOME}" \ |
||
162 | ${CLASSWORLDS_LAUNCHER} $QUOTED_ARGS |