Merge pull request #5 from y-higuchi/RAMCloud-yoshi

Speedup ONOS startup
diff --git a/.gitignore b/.gitignore
index 7e971f7..9fbfd4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,9 @@
 .project
 .pydevproject
 .settings
+.javacp
 target
 onos-logs
 onos.log
 repo
-
+logback.*.xml
diff --git a/pom.xml b/pom.xml
index 55e6378..d1cdc6e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
   <artifactId>onos</artifactId>
   <version>0.1.0</version>
   <packaging>jar</packaging>
-  <name>ONOS-RAMLCloud</name>
+  <name>ONOS-RAMCloud</name>
   <url>http://onlab.us/</url>
   <repositories>
     <repository>
@@ -183,6 +183,25 @@
 	  </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>
+              <!-- configure the plugin here -->
+              <outputFile>${project.basedir}/.javacp</outputFile>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
     </plugins>
   </build>
   <!-- for getting visualization reporting   -->
@@ -294,11 +313,6 @@
       <version>3.0.2</version>
     </dependency>
     <dependency>
-      <groupId>com.hazelcast</groupId>
-      <artifactId>hazelcast</artifactId>
-      <version>3.0.2</version>
-    </dependency>
-    <dependency>
       <groupId>net.sf.json-lib</groupId>
       <artifactId>json-lib</artifactId>
       <version>2.4</version>
diff --git a/start-onos.sh b/start-onos.sh
index ffc66f8..d0c1a91 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -48,6 +48,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`
+
+
 #<logger name="net.floodlightcontroller.linkdiscovery.internal" level="TRACE"/>
 #<appender-ref ref="STDOUT" />
 
@@ -114,7 +120,8 @@
   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 &
+  #${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..d5d5da4 100755
--- a/titan/gremlin.sh
+++ b/titan/gremlin.sh
@@ -10,7 +10,11 @@
 #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 ${BASE_DIR}/../.javacp ]; then
+  echo "execute mvn compile at ONOS HOME directory."
+  exit 1
+fi
+CP=`cat ${BASE_DIR}/../.javacp`
 
 if [[ "$CP" == *"Error reading classpath file"* ]]; then
     echo $CP