From bcbafd2e7775172a94313210f124b483f0bde9f3 Mon Sep 17 00:00:00 2001
From: Paul Michael Bauer <paul.michael.bauer@gmail.com>
Date: Sat, 10 Sep 2011 18:56:20 -0700
Subject: [PATCH] Refactored script/run&repl, auto-generate script/maven-classpath, update
 to 1.3 beta 3

---
 pom.xml              |   38 +++++++++++++++++++++++++++-----------
 script/repl          |    7 ++-----
 script/run           |    5 ++---
 script/script_common |    6 ++++++
 4 files changed, 37 insertions(+), 19 deletions(-)
 create mode 100755 script/script_common

diff --git a/pom.xml b/pom.xml
index 8bafd97..9ed4e04 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,24 +20,40 @@
     <dependency>
       <groupId>org.clojure</groupId>
       <artifactId>clojure</artifactId>
-      <version>1.3.0-alpha8</version>
+      <version>1.3.0-beta3</version>
     </dependency>
   </dependencies>
 
   <build>
     <plugins>
       <plugin>
-	<groupId>com.theoryinpractise</groupId>
-	<artifactId>clojure-maven-plugin</artifactId>
-	<version>1.3.7</version>
-	<extensions>true</extensions>
-	<configuration>
-	  <warnOnReflection>${clojure.warnOnReflection}</warnOnReflection>
-	  <temporaryOutputDirectory>false</temporaryOutputDirectory>
-	</configuration>
-      </plugin>      
+        <groupId>com.theoryinpractise</groupId>
+        <artifactId>clojure-maven-plugin</artifactId>
+        <version>1.3.7</version>
+        <extensions>true</extensions>
+        <configuration>
+          <warnOnReflection>${clojure.warnOnReflection}</warnOnReflection>
+          <temporaryOutputDirectory>false</temporaryOutputDirectory>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.3</version>
+        <executions>
+          <execution>
+            <id>build-classpath</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>build-classpath</goal>
+            </goals>
+            <configuration>
+                <outputFile>${basedir}/script/maven-classpath</outputFile>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   
-
 </project>
diff --git a/script/repl b/script/repl
index 5542ada..26f1f34 100755
--- a/script/repl
+++ b/script/repl
@@ -1,6 +1,3 @@
 #!/bin/sh
-CLASSPATH=src/main/clojure:`cat script/maven-classpath`
-
-java -server -XX:+AggressiveOpts -cp $CLASSPATH clojure.main
-
-
+. $(dirname $0)/script_common
+${CMD_BASE} -r
diff --git a/script/run b/script/run
index 6afbe3a..c301e2e 100755
--- a/script/run
+++ b/script/run
@@ -1,4 +1,3 @@
 #!/bin/sh
-CLASSPATH='target/*':src/main/clojure:`cat script/maven-classpath`
-
-java -server -XX:+AggressiveOpts -cp $CLASSPATH clojure.main -m $@
+. $(dirname $0)/script_common
+${CMD_BASE} -m $@
diff --git a/script/script_common b/script/script_common
new file mode 100755
index 0000000..c3e01ae
--- /dev/null
+++ b/script/script_common
@@ -0,0 +1,6 @@
+#!/bin/sh
+BASE_DIR=$(dirname $0)/..
+TARGET_CLASSPATH=`ls -d ${BASE_DIR}/target/*class* | tr '\n' :`
+MAVEN_CLASSPATH=`cat ${BASE_DIR}/script/maven-classpath`
+CLASSPATH=${TARGET_CLASSPATH}${BASE_DIR}/src/main/clojure:${MAVEN_CLASSPATH}
+CMD_BASE="java -server -XX:+AggressiveOpts -cp ${CLASSPATH} clojure.main"
-- 
1.7.4.1

