Merge pull request #510 from y-higuchi/improve_startup
Avoid using maven when starting ONOS
diff --git a/.gitignore b/.gitignore
index 7e971f7..88f7bb1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,10 @@
.project
.pydevproject
.settings
+.javacp
target
onos-logs
onos.log
repo
+logback.*.xml
diff --git a/pom.xml b/pom.xml
index 0963968..f7bf388 100644
--- a/pom.xml
+++ b/pom.xml
@@ -183,6 +183,23 @@
</descriptorRefs>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>build-classpath</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <outputFile>${project.basedir}/.javacp</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<!-- for getting visualization reporting -->
diff --git a/start-onos-embedded.sh b/start-onos-embedded.sh
index 6fc9362..12346ba 100755
--- a/start-onos-embedded.sh
+++ b/start-onos-embedded.sh
@@ -36,6 +36,13 @@
if [ -z "${MVN}" ]; then
MVN="mvn"
fi
+
+if [ ! -f ${ONOS_HOME}/.javacp ]; then
+ ${MVN} -f ${ONOS_HOME}/pom.xml compile
+fi
+JAVA_CP=`cat ${ONOS_HOME}/.javacp`
+JAVA_CP="${JAVA_CP}:${ONOS_HOME}/target/classes"
+
#<logger name="net.floodlightcontroller.linkdiscovery.internal" level="TRACE"/>
#<appender-ref ref="STDOUT" />
@@ -96,8 +103,7 @@
# XXX MVN has to run at the project top dir..
cd ${ONOS_HOME}
- echo "${MVN} exec:exec -Dexec.executable=\"java\" -Dexec.args=\"${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos-embedded.properties\""
- ${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos-embedded.properties" > ${LOGDIR}/onos.stdout 2>${LOGDIR}/onos.stderr &
+ java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp ${JAVA_CP} ${MAIN_CLASS} -cf ${ONOS_HOME}/conf/onos-embedded.properties > ${LOGDIR}/onos.`hostname`.stdout 2>${LOGDIR}/onos.`hostname`stderr &
echo "Waiting for ONOS to start..."
COUNT=0
diff --git a/start-onos-jacoco.sh b/start-onos-jacoco.sh
index 2e04216..23c4bfa 100755
--- a/start-onos-jacoco.sh
+++ b/start-onos-jacoco.sh
@@ -43,6 +43,12 @@
MVN="mvn -o"
fi
+if [ ! -f ${ONOS_HOME}/.javacp ]; then
+ ${MVN} -f ${ONOS_HOME}/pom.xml compile
+fi
+JAVA_CP=`cat ${ONOS_HOME}/.javacp`
+JAVA_CP="${JAVA_CP}:${ONOS_HOME}/target/classes"
+
#<logger name="net.floodlightcontroller.linkdiscovery.internal" level="TRACE"/>
#<appender-ref ref="STDOUT" />
@@ -106,10 +112,7 @@
# XXX : MVN has to run at the project top dir
echo $ONOS_HOME
cd ${ONOS_HOME}
- pwd
- echo "${MVN} exec:exec -Dexec.executable=\"java\" -Dexec.args=\"${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ./conf/onos.properties\""
-
- ${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ./conf/onos.properties" > ${LOGDIR}/onos.`hostname`.stdout 2>${LOGDIR}/onos.`hostname`.stderr &
+ java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp ${JAVA_CP} ${MAIN_CLASS} -cf ./conf/onos.properties > ${LOGDIR}/onos.`hostname`.stdout 2>${LOGDIR}/onos.`hostname`.stderr &
echo "Waiting for ONOS to start..."
COUNT=0
diff --git a/start-onos.sh b/start-onos.sh
index a9d4d64..e10dfbe 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -41,6 +41,12 @@
MVN=${MVN:-mvn -o}
+if [ ! -f ${ONOS_HOME}/.javacp ]; then
+ ${MVN} -f ${ONOS_HOME}/pom.xml compile
+fi
+JAVA_CP=`cat ${ONOS_HOME}/.javacp`
+JAVA_CP="${JAVA_CP}:${ONOS_HOME}/target/classes"
+
#<logger name="net.floodlightcontroller.linkdiscovery.internal" level="TRACE"/>
#<appender-ref ref="STDOUT" />
@@ -105,9 +111,7 @@
echo $ONOS_HOME
cd ${ONOS_HOME}
pwd
- echo "${MVN} exec:exec -Dexec.executable=\"java\" -Dexec.args=\"${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_PROPS}\""
-
- ${MVN} exec:exec -Dexec.executable="java" -Dexec.args="${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp %classpath ${MAIN_CLASS} -cf ${ONOS_PROPS}" > ${LOGDIR}/onos.`hostname`.stdout 2>${LOGDIR}/onos.`hostname`.stderr &
+ java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -cp ${JAVA_CP} ${MAIN_CLASS} -cf ${ONOS_PROPS} > ${LOGDIR}/onos.`hostname`.stdout 2>${LOGDIR}/onos.`hostname`.stderr &
echo "Waiting for ONOS to start..."
COUNT=0
diff --git a/titan/gremlin.sh b/titan/gremlin.sh
index 55354e3..a340dd7 100755
--- a/titan/gremlin.sh
+++ b/titan/gremlin.sh
@@ -6,11 +6,14 @@
BASE_DIR=`dirname $0`
ONOS_DIR="`dirname $0`/.."
-#CP=$( echo `dirname $0`/../lib/*.jar `dirname $0`/../lib/titan/*.jar . | sed 's/ /:/g')
-#CP=`${MVN} -f ${ONOS_DIR}/pom.xml dependency:build-classpath -Dmdep.outputFile=/dev/stdout -l /dev/stderr`
# Use a python script to parse the classpath out of the .classpath file
-CP=`${BASE_DIR}/../scripts/parse-classpath.py`
+if [ ! -f ${ONOS_DIR}/.javacp ]; then
+ echo "execute mvn compile at ONOS HOME directory."
+ exit 1
+fi
+CP=`cat ${ONOS_DIR}/.javacp`
+CP="${CP}:${ONOS_DIR}/target/classes"
if [[ "$CP" == *"Error reading classpath file"* ]]; then
echo $CP