Rob - two problems:
1/ There was reason behind the madness :-) dependency:build-classpath
is very slow.
Startup goes from under 1s to 7s on my machine for simple:
time bin/sparql --version
That's why there's the .classpath hack
Fuseki keeps a cache of the classpath calculated - maybe that will work
for both of us.
2/ /bin/sh does not have [[, pushd and other things
They are bashisms.
On Ubuntu sh is a strict Bourne shall (dash to be exact)
Andy
On 12/03/14 15:13, [email protected] wrote:
Author: rvesse
Date: Wed Mar 12 15:13:28 2014
New Revision: 1576775
URL: http://svn.apache.org/r1576775
Log:
Improve make_classpath_mvn to take advantage of mvn and the
dependency:build-classpath goal where possible instead of relying on the
.classpath file search approach which can fail horribly depending on what is in
the .classpath file (certainly it fails horribly on OS X)
Modified:
jena/trunk/jena-arq/bin/make_classpath_mvn
Modified: jena/trunk/jena-arq/bin/make_classpath_mvn
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-arq/bin/make_classpath_mvn?rev=1576775&r1=1576774&r2=1576775&view=diff
==============================================================================
--- jena/trunk/jena-arq/bin/make_classpath_mvn (original)
+++ jena/trunk/jena-arq/bin/make_classpath_mvn Wed Mar 12 15:13:28 2014
@@ -17,30 +17,39 @@
DIRROOT="$1"
-if [ "$DIRROOT" = "" ]
-then
+if [ "$DIRROOT" = "" ]; then
echo "No directory given" 1>&2
exit 1
- fi
-
-M2_REPO="${M2_REPO:-$HOME/.m2/repository}" ;
-X=$(perl -ne 'next unless /\spath="M2_REPO([^"]*)"/s ; print "$1","\n"'
$DIRROOT/.classpath)
+fi
SEP=':'
CP=${CP:-}
-for x in $X
-do
- [ "$CP" != "" ] && CP="${CP}${SEP}"
- CP="$CP$M2_REPO$x"
-done
+which mvn > /dev/null
+HAS_MAVEN=$?
+if [[ -e "$DIRROOT/pom.xml" && $HAS_MAVEN -eq 0 ]]; then
+ # Take advantage of maven dependency plugin
+ MVN_OUTPUT_PATTERN="(^\[INFO\])"
+ pushd $DIRROOT >/dev/null
+ MVN_CP=`mvn dependency:build-classpath | egrep -v ${MVN_OUTPUT_PATTERN}`
+ popd >/dev/null
+ CP="${CP}${SEP}${MVN_CP}"
+else
+ # Use the crude method
+ M2_REPO="${M2_REPO:-$HOME/.m2/repository/}" ;
+ X=$(perl -ne 'next unless /\spath="$M2_REPO([^"]*)"/s ; print "$1","\n"'
$DIRROOT/.classpath)
+
+ for x in $X
+ do
+ [ "$CP" != "" ] && CP="${CP}${SEP}"
+ CP="$CP$M2_REPO$x"
+ done
+fi
-if [ -e "$DIRROOT/classes" ]
-then
+if [ -e "$DIRROOT/classes" ]; then
CP="$DIRROOT/../jena-core/classes${SEP}$CP"
CP="$DIRROOT/classes${SEP}$CP"
-elif [ -e "$DIRROOT/target/classes" ]
-then
+elif [ -e "$DIRROOT/target/classes" ]; then
CP="$DIRROOT/target/classes{SEP}$CP"
fi