On 13/03/14 09:41, Rob Vesse wrote:
Andy
The problem is for me on OS X the current methodology is completely
broken, without my changes make_classpath_mvn generates the following:
Ack - we ned to find a portable way to have the dev system working. At
least it works albeit slowly.
/Users/rvesse/Documents/apache-jena/trunk/jena-arq//classes:/Users/rvesse/D
ocuments/apache-jena/trunk/jena-arq//../jena-core/classes:/Users/rvesse/.m2
/repository/src/main/java:/Users/rvesse/.m2/repository/src/main/resources:/
Users/rvesse/.m2/repository/src/test/java:/Users/rvesse/.m2/repository/src/
test/resources:/Users/rvesse/.m2/repository/org.eclipse.jdt.launching.JRE_C
ONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1
.6:/Users/rvesse/.m2/repository/org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER:
/Users/rvesse/.m2/repository/target/classes
Which doesn't even really contain valid locations for the Jena class files
let alone for any dependencies.
I appreciate point 1 that dependency:build-classpath is slow (what isn't
with maven?) The caching approach may be useful, I assume you write out
to a temporary file since you can't rely on exported variables persisting
since users are unlikely to source the scripts?
Re: point 2 what are the dash equivalents of what I've done then? I don't
know what the syntax differences between bash and dash are nor do I have
an ubuntu machine/VM to easily test on (well I could spin up an EC2 VM but
not knowing dash wouldn't help me that much)
It's srich posix - so either that or
#!/usr/bin/env bash
Andy
(offline (on a railway line) most of today)
Rob
On 12/03/2014 18:04, "Andy Seaborne" <[email protected]> wrote:
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?r
ev=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