[clojure-maven-plugin] 02/03: New upstream version 1.7.1
Elana Hashman
ehashman-guest at moszumanska.debian.org
Sun Jan 14 04:08:18 UTC 2018
This is an automated email from the git hooks/post-receive script.
ehashman-guest pushed a commit to branch ehashman-rebuild
in repository clojure-maven-plugin.
commit c94387068bbc4a39c7c423606b3936e6a8f14819
Author: Elana Hashman <ehashman at debian.org>
Date: Sat Jan 13 23:06:51 2018 -0500
New upstream version 1.7.1
---
.gitignore | 17 +
README.markdown | 595 +++++++++++++++++++++
epl-v10.html | 261 +++++++++
pom.xml | 289 ++++++++++
src/it/autodoc-1.1.0/goals.txt | 2 +
src/it/autodoc-1.1.0/pom.xml | 66 +++
src/it/autodoc-1.1.0/src/main/clojure/autodoc.clj | 6 +
src/it/autodoc-1.1.0/verify.bsh | 6 +
src/it/autodoc-1.2.0-nonstandard-paths/goals.txt | 2 +
src/it/autodoc-1.2.0-nonstandard-paths/pom.xml | 64 +++
.../src/autodoc.clj | 6 +
src/it/autodoc-1.2.0-nonstandard-paths/verify.bsh | 4 +
src/it/autodoc-1.2.0/goals.txt | 2 +
src/it/autodoc-1.2.0/pom.xml | 60 +++
src/it/autodoc-1.2.0/src/main/clojure/autodoc.clj | 6 +
src/it/autodoc-1.2.0/verify.bsh | 6 +
src/it/basic-usage-test-13/goals.txt | 2 +
src/it/basic-usage-test-13/pom.xml | 68 +++
.../src/main/clojure/packaging.clj | 5 +
src/it/basic-usage-test-13/verify.bsh | 17 +
src/it/basic-usage-test/goals.txt | 2 +
src/it/basic-usage-test/pom.xml | 52 ++
.../src/main/clojure/packaging.clj | 5 +
src/it/basic-usage-test/verify.bsh | 17 +
src/it/marginalia-multidoc/goals.txt | 2 +
src/it/marginalia-multidoc/pom.xml | 73 +++
.../src/main/clojure/autodoc.clj | 6 +
src/it/marginalia-multidoc/verify.bsh | 6 +
src/it/marginalia/goals.txt | 2 +
src/it/marginalia/pom.xml | 70 +++
src/it/marginalia/src/main/clojure/autodoc.clj | 6 +
src/it/marginalia/verify.bsh | 6 +
src/it/multimoduletest/goals.txt | 2 +
src/it/multimoduletest/multimodule/pom.xml | 39 ++
.../multimodule/src/main/clojure/packaging.clj | 5 +
.../multimodule/src/test/clojure/runtest.clj | 1 +
src/it/multimoduletest/pom.xml | 15 +
src/it/multimoduletest/verify.bsh | 37 ++
src/it/packaging-test-1.1.0/goals.txt | 2 +
src/it/packaging-test-1.1.0/pom.xml | 47 ++
.../src/main/clojure/packaging.clj | 5 +
src/it/packaging-test-1.1.0/verify.bsh | 17 +
src/it/packaging-test-1.4.0/goals.txt | 2 +
src/it/packaging-test-1.4.0/pom.xml | 47 ++
.../src/main/clojure/packaging.clj | 5 +
src/it/packaging-test-1.4.0/verify.bsh | 17 +
src/it/packaging-test-1.5.0/goals.txt | 2 +
src/it/packaging-test-1.5.0/pom.xml | 47 ++
.../src/main/clojure/packaging.clj | 5 +
src/it/packaging-test-1.5.0/verify.bsh | 17 +
src/it/packaging-test-1.7.0/goals.txt | 2 +
src/it/packaging-test-1.7.0/pom.xml | 47 ++
.../src/main/clojure/packaging.clj | 5 +
.../src/main/clojure/packagingc.cljc | 5 +
src/it/packaging-test-1.7.0/verify.bsh | 25 +
src/it/packaging-test/goals.txt | 2 +
src/it/packaging-test/pom.xml | 47 ++
.../packaging-test/src/main/clojure/packaging.clj | 5 +
src/it/packaging-test/verify.bsh | 17 +
src/it/runwithplugindeps/goals.txt | 2 +
src/it/runwithplugindeps/pom.xml | 47 ++
.../runwithplugindeps/src/main/clojure/runme.clj | 7 +
src/it/selectivenamespacecompilation/goals.txt | 2 +
src/it/selectivenamespacecompilation/pom.xml | 53 ++
.../src/main/clojure/otherpackage.clj | 5 +
.../src/main/clojure/packaging.clj | 5 +
src/it/selectivenamespacecompilation/verify.bsh | 21 +
src/it/settings.xml | 35 ++
src/it/temporaryoutputpath/goals.txt | 2 +
src/it/temporaryoutputpath/pom.xml | 50 ++
.../src/main/clojure/packaging.clj | 5 +
src/it/temporaryoutputpath/verify.bsh | 16 +
src/it/test-resources/goals.txt | 1 +
src/it/test-resources/pom.xml | 81 +++
.../src/main/clojure/h908714124/somens.clj | 6 +
.../src/main/resources/main/build-info.properties | 4 +
.../src/test/java/h908714124/ResourceTest.java | 30 ++
.../src/test/resources/test/build-info.properties | 4 +
src/it/test-resources/verify.bsh | 4 +
src/it/test-with-junit-1.3/goals.txt | 3 +
src/it/test-with-junit-1.3/pom.xml | 50 ++
.../src/test/clojure/succeeding.clj | 8 +
src/it/test-with-junit-1.3/verify.bsh | 35 ++
src/it/test-with-junit-failure-1.3/goals.txt | 3 +
.../test-with-junit-failure-1.3/invoker.properties | 2 +
src/it/test-with-junit-failure-1.3/pom.xml | 51 ++
.../src/test/clojure/failing.clj | 8 +
.../src/test/clojure/passing.clj | 8 +
src/it/test-with-junit-failure-1.3/verify.bsh | 51 ++
src/it/test-with-junit-failure/goals.txt | 3 +
src/it/test-with-junit-failure/invoker.properties | 2 +
src/it/test-with-junit-failure/pom.xml | 50 ++
.../src/test/clojure/failing.clj | 8 +
.../src/test/clojure/passing.clj | 8 +
src/it/test-with-junit-failure/verify.bsh | 51 ++
src/it/test-with-junit/goals.txt | 3 +
src/it/test-with-junit/pom.xml | 50 ++
.../src/test/clojure/succeeding.clj | 8 +
src/it/test-with-junit/verify.bsh | 35 ++
.../clojure/AbstractClojureCompilerMojo.java | 525 ++++++++++++++++++
.../clojure/ClojureAddSourceMojo.java | 20 +
.../clojure/ClojureAddTestSourceMojo.java | 20 +
.../clojure/ClojureAutodocMojo.java | 106 ++++
.../clojure/ClojureCompilerMojo.java | 48 ++
.../clojure/ClojureGenDocMojo.java | 83 +++
.../clojure/ClojureMarginaliaMojo.java | 209 ++++++++
.../theoryinpractise/clojure/ClojureNReplMojo.java | 76 +++
.../clojure/ClojureNailgunMojo.java | 51 ++
.../theoryinpractise/clojure/ClojureReplMojo.java | 97 ++++
.../theoryinpractise/clojure/ClojureRunMojo.java | 138 +++++
.../clojure/ClojureRunTestMojo.java | 37 ++
.../clojure/ClojureRunTestWithJUnitMojo.java | 164 ++++++
.../theoryinpractise/clojure/ClojureSwankMojo.java | 84 +++
.../theoryinpractise/clojure/ExecutionMode.java | 6 +
.../clojure/NamespaceDiscovery.java | 184 +++++++
.../theoryinpractise/clojure/NamespaceInFile.java | 61 +++
.../clojure/TestClojureCompilerMojo.java | 54 ++
src/main/resources/META-INF/plexus/components.xml | 72 +++
src/main/resources/default_test_script.clj | 80 +++
.../clojure/ClojureReplMojoTest.java | 31 ++
.../clojure/NamespaceDiscoveryTest.java | 105 ++++
src/test/resources/charset.clj | 5 +
src/test/resources/nsmeta.clj | 2 +
src/test/resources/test/#test4.clj | 3 +
src/test/resources/test/test3.clj | 3 +
src/test/resources/test1.clj | 5 +
src/test/resources/test2.clj | 7 +
127 files changed, 5291 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2e24314
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+.*
+*~
+.DS_Store
+target
+clojure-maven-plugin.iml
+clojure-maven-plugin.ipr
+clojure-maven-plugin.iws
+src/it/basic-usage-test/build.log
+src/it/packaging-test/build.log
+src/it/temporaryoutputpath/build.log
+src/it/selectivenamespacecompilation/build.log
\ No newline at end of file
diff --git a/README.markdown b/README.markdown
new file mode 100644
index 0000000..cc0fc91
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,595 @@
+Welcome to the clojure-maven-plugin plugin for Apache Maven 2.
+
+This plugin has been designed to make working with clojure as easy as possible, when working in a
+mixed language, enterprise project.
+
+## Available goals
+
+ * clojure:add-source
+ * clojure:add-test-source
+ * clojure:compile
+ * clojure:test
+ * clojure:test-with-junit
+ * clojure:run
+ * clojure:repl
+ * clojure:nrepl
+ * clojure:swank
+ * clojure:nailgun
+ * clojure:gendoc
+ * clojure:autodoc
+ * clojure:marginalia
+
+## Getting started with Clojure and Maven
+
+To use this plugin and start working with clojure, start with a blank maven project and declare the plugin and
+add a dependency on clojure:
+
+ <packaging>clojure</packaging>
+ ....
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>1.3.23</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+ ....
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.6.0</version>
+ </dependency>
+ </dependencies>
+
+By changing your projects <packaging> type to clojure, the plugin will automatically bind itself to the compile,
+test-compile, and test maven phases.
+
+Without any additional configuration, the clojure-maven-plugin will compile any namespaces
+in ./src/main/clojure/*.clj (or .cljc) and ./src/test/clojure/*.clj (or .cljc).
+
+### Adding additional source directories
+
+To change, or add additional source directories you can add the following configuration:
+
+ <configuration>
+ <sourceDirectories>
+ <sourceDirectory>src/main/clojure</sourceDirectory>
+ </sourceDirectories>
+ <testSourceDirectories>
+ <testSourceDirectory>src/test/clojure</testSourceDirectory>
+ </testSourceDirectories>
+ </configuration>
+
+NOTE: The plugin will prepend the project's ${basedir} before each source/testSource directory specified.
+
+### Temporary Compile Paths
+
+If you wish to take advantage of the compilers syntax checking, but wish to prevent any AOT classes from
+appearing in the maven generated JAR file, you can tell the plugin to compile to a temporary directory:
+
+ <configuration>
+ <temporaryOutputDirectory>true</temporaryOutputDirectory>
+ </configuration>
+
+### Namespace configuration
+
+If you wish to limit or filter out namespaces during your compile/test, simply add a `<namespaces>` or `<testNamespaces>`
+configuration section:
+
+ <configuration>
+ <namespaces>
+ <namespace>com.foo</namespace>
+ <namespace>net.*</namespace>
+ <namespace>!testing.*</namespace>
+ </namespaces>
+ </configuration>
+
+The namespace declaration is actually a regex match against discovered namespaces, and can also be
+prepended with an ! to filter the matching namespace.
+
+If you wish to further limit test/compile usage to only the namespaces you define, you can enable this with the
+configuration block:
+
+ <configuration>
+ <compileDeclaredNamespaceOnly>true</compileDeclaredNamespaceOnly>
+ <testDeclaredNamespaceOnly>true</testDeclaredNamespaceOnly>
+ </configuration>
+
+## Interactive Coding
+
+The plugin supports several goals intended to make it easier for developers to run interactive clojure shells
+in the context of maven projects. This means that all dependencies in a project's runtime and test scopes
+will be automatically added to the classpath and available for experimentation.
+
+By default these goals will use the test classpath, if you wish to only use the compile classpath/dependencies,
+you can disable this with:
+
+ <configuration>
+ <runWithTests>false</runWithTests>
+ </configuration>
+
+or by running maven with:
+
+ -Dclojure.runwith.test=false
+
+### Goals
+
+<table>
+ <tr>
+ <th></th>
+ <th>Property</th>
+ <th>Variable</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td colspan="5"><b>clojure:repl</b> — Starts an interactive clojure REPL right on the command line.</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>replScript</td>
+ <td></td>
+ <td></td>
+ <td>An initialization script can be specified in the pom using the replScript configuration element.</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>windowsRepl</td>
+ <td></td>
+ <td>cmd /c start</td>
+ <td>Allows to configure the command line that will be executed in Windows.</td>
+ </tr>
+ <tr>
+ <td colspan="5"><b>clojure:swank</b> — Starts a Swank server that accepts connections.</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>replScript</td>
+ <td></td>
+ <td></td>
+ <td>The clojure script to run before starting the repl</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>port</td>
+ <td>clojure.swank.port</td>
+ <td>4005</td>
+ <td>The swank server port</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>protocolVersion</td>
+ <td>clojure.swank.protocolVersion</td>
+ <td>2009-09-14</td>
+ <td>The swank protocol version</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>encoding</td>
+ <td>clojure.swank.encoding</td>
+ <td>iso-8859-1</td>
+ <td>The swank encoding to use</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>swankHost</td>
+ <td>clojure.swank.host</td>
+ <td>localhost</td>
+ <td>The host to bind the swank server to/td>
+ </tr>
+ <tr>
+ <td colspan="5"><b>clojure:nailgun</b> — Starts a nailgun server.</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>replScript</td>
+ <td></td>
+ <td></td>
+ <td>The clojure script to run before starting the repl</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>port</td>
+ <td>clojure.nailgun.port</td>
+ <td>2113</td>
+ <td>The nailgun server port</td>
+ </tr>
+ <tr>
+ <td colspan="5"><b>clojure:run</b> — Runs a clojure script.</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>script</td>
+ <td>clojure.script</td>
+ <td></td>
+ <td>The clojure script to run</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>scripts</td>
+ <td></td>
+ <td></td>
+ <td>A list of clojure scripts to run</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>mainClass</td>
+ <td>clojure.mainClass</td>
+ <td></td>
+ <td>A java class to run</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>args</td>
+ <td>clojure.args</td>
+ <td></td>
+ <td>Arguments to the clojure script(s)</td>
+ </tr>
+ <tr>
+ <td colspan="5"><b>clojure:add-source</b> — Includes clojure source directory in -sources.jar.</td>
+ </tr>
+ <tr>
+ <td colspan="5"><b>clojure:add-testsource</b> — Includes clojure test source directory in -testsources.jar.</td>
+ </tr>
+ <tr>
+ <td colspan="5"><b>clojure:nrepl</b> — Starts a nREPL server that accepts connections.</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>replScript</td>
+ <td></td>
+ <td></td>
+ <td>The clojure script to run before starting the repl</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>port</td>
+ <td>clojure.nrepl.port</td>
+ <td>4005</td>
+ <td>The nREPL server port</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>nreplHost</td>
+ <td>clojure.nrepl.host</td>
+ <td>localhost</td>
+ <td>The host to bind the nREPL server to/td>
+ </tr>
+</table>
+
+## Testing Clojure Code
+
+Whilst you could easily launch your tests from the clojure:run goal, the plugin provides two goals targeted
+specifically to testing: clojure:test and clojure:test-with-junit
+
+Without any additional configuration the plugin will run a temporary clojure "test launcher" script:
+
+The script runs all discovered *test* namespaces, and fails the build when any FAIL or
+ERROR cases are found.
+
+If you require different test behavior, you can provide your own test script with the following configuration:
+
+ <configuration>
+ <testScript>src/test/clojure/com/jobsheet/test.clj</testScript>
+ </configuration>
+
+The first argument to the script is the name of a properties file that has in it a config for the user selected.
+These configs can be parsed out using the following code
+
+```
+(def props (Properties.))
+(.load props (FileInputStream. (first *command-line-args*)))
+
+;;namespaces to run tests for
+(def namespaces (into []
+ (for [[key val] props
+ :when (.startsWith key "ns.")]
+ (symbol val))))
+
+;; should there be junit compatible output or not
+(def junit (Boolean/valueOf (.get props "junit")))
+;; what is the output directory that results should be written to
+(def output-dir (.get props "outputDir"))
+;; should we xml-escape *out* while the tests are running
+(def xml-escape (Boolean/valueOf (.get props "xmlEscape")))
+```
+
+We reserve the right to add new configs in the future, and possibly new command line arguments as well.
+
+## Configuring your clojure session
+
+If you want to provide additional arguments to all spawned java/clojure processes, the plugin provides several configuration properties:
+
+<table>
+ <tr>
+ <th>Property</th>
+ <th>Variable</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>vmargs</td>
+ <td>clojure.vmargs</td>
+ <td></td>
+ <td>JVM Arguments</td>
+ </tr>
+ <tr>
+ <td>clojureOptions</td>
+ <td></td>
+ <td></td>
+ <td>Additional JVM Options such as system property definitions</td>
+ </tr>
+ <tr>
+ <td>warnOnReflection</td>
+ <td></td>
+ <td>false</td>
+ <td>Enable reflection warnings</td>
+ </tr>
+ <tr>
+ <td>prependClasses</td>
+ <td></td>
+ <td></td>
+ <td>A list of classnames to prepend to the command line before the mainClass</td>
+ </tr>
+</table>
+
+The plugin can also copy source files to the output directory, filtered using the namespace mechanism
+that is used to control compilation. If you want to copy all compiled source files to the output:
+
+ <configuration>
+ <copyAllCompiledNamespaces>true</copyAllCompiledNamespaces>
+ <configuration>
+
+If you want to copy only a subset:
+
+ <configuration>
+ <copiedNamespaces>
+ <namespace>com.foo</namespace>
+ <namespace>!com.foo.private.*</namespace>
+ </copiedNamespaces>
+ <copyDeclaredNamespaceOnly>true</copyDeclaredNamespaceOnly>
+ <configuration>
+
+If you want to do no compilation at all, but copy all source files:
+
+ <configuration>
+ <copyDeclaredNamespaceOnly>true</copyDeclaredNamespaceOnly>
+ <namespaces>
+ <namespace>!.*</namespace>
+ </namespaces>
+ <compileDeclaredNamespaceOnly>true</compileDeclaredNamespaceOnly>
+ <configuration>
+
+Note that it will only copy clojure source files, which must a) end in .clj or .cljc and b) contain a
+namespace declaration.
+
+Enjoy.
+
+### Dependencies
+
+In order to run clojure:repl, clojure:swank or clojure:nailgun, your project
+needs to have a recent (1.0 or later) version of clojure as a dependency in
+pom.xml.
+
+In order to run clojure:autodoc, your project needs to have autodoc as a
+dependency in pom.xml.
+
+In order to run clojure:nrepl, your project needs to have org.clojure/tools.nrepl as a
+dependency in pom.xml.
+
+#### JLine/IClojure/REPL-y
+
+If JLine is detected in the classpath, it will be used to provide the
+clojure:repl goal with history, tab completion, etc. A simple way of
+enabling this is to put the following in your pom.xml:
+
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>0.9.94</version>
+ </dependency>
+
+If you prefer [IClojure](https://github.com/cosmin/IClojure) you can add:
+
+ <dependency>
+ <groupId>com.offbytwo.iclojure</groupId>
+ <artifactId>iclojure</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+
+Or [REPL-y](https://github.com/trptcolin/reply/):
+
+ <dependency>
+ <groupId>reply</groupId>
+ <artifactId>reply</artifactId>
+ <version>0.1.0-beta9</version>
+ </dependency>
+
+#### Swank
+
+The clojure:swank goal requires swank-clojure as a projet dependency.
+Unfortunatly, this library is currently not available in the central maven
+repository, but is available from clojars by first declaring the repository:
+
+ <repositories>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+and then declaring the dependency itself:
+
+ <dependency>
+ <groupId>swank-clojure</groupId>
+ <artifactId>swank-clojure</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </dependency>
+
+By default the swank process will run against the local loopback device, if you wish to change the host your
+swank server runs against, you can configure it via:
+
+ <configuration>
+ <swankHost>localhost</swankHost>
+ </configuration>
+
+or by defining the clojure.swank.host system property.
+
+#### nREPL
+
+The clojure:nrepl goal requires org.clojure/tools.nrepl as a projet dependency as:
+
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>tools.nrepl</artifactId>
+ <version>0.2.0-beta9</version>
+ </dependency>
+
+By default the nREPL process will run against the local loopback device on port 4005, if you wish to change the host
+your nREPL server runs against or the port, you can configure it via:
+
+ <configuration>
+ <nreplHost>localhost</nreplHost>
+ <nreplPort>9001</nreplPort>
+ </configuration>
+
+or by defining the clojure.nrepl.host and clojure.nrepl.port system property.
+
+#### Nailgun for Vimclojure < 2.2.0
+
+The clojure:nailgun goal requires a recent version of vimclojure as a
+dependency. Unfortunately, this library is currently not available in
+the central maven repository, and has to be downloaded and installed
+manually:
+
+ 1. Download vimclojure source code from `http://cloud.github.com/downloads/jochu/swank-clojure/swank-clojure-1.0-SNAPSHOT-distribution.zip`.
+ 2. Follow the README to compile and install vimclojure.
+ 3. Locate vimclojure.jar and run the following command to install it to your local repository (replace X.X.X with your version of vimclojure):
+
+ mvn install:install-file -DgroupId=de.kotka -DartifactId=vimclojure -Dversion=X.X.X -Dpackaging=jar -Dfile=/path/to/jarfile
+
+ 4. Put the following in your pom.xml (replace X.X.X with your version of vimclojure)
+
+ <dependency>
+ <groupId>de.kotka</groupId>
+ <artifactId>vimclojure</artifactId>
+ <version>X.X.X</version>
+ </dependency>
+
+ 5. You will need to run `mvn clojure:nailgun -Dclojure.nailgun.server=com.martiansoftware.nailgun.NGServer` in order to
+ work with the old version (pre 2.2.0) of vimclojure.
+
+#### Nailgun for Vimclojure >= 2.2.0
+
+To use `clojure 1.2.0` comfortably, you will need to upgrade to `Vimclojure
+2.2.0` which isn't backwards compatible with previous vimclojure versions. Now
+you will need a dependency on the `vimclojure:server:2.2.0` which contains the
+modified Nailgun server.
+
+ <dependency>
+ <groupId>vimclojure</groupId>
+ <artifactId>server</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+
+The jar can be found in [clojars](http://clojars.org/) maven repo (you'll have
+to add it to the `repositories` section)
+
+ <repository>
+ <id>clojars</id>
+ <name>Clojars</name>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+
+The installation process for vimclojure remains the same (except for the
+`vimclojure.jar` which you don't need to install anymore). Just get the
+vimclojure package from http://kotka.de/projects/clojure/vimclojure.html and
+follow the README.
+
+Notes for migration from the previous version of vimclojure:
+
+* `clj_highlight_builtins` was deprecated in favor of `vimclojure#HighlightBuiltins`
+* `clj_highlight_contrib` was removed
+* `g:clj_paren_rainbow` was deprecated in favor of `vimclojure#ParenRainbow`
+* `g:clj_want_gorilla` was deprecated in favor of `vimclojure#WantNailgun`
+
+#### Windows configuration
+
+As the default Windows console doesn't allow to easily copy and paste code, you can use the `windowsConsole`
+configuration option to specify which console command to run in Windows. For example if you are using
+http://code.google.com/p/conemu-maximus5/, you can configure the plugin with:
+
+`<windowsConsole>"C:\\Program Files\\ConEmu\\ConEmu64.exe" /cmd</windowsConsole>`
+
+which will give you a sane Windows console
+
+### Configuration
+
+The following options that can be configured as system properties:
+
+<table>
+ <tr>
+ <th>Property</th>
+ <th>Default value</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>clojure.nailgun.port</td>
+ <td>4005</td>
+ <td>
+ Only applicable for the <code>clojure:nailgun</code> goal.
+ The port number that the Nailgun server should listen to.
+ </td>
+ </tr>
+ <tr>
+ <td>clojure.swank.port</td>
+ <td>4005</td>
+ <td>
+ Only applicable for the <code>clojure:swank</code> goal.
+ The port number that the Swank server should listen to.
+ </td>
+ </tr>
+ <tr>
+ <td>clojure.swank.protocolVersion</td>
+ <td>2009-09-14</td>
+ <td>
+ Only applicable for the <code>clojure:swank</code> goal.
+ Specifies the version of the swank protocol.
+ </td>
+ </tr>
+ <tr>
+ <td>clojure.swank.encoding</td>
+ <td>iso-8859-1</td>
+ <td>
+ Only applicable for the <code>clojure:swank</code> goal.
+ Specifies the encoding used by the swank protocol.
+ </td>
+ </tr>
+ <tr>
+ <td>clojure.nrepl.port</td>
+ <td>4005</td>
+ <td>
+ Only applicable for the <code>clojure:nrepl</code> goal.
+ The port number that the nREPL should listen to.
+ </td>
+ </tr>
+ <tr>
+ <td>clojure.nrepl.host</td>
+ <td>4005</td>
+ <td>
+ Only applicable for the <code>clojure:nrepl</code> goal.
+ The host that the nREPL should listen to.
+ </td>
+ </tr>
+</table>
+
+### Support
+
+Join the discussion mailing list at:
+
+http://groups.google.com/group/clojure-maven-plugin
+
diff --git a/epl-v10.html b/epl-v10.html
new file mode 100644
index 0000000..813c07d
--- /dev/null
+++ b/epl-v10.html
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<p align=center><b>Eclipse Public License - v 1.0</b></p>
+
+<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
+DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
+AGREEMENT.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">where such changes and/or additions to the Program
+originate from and are distributed by that particular Contributor. A
+Contribution 'originates' from a Contributor if it was added to the
+Program by such Contributor itself or anyone acting on such
+Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii)
+are not derivative works of the Program.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"Licensed Patents" mean patent claims licensable by a
+Contributor which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to reproduce, prepare derivative works
+of, publicly display, publicly perform, distribute and sublicense the
+Contribution of such Contributor, if any, and such derivative works, in
+source code and object code form.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free patent license under Licensed Patents to make, use, sell,
+offer to sell, import and otherwise transfer the Contribution of such
+Contributor, if any, in source code and object code form. This patent
+license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor,
+such addition of the Contribution causes such combination to be covered
+by the Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.</p>
+
+<p class="list">c) Recipient understands that although each Contributor
+grants the licenses to its Contributions set forth herein, no assurances
+are provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility to
+secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow Recipient
+to distribute the Program, it is Recipient's responsibility to acquire
+that license before distributing the Program.</p>
+
+<p class="list">d) Each Contributor represents that to its knowledge it
+has sufficient copyright rights in its Contribution, if any, to grant
+the copyright license set forth in this Agreement.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">i) effectively disclaims on behalf of all Contributors
+all warranties and conditions, express and implied, including warranties
+or conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">iv) states that source code for the Program is available
+from such Contributor, and informs licensees how to obtain it in a
+reasonable manner on or through a medium customarily used for software
+exchange.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use of
+the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create
+potential liability for other Contributors. Therefore, if a Contributor
+includes the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and
+indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses")
+arising from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by the
+acts or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In
+order to qualify, an Indemnified Contributor must: a) promptly notify
+the Commercial Contributor in writing of such claim, and b) allow the
+Commercial Contributor to control, and cooperate with the Commercial
+Contributor in, the defense and any related settlement negotiations. The
+Indemnified Contributor may participate in any such claim at its own
+expense.</p>
+
+<p>For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
+ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable laws,
+damage to or loss of data, programs or equipment, and unavailability or
+interruption of operations.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further action
+by the parties hereto, such provision shall be reformed to the minimum
+extent necessary to make such provision valid and enforceable.</p>
+
+<p>If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the
+date such litigation is filed.</p>
+
+<p>All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of time
+after becoming aware of such noncompliance. If all Recipient's rights
+under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive.</p>
+
+<p>Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions (including
+revisions) of this Agreement from time to time. No one other than the
+Agreement Steward has the right to modify this Agreement. The Eclipse
+Foundation is the initial Agreement Steward. The Eclipse Foundation may
+assign the responsibility to serve as the Agreement Steward to a
+suitable separate entity. Each new version of the Agreement will be
+given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the
+Agreement under which it was received. In addition, after a new version
+of the Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+rights or licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.</p>
+
+<p>This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No party
+to this Agreement will bring a legal action under this Agreement more
+than one year after the cause of action arose. Each party waives its
+rights to a jury trial in any resulting litigation.</p>
+
+</body>
+
+</html>
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..58d77cb
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>clojure-maven-plugin Maven Mojo</name>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <version>1.7.1</version>
+ <description>Maven plugin for compiling clojure source files</description>
+ <url>http://github.com/talios/clojure-maven-plugin</url>
+ <scm>
+ <connection>scm:git:git at github.com:talios/clojure-maven-plugin.git</connection>
+ <developerConnection>scm:git:git at github.com:talios/clojure-maven-plugin.git</developerConnection>
+ <url>http://github.com/talios/clojure-maven-plugin</url>
+ <tag>clojure-maven-plugin-1.7.1</tag>
+ </scm>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <developers>
+ <developer>
+ <id>talios</id>
+ <name>Mark Derricutt</name>
+ <email>mark at talios.com</email>
+ <url>http://www.talios.com</url>
+ </developer>
+ </developers>
+ <contributors>
+ <contributor>
+ <name>Tim Dysinger</name>
+ <email>tim -on- dysinger.net</email>
+ </contributor>
+ <contributor>
+ <name>Stuart Sierra</name>
+ <email>mail at stuartsierra.com</email>
+ </contributor>
+ <contributor>
+ <name>Scott Fleckenstein</name>
+ <email>nullstyle at gmail.com</email>
+ </contributor>
+ <contributor>
+ <name>Jukka Zitting</name>
+ <email>jukka.zitting at gmail.com</email>
+ </contributor>
+ <contributor>
+ <name>Chas Emerick</name>
+ <email>cemerick at snowtide.com</email>
+ </contributor>
+ <contributor>
+ <name>Cosmin Stejerean</name>
+ <email>cosmin at offbytwo.com</email>
+ </contributor>
+ </contributors>
+ <licenses>
+ <license>
+ <name>Eclipse Public License</name>
+ </license>
+ </licenses>
+ <distributionManagement>
+ <repository>
+ <id>sonatype-staging</id>
+ <name>oss.sonatype.org Staging Repository</name>
+ <url>http://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
+ </repository>
+ <snapshotRepository>
+ <id>github-snapshots</id>
+ <name>oss.sonatype.org github Release Repository Snapshot Repository</name>
+ <url>http://oss.sonatype.org/content/repositories/github-snapshots/</url>
+ </snapshotRepository>
+ </distributionManagement>
+ <profiles>
+ <profile>
+ <id>release</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>3.2</version>
+ <configuration>
+ <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+ </configuration>
+ <executions>
+ <execution>
+ <id>mojo-descriptor</id>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </execution>
+ <!-- if you want to generate help goal -->
+ <execution>
+ <id>help-goal</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.4.1</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-provider-gitexe</artifactId>
+ <version>1.8.1</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <preparationGoals>clean install</preparationGoals>
+ <goals>deploy</goals>
+ <pushChanges>false</pushChanges>
+ <localCheckout>true</localCheckout>
+ <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ <configuration>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <postBuildHookScript>verify.bsh</postBuildHookScript>
+ <debug>true</debug>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.0-beta-2</version>
+ <configuration>
+ <reportPlugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <formats>
+ <format>xml</format>
+ <format>html</format>
+ </formats>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ </reportPlugins>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>3.0.17</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easytesting</groupId>
+ <artifactId>fest-assert-core</artifactId>
+ <version>2.0M10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-exec</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-toolchain</artifactId>
+ <version>3.0-alpha-2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-compiler-api</artifactId>
+ <version>2.3</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/it/autodoc-1.1.0/goals.txt b/src/it/autodoc-1.1.0/goals.txt
new file mode 100644
index 0000000..d1d5844
--- /dev/null
+++ b/src/it/autodoc-1.1.0/goals.txt
@@ -0,0 +1,2 @@
+clean clojure:autodoc
+
diff --git a/src/it/autodoc-1.1.0/pom.xml b/src/it/autodoc-1.1.0/pom.xml
new file mode 100644
index 0000000..dad44f3
--- /dev/null
+++ b/src/it/autodoc-1.1.0/pom.xml
@@ -0,0 +1,66 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>autodoc</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <temporaryOutputDirectory>true</temporaryOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>autodoc</groupId>
+ <artifactId>autodoc</artifactId>
+ <version>0.7.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/autodoc-1.1.0/src/main/clojure/autodoc.clj b/src/it/autodoc-1.1.0/src/main/clojure/autodoc.clj
new file mode 100644
index 0000000..d0cbfc0
--- /dev/null
+++ b/src/it/autodoc-1.1.0/src/main/clojure/autodoc.clj
@@ -0,0 +1,6 @@
+(ns autodoc)
+
+(defn hello-world
+ "A simple hello world application."
+ []
+ (println "Hello World"))
diff --git a/src/it/autodoc-1.1.0/verify.bsh b/src/it/autodoc-1.1.0/verify.bsh
new file mode 100644
index 0000000..b0a529a
--- /dev/null
+++ b/src/it/autodoc-1.1.0/verify.bsh
@@ -0,0 +1,6 @@
+import java.io.*;
+
+File file = new File( basedir, "target/autodoc/autodoc-api.html" );
+if ( !file.exists() ) {
+ throw new FileNotFoundException( "Could not find generated autodoc file: " + file );
+}
diff --git a/src/it/autodoc-1.2.0-nonstandard-paths/goals.txt b/src/it/autodoc-1.2.0-nonstandard-paths/goals.txt
new file mode 100644
index 0000000..d1d5844
--- /dev/null
+++ b/src/it/autodoc-1.2.0-nonstandard-paths/goals.txt
@@ -0,0 +1,2 @@
+clean clojure:autodoc
+
diff --git a/src/it/autodoc-1.2.0-nonstandard-paths/pom.xml b/src/it/autodoc-1.2.0-nonstandard-paths/pom.xml
new file mode 100644
index 0000000..69b74a8
--- /dev/null
+++ b/src/it/autodoc-1.2.0-nonstandard-paths/pom.xml
@@ -0,0 +1,64 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>autodoc</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <temporaryOutputDirectory>true</temporaryOutputDirectory>
+ <sourceDirectories>
+ <sourceDirectory>src</sourceDirectory>
+ </sourceDirectories>
+ <autodocTargetDirectory>${project.build.directory}/autodoc2</autodocTargetDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>autodoc</groupId>
+ <artifactId>autodoc</artifactId>
+ <version>0.7.1</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/autodoc-1.2.0-nonstandard-paths/src/autodoc.clj b/src/it/autodoc-1.2.0-nonstandard-paths/src/autodoc.clj
new file mode 100644
index 0000000..d0cbfc0
--- /dev/null
+++ b/src/it/autodoc-1.2.0-nonstandard-paths/src/autodoc.clj
@@ -0,0 +1,6 @@
+(ns autodoc)
+
+(defn hello-world
+ "A simple hello world application."
+ []
+ (println "Hello World"))
diff --git a/src/it/autodoc-1.2.0-nonstandard-paths/verify.bsh b/src/it/autodoc-1.2.0-nonstandard-paths/verify.bsh
new file mode 100644
index 0000000..24c0ba4
--- /dev/null
+++ b/src/it/autodoc-1.2.0-nonstandard-paths/verify.bsh
@@ -0,0 +1,4 @@
+File file=new File(basedir,"target/autodoc2/autodoc-api.html");
+if(!file.exists()){
+ throw new FileNotFoundException("Could not find generated autodoc file: "+file);
+}
diff --git a/src/it/autodoc-1.2.0/goals.txt b/src/it/autodoc-1.2.0/goals.txt
new file mode 100644
index 0000000..d1d5844
--- /dev/null
+++ b/src/it/autodoc-1.2.0/goals.txt
@@ -0,0 +1,2 @@
+clean clojure:autodoc
+
diff --git a/src/it/autodoc-1.2.0/pom.xml b/src/it/autodoc-1.2.0/pom.xml
new file mode 100644
index 0000000..7f48185
--- /dev/null
+++ b/src/it/autodoc-1.2.0/pom.xml
@@ -0,0 +1,60 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>autodoc</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <temporaryOutputDirectory>true</temporaryOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>autodoc</groupId>
+ <artifactId>autodoc</artifactId>
+ <version>0.7.1</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/autodoc-1.2.0/src/main/clojure/autodoc.clj b/src/it/autodoc-1.2.0/src/main/clojure/autodoc.clj
new file mode 100644
index 0000000..d0cbfc0
--- /dev/null
+++ b/src/it/autodoc-1.2.0/src/main/clojure/autodoc.clj
@@ -0,0 +1,6 @@
+(ns autodoc)
+
+(defn hello-world
+ "A simple hello world application."
+ []
+ (println "Hello World"))
diff --git a/src/it/autodoc-1.2.0/verify.bsh b/src/it/autodoc-1.2.0/verify.bsh
new file mode 100644
index 0000000..b0a529a
--- /dev/null
+++ b/src/it/autodoc-1.2.0/verify.bsh
@@ -0,0 +1,6 @@
+import java.io.*;
+
+File file = new File( basedir, "target/autodoc/autodoc-api.html" );
+if ( !file.exists() ) {
+ throw new FileNotFoundException( "Could not find generated autodoc file: " + file );
+}
diff --git a/src/it/basic-usage-test-13/goals.txt b/src/it/basic-usage-test-13/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/basic-usage-test-13/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/basic-usage-test-13/pom.xml b/src/it/basic-usage-test-13/pom.xml
new file mode 100644
index 0000000..1accb49
--- /dev/null
+++ b/src/it/basic-usage-test-13/pom.xml
@@ -0,0 +1,68 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>basic-usage-test</artifactId>
+ <version>testing</version>
+ <packaging>jar</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>test</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.3.0-beta1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.clojure.contrib</groupId>
+ <artifactId>gen-html-docs</artifactId>
+ <version>1.3.0-alpha4</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/basic-usage-test-13/src/main/clojure/packaging.clj b/src/it/basic-usage-test-13/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/basic-usage-test-13/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/basic-usage-test-13/verify.bsh b/src/it/basic-usage-test-13/verify.bsh
new file mode 100644
index 0000000..0fa9536
--- /dev/null
+++ b/src/it/basic-usage-test-13/verify.bsh
@@ -0,0 +1,17 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/basic-usage-test-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/basic-usage-test/goals.txt b/src/it/basic-usage-test/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/basic-usage-test/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/basic-usage-test/pom.xml b/src/it/basic-usage-test/pom.xml
new file mode 100644
index 0000000..a382153
--- /dev/null
+++ b/src/it/basic-usage-test/pom.xml
@@ -0,0 +1,52 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>basic-usage-test</artifactId>
+ <version>testing</version>
+ <packaging>jar</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>test</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/basic-usage-test/src/main/clojure/packaging.clj b/src/it/basic-usage-test/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/basic-usage-test/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/basic-usage-test/verify.bsh b/src/it/basic-usage-test/verify.bsh
new file mode 100644
index 0000000..0fa9536
--- /dev/null
+++ b/src/it/basic-usage-test/verify.bsh
@@ -0,0 +1,17 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/basic-usage-test-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/marginalia-multidoc/goals.txt b/src/it/marginalia-multidoc/goals.txt
new file mode 100644
index 0000000..9f90d1d
--- /dev/null
+++ b/src/it/marginalia-multidoc/goals.txt
@@ -0,0 +1,2 @@
+clean clojure:marginalia
+
diff --git a/src/it/marginalia-multidoc/pom.xml b/src/it/marginalia-multidoc/pom.xml
new file mode 100644
index 0000000..ce3b70e
--- /dev/null
+++ b/src/it/marginalia-multidoc/pom.xml
@@ -0,0 +1,73 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>marginalia</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <temporaryOutputDirectory>true</temporaryOutputDirectory>
+ <marginalia>
+ <multi>true</multi>
+ </marginalia>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>marginalia</groupId>
+ <artifactId>marginalia</artifactId>
+ <version>0.7.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/marginalia-multidoc/src/main/clojure/autodoc.clj b/src/it/marginalia-multidoc/src/main/clojure/autodoc.clj
new file mode 100644
index 0000000..d0cbfc0
--- /dev/null
+++ b/src/it/marginalia-multidoc/src/main/clojure/autodoc.clj
@@ -0,0 +1,6 @@
+(ns autodoc)
+
+(defn hello-world
+ "A simple hello world application."
+ []
+ (println "Hello World"))
diff --git a/src/it/marginalia-multidoc/verify.bsh b/src/it/marginalia-multidoc/verify.bsh
new file mode 100644
index 0000000..c7c42f6
--- /dev/null
+++ b/src/it/marginalia-multidoc/verify.bsh
@@ -0,0 +1,6 @@
+import java.io.*;
+
+File file = new File( basedir, "target/marginalia/toc.html" );
+if ( !file.exists() ) {
+ throw new FileNotFoundException( "Could not find generated marginalia file: " + file );
+}
diff --git a/src/it/marginalia/goals.txt b/src/it/marginalia/goals.txt
new file mode 100644
index 0000000..9f90d1d
--- /dev/null
+++ b/src/it/marginalia/goals.txt
@@ -0,0 +1,2 @@
+clean clojure:marginalia
+
diff --git a/src/it/marginalia/pom.xml b/src/it/marginalia/pom.xml
new file mode 100644
index 0000000..2558f77
--- /dev/null
+++ b/src/it/marginalia/pom.xml
@@ -0,0 +1,70 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>marginalia</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <temporaryOutputDirectory>true</temporaryOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>marginalia</groupId>
+ <artifactId>marginalia</artifactId>
+ <version>0.7.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure-contrib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/marginalia/src/main/clojure/autodoc.clj b/src/it/marginalia/src/main/clojure/autodoc.clj
new file mode 100644
index 0000000..d0cbfc0
--- /dev/null
+++ b/src/it/marginalia/src/main/clojure/autodoc.clj
@@ -0,0 +1,6 @@
+(ns autodoc)
+
+(defn hello-world
+ "A simple hello world application."
+ []
+ (println "Hello World"))
diff --git a/src/it/marginalia/verify.bsh b/src/it/marginalia/verify.bsh
new file mode 100644
index 0000000..4fb8811
--- /dev/null
+++ b/src/it/marginalia/verify.bsh
@@ -0,0 +1,6 @@
+import java.io.*;
+
+File file = new File( basedir, "target/marginalia/uberdoc.html" );
+if ( !file.exists() ) {
+ throw new FileNotFoundException( "Could not find generated marginalia file: " + file );
+}
diff --git a/src/it/multimoduletest/goals.txt b/src/it/multimoduletest/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/multimoduletest/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/multimoduletest/multimodule/pom.xml b/src/it/multimoduletest/multimodule/pom.xml
new file mode 100644
index 0000000..ed8c8c5
--- /dev/null
+++ b/src/it/multimoduletest/multimodule/pom.xml
@@ -0,0 +1,39 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>multimodule</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>multimodule-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <testScript>src/test/clojure/runtest.clj</testScript>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/multimoduletest/multimodule/src/main/clojure/packaging.clj b/src/it/multimoduletest/multimodule/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/multimoduletest/multimodule/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/multimoduletest/multimodule/src/test/clojure/runtest.clj b/src/it/multimoduletest/multimodule/src/test/clojure/runtest.clj
new file mode 100644
index 0000000..450b657
--- /dev/null
+++ b/src/it/multimoduletest/multimodule/src/test/clojure/runtest.clj
@@ -0,0 +1 @@
+(println "Hello from runtest.clj")
diff --git a/src/it/multimoduletest/pom.xml b/src/it/multimoduletest/pom.xml
new file mode 100644
index 0000000..b10730d
--- /dev/null
+++ b/src/it/multimoduletest/pom.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>multimodule.parent</artifactId>
+ <name>multimodule.parent</name>
+ <version>testing</version>
+ <url>http://smxemail.com</url>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>multimodule</module>
+ </modules>
+
+</project>
diff --git a/src/it/multimoduletest/verify.bsh b/src/it/multimoduletest/verify.bsh
new file mode 100644
index 0000000..261a135
--- /dev/null
+++ b/src/it/multimoduletest/verify.bsh
@@ -0,0 +1,37 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File buildFile = new File( basedir, "build.log");
+LineNumberReader reader = new LineNumberReader(new FileReader(buildFile));
+String line = reader.readLine();
+boolean foundRunner = false;
+try {
+ while (line != null) {
+ if (line.contains("Hello from runtest.clj")) {
+ foundRunner = true;
+ }
+ line = reader.readLine();
+ }
+} catch (Exception e) {
+ // ignore
+}
+
+
+if (!foundRunner) {
+ throw new RuntimeException("Did not find text from custom runner");
+}
+
+File file = new File( basedir, "multimodule/target/multimodule-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/packaging-test-1.1.0/goals.txt b/src/it/packaging-test-1.1.0/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/packaging-test-1.1.0/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/packaging-test-1.1.0/pom.xml b/src/it/packaging-test-1.1.0/pom.xml
new file mode 100644
index 0000000..7635c1b
--- /dev/null
+++ b/src/it/packaging-test-1.1.0/pom.xml
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>packaging-test</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/packaging-test-1.1.0/src/main/clojure/packaging.clj b/src/it/packaging-test-1.1.0/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/packaging-test-1.1.0/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/packaging-test-1.1.0/verify.bsh b/src/it/packaging-test-1.1.0/verify.bsh
new file mode 100644
index 0000000..1803cf0
--- /dev/null
+++ b/src/it/packaging-test-1.1.0/verify.bsh
@@ -0,0 +1,17 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/packaging-test-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/packaging-test-1.4.0/goals.txt b/src/it/packaging-test-1.4.0/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/packaging-test-1.4.0/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/packaging-test-1.4.0/pom.xml b/src/it/packaging-test-1.4.0/pom.xml
new file mode 100644
index 0000000..0533d05
--- /dev/null
+++ b/src/it/packaging-test-1.4.0/pom.xml
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>packaging-test</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/packaging-test-1.4.0/src/main/clojure/packaging.clj b/src/it/packaging-test-1.4.0/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/packaging-test-1.4.0/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/packaging-test-1.4.0/verify.bsh b/src/it/packaging-test-1.4.0/verify.bsh
new file mode 100644
index 0000000..1803cf0
--- /dev/null
+++ b/src/it/packaging-test-1.4.0/verify.bsh
@@ -0,0 +1,17 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/packaging-test-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/packaging-test-1.5.0/goals.txt b/src/it/packaging-test-1.5.0/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/packaging-test-1.5.0/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/packaging-test-1.5.0/pom.xml b/src/it/packaging-test-1.5.0/pom.xml
new file mode 100644
index 0000000..80493b7
--- /dev/null
+++ b/src/it/packaging-test-1.5.0/pom.xml
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>packaging-test</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/packaging-test-1.5.0/src/main/clojure/packaging.clj b/src/it/packaging-test-1.5.0/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/packaging-test-1.5.0/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/packaging-test-1.5.0/verify.bsh b/src/it/packaging-test-1.5.0/verify.bsh
new file mode 100644
index 0000000..1803cf0
--- /dev/null
+++ b/src/it/packaging-test-1.5.0/verify.bsh
@@ -0,0 +1,17 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/packaging-test-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/packaging-test-1.7.0/goals.txt b/src/it/packaging-test-1.7.0/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/packaging-test-1.7.0/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/packaging-test-1.7.0/pom.xml b/src/it/packaging-test-1.7.0/pom.xml
new file mode 100644
index 0000000..406948c
--- /dev/null
+++ b/src/it/packaging-test-1.7.0/pom.xml
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>packaging-test</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.7.0-RC1</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/packaging-test-1.7.0/src/main/clojure/packaging.clj b/src/it/packaging-test-1.7.0/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/packaging-test-1.7.0/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/packaging-test-1.7.0/src/main/clojure/packagingc.cljc b/src/it/packaging-test-1.7.0/src/main/clojure/packagingc.cljc
new file mode 100644
index 0000000..a0e55aa
--- /dev/null
+++ b/src/it/packaging-test-1.7.0/src/main/clojure/packagingc.cljc
@@ -0,0 +1,5 @@
+(ns packagingc)
+
+(defn hello-world-cljc
+ []
+ (println "Hello World from CLJC"))
diff --git a/src/it/packaging-test-1.7.0/verify.bsh b/src/it/packaging-test-1.7.0/verify.bsh
new file mode 100644
index 0000000..f40b9d9
--- /dev/null
+++ b/src/it/packaging-test-1.7.0/verify.bsh
@@ -0,0 +1,25 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/packaging-test-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packagingc.cljc") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
+
+if (jar.getJarEntry("packagingc__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/packaging-test/goals.txt b/src/it/packaging-test/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/packaging-test/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/packaging-test/pom.xml b/src/it/packaging-test/pom.xml
new file mode 100644
index 0000000..c5c2798
--- /dev/null
+++ b/src/it/packaging-test/pom.xml
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>packaging-test</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/packaging-test/src/main/clojure/packaging.clj b/src/it/packaging-test/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/packaging-test/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/packaging-test/verify.bsh b/src/it/packaging-test/verify.bsh
new file mode 100644
index 0000000..1803cf0
--- /dev/null
+++ b/src/it/packaging-test/verify.bsh
@@ -0,0 +1,17 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/packaging-test-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/runwithplugindeps/goals.txt b/src/it/runwithplugindeps/goals.txt
new file mode 100644
index 0000000..5a524f0
--- /dev/null
+++ b/src/it/runwithplugindeps/goals.txt
@@ -0,0 +1,2 @@
+clean clojure:run
+
diff --git a/src/it/runwithplugindeps/pom.xml b/src/it/runwithplugindeps/pom.xml
new file mode 100644
index 0000000..f7ba6bd
--- /dev/null
+++ b/src/it/runwithplugindeps/pom.xml
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>basic-usage-test</artifactId>
+ <version>testing</version>
+ <packaging>jar</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>run</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <includePluginDependencies>true</includePluginDependencies>
+ <script>src/main/clojure/runme.clj</script>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/runwithplugindeps/src/main/clojure/runme.clj b/src/it/runwithplugindeps/src/main/clojure/runme.clj
new file mode 100644
index 0000000..efc762a
--- /dev/null
+++ b/src/it/runwithplugindeps/src/main/clojure/runme.clj
@@ -0,0 +1,7 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
+
+(hello-world)
diff --git a/src/it/selectivenamespacecompilation/goals.txt b/src/it/selectivenamespacecompilation/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/selectivenamespacecompilation/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/selectivenamespacecompilation/pom.xml b/src/it/selectivenamespacecompilation/pom.xml
new file mode 100644
index 0000000..b05dad9
--- /dev/null
+++ b/src/it/selectivenamespacecompilation/pom.xml
@@ -0,0 +1,53 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>packaging-test</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <compileDeclaredNamespaceOnly>true</compileDeclaredNamespaceOnly>
+ <namespaces>
+ <namespace>packaging</namespace>
+ </namespaces>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/selectivenamespacecompilation/src/main/clojure/otherpackage.clj b/src/it/selectivenamespacecompilation/src/main/clojure/otherpackage.clj
new file mode 100644
index 0000000..0beabc2
--- /dev/null
+++ b/src/it/selectivenamespacecompilation/src/main/clojure/otherpackage.clj
@@ -0,0 +1,5 @@
+(ns otherpackage)
+
+(defn hello-other-world
+ []
+ (println "Hello Other World"))
diff --git a/src/it/selectivenamespacecompilation/src/main/clojure/packaging.clj b/src/it/selectivenamespacecompilation/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/selectivenamespacecompilation/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/selectivenamespacecompilation/verify.bsh b/src/it/selectivenamespacecompilation/verify.bsh
new file mode 100644
index 0000000..8b46610
--- /dev/null
+++ b/src/it/selectivenamespacecompilation/verify.bsh
@@ -0,0 +1,21 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/packaging-test-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
+
+if (jar.getJarEntry("otherpackage__init.class") != null) {
+ throw new FileNotFoundException("Generated JAR file should not include compiled clojure class file for 'otherpackage'");
+}
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 0000000..9675c2e
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
diff --git a/src/it/temporaryoutputpath/goals.txt b/src/it/temporaryoutputpath/goals.txt
new file mode 100644
index 0000000..49b8f1a
--- /dev/null
+++ b/src/it/temporaryoutputpath/goals.txt
@@ -0,0 +1,2 @@
+clean install
+
diff --git a/src/it/temporaryoutputpath/pom.xml b/src/it/temporaryoutputpath/pom.xml
new file mode 100644
index 0000000..545e38c
--- /dev/null
+++ b/src/it/temporaryoutputpath/pom.xml
@@ -0,0 +1,50 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>temporaryoutputdirectory</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>packaging-test</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <temporaryOutputDirectory>true</temporaryOutputDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/temporaryoutputpath/src/main/clojure/packaging.clj b/src/it/temporaryoutputpath/src/main/clojure/packaging.clj
new file mode 100644
index 0000000..b1369ea
--- /dev/null
+++ b/src/it/temporaryoutputpath/src/main/clojure/packaging.clj
@@ -0,0 +1,5 @@
+(ns packaging)
+
+(defn hello-world
+ []
+ (println "Hello World"))
diff --git a/src/it/temporaryoutputpath/verify.bsh b/src/it/temporaryoutputpath/verify.bsh
new file mode 100644
index 0000000..33fae30
--- /dev/null
+++ b/src/it/temporaryoutputpath/verify.bsh
@@ -0,0 +1,16 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/temporaryoutputdirectory-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
+
+JarFile jar = new JarFile(file);
+if (jar.getJarEntry("packaging.clj") == null) {
+ throw new FileNotFoundException("Generated JAR file does not include clojure source file");
+}
+
+if (jar.getJarEntry("packaging__init.class") != null) {
+ throw new FileNotFoundException("Generated JAR file does not include compiled clojure class file");
+}
diff --git a/src/it/test-resources/goals.txt b/src/it/test-resources/goals.txt
new file mode 100644
index 0000000..9cb8855
--- /dev/null
+++ b/src/it/test-resources/goals.txt
@@ -0,0 +1 @@
+clean install
diff --git a/src/it/test-resources/pom.xml b/src/it/test-resources/pom.xml
new file mode 100644
index 0000000..cf1d4f8
--- /dev/null
+++ b/src/it/test-resources/pom.xml
@@ -0,0 +1,81 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <packaging>clojure</packaging>
+ <!-- <packaging>jar</packaging> -->
+
+ <groupId>h908714124</groupId>
+ <artifactId>clojure-maven-plugin-demo</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.5.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>tools.logging</artifactId>
+ <version>0.2.6</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <targetPath>${project.build.outputDirectory}</targetPath>
+ </resource>
+ </resources>
+
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <targetPath>${project.build.testOutputDirectory}</targetPath>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.14.1</version>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <reuseForks>false</reuseForks>
+ <forkCount>1</forkCount>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/test-resources/src/main/clojure/h908714124/somens.clj b/src/it/test-resources/src/main/clojure/h908714124/somens.clj
new file mode 100644
index 0000000..65d18a6
--- /dev/null
+++ b/src/it/test-resources/src/main/clojure/h908714124/somens.clj
@@ -0,0 +1,6 @@
+(ns h908714124.somens
+ (:gen-class)
+ (:require [clojure.tools.logging :as log]))
+
+(defn -main [& args]
+ (log/info "foobar"))
diff --git a/src/it/test-resources/src/main/resources/main/build-info.properties b/src/it/test-resources/src/main/resources/main/build-info.properties
new file mode 100644
index 0000000..b8271f5
--- /dev/null
+++ b/src/it/test-resources/src/main/resources/main/build-info.properties
@@ -0,0 +1,4 @@
+project.build.testOutputDirectory = ${project.build.testOutputDirectory}
+project.testResources = ${project.testResources}
+project.build.outputDirectory = ${project.build.outputDirectory}
+project.resources = ${project.resources}
diff --git a/src/it/test-resources/src/test/java/h908714124/ResourceTest.java b/src/it/test-resources/src/test/java/h908714124/ResourceTest.java
new file mode 100644
index 0000000..3247644
--- /dev/null
+++ b/src/it/test-resources/src/test/java/h908714124/ResourceTest.java
@@ -0,0 +1,30 @@
+package h908714124;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class ResourceTest {
+
+ @Test
+ public void okJar() throws IOException {
+ String bip = "/test/build-info.properties";
+ InputStream s = getClass().getResourceAsStream(bip);
+ Assert.assertNotNull(s);
+ InputStreamReader sr = new InputStreamReader(s);
+ BufferedReader bsr = new BufferedReader(sr);
+ String line;
+ try {
+ while ((line = bsr.readLine()) != null) {
+ System.out.println(line);
+ }
+ } finally {
+ bsr.close();
+ }
+ }
+
+}
diff --git a/src/it/test-resources/src/test/resources/test/build-info.properties b/src/it/test-resources/src/test/resources/test/build-info.properties
new file mode 100644
index 0000000..b8271f5
--- /dev/null
+++ b/src/it/test-resources/src/test/resources/test/build-info.properties
@@ -0,0 +1,4 @@
+project.build.testOutputDirectory = ${project.build.testOutputDirectory}
+project.testResources = ${project.testResources}
+project.build.outputDirectory = ${project.build.outputDirectory}
+project.resources = ${project.resources}
diff --git a/src/it/test-resources/verify.bsh b/src/it/test-resources/verify.bsh
new file mode 100644
index 0000000..312dcd1
--- /dev/null
+++ b/src/it/test-resources/verify.bsh
@@ -0,0 +1,4 @@
+File file=new File(basedir,"target/test-classes/test/build-info.properties");
+if(!file.exists()){
+ throw new FileNotFoundException("Could not find copied test resource file: "+file);
+}
diff --git a/src/it/test-with-junit-1.3/goals.txt b/src/it/test-with-junit-1.3/goals.txt
new file mode 100644
index 0000000..3185b32
--- /dev/null
+++ b/src/it/test-with-junit-1.3/goals.txt
@@ -0,0 +1,3 @@
+clean clojure:compile clojure:test-with-junit
+
+
diff --git a/src/it/test-with-junit-1.3/pom.xml b/src/it/test-with-junit-1.3/pom.xml
new file mode 100644
index 0000000..8533e76
--- /dev/null
+++ b/src/it/test-with-junit-1.3/pom.xml
@@ -0,0 +1,50 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>test-with-junit</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>test-with-junit</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <xmlEscapeOutput>true</xmlEscapeOutput>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/test-with-junit-1.3/src/test/clojure/succeeding.clj b/src/it/test-with-junit-1.3/src/test/clojure/succeeding.clj
new file mode 100644
index 0000000..8e93106
--- /dev/null
+++ b/src/it/test-with-junit-1.3/src/test/clojure/succeeding.clj
@@ -0,0 +1,8 @@
+(ns succeeding
+ (:use
+ clojure.test)
+ )
+
+(deftest atest
+ (is true)
+ )
diff --git a/src/it/test-with-junit-1.3/verify.bsh b/src/it/test-with-junit-1.3/verify.bsh
new file mode 100644
index 0000000..bdd1b96
--- /dev/null
+++ b/src/it/test-with-junit-1.3/verify.bsh
@@ -0,0 +1,35 @@
+import java.io.*;
+
+File file = new File( basedir, "target/test-reports/succeeding.xml" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated report: " + file );
+}
+Reader r = new BufferedReader(new FileReader(file));
+String line = r.readLine().trim();
+if (!"<?xml version=\"1.0\" encoding=\"UTF-8\"?>".equals(line)) {
+ throw new RuntimeException("line 1 should be <?xml version=\"1.0\" encoding=\"UTF-8\"?> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testsuites>".equals(line)) {
+ throw new RuntimeException("line 2 should be <testsuites> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testsuite name=\"succeeding\">".equals(line)) {
+ throw new RuntimeException("line 3 should be <testsuite name=\"succeeding\"> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testcase name=\"atest\" classname=\"succeeding\">".equals(line)) {
+ throw new RuntimeException("line 4 should be [<testcase name=\"atest\" classname=\"succeeding\">] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testcase>".equals(line)) {
+ throw new RuntimeException("line 5 should be [</testcase>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testsuite>".equals(line)) {
+ throw new RuntimeException("line 6 should be [</testsuite>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testsuites>".equals(line)) {
+ throw new RuntimeException("line 7 should be [</testsuites>] but was:" + line);
+}
\ No newline at end of file
diff --git a/src/it/test-with-junit-failure-1.3/goals.txt b/src/it/test-with-junit-failure-1.3/goals.txt
new file mode 100644
index 0000000..3185b32
--- /dev/null
+++ b/src/it/test-with-junit-failure-1.3/goals.txt
@@ -0,0 +1,3 @@
+clean clojure:compile clojure:test-with-junit
+
+
diff --git a/src/it/test-with-junit-failure-1.3/invoker.properties b/src/it/test-with-junit-failure-1.3/invoker.properties
new file mode 100644
index 0000000..bbbc381
--- /dev/null
+++ b/src/it/test-with-junit-failure-1.3/invoker.properties
@@ -0,0 +1,2 @@
+# The expected result of the build, possible values are "success" (default) and "failure"
+invoker.buildResult = failure
\ No newline at end of file
diff --git a/src/it/test-with-junit-failure-1.3/pom.xml b/src/it/test-with-junit-failure-1.3/pom.xml
new file mode 100644
index 0000000..a0dca60
--- /dev/null
+++ b/src/it/test-with-junit-failure-1.3/pom.xml
@@ -0,0 +1,51 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>test-with-junit-failure</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>test-with-junit-failure</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <!-- Can use this in 1.3 only due to CLJ-431 -->
+ <xmlEscapeOutput>true</xmlEscapeOutput>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/test-with-junit-failure-1.3/src/test/clojure/failing.clj b/src/it/test-with-junit-failure-1.3/src/test/clojure/failing.clj
new file mode 100644
index 0000000..4ec127e
--- /dev/null
+++ b/src/it/test-with-junit-failure-1.3/src/test/clojure/failing.clj
@@ -0,0 +1,8 @@
+(ns failing
+ (:use
+ clojure.test)
+ )
+
+(deftest atest
+ (is false "<>")
+ )
diff --git a/src/it/test-with-junit-failure-1.3/src/test/clojure/passing.clj b/src/it/test-with-junit-failure-1.3/src/test/clojure/passing.clj
new file mode 100644
index 0000000..c17b3cb
--- /dev/null
+++ b/src/it/test-with-junit-failure-1.3/src/test/clojure/passing.clj
@@ -0,0 +1,8 @@
+(ns passing
+ (:use
+ clojure.test)
+ )
+
+(deftest atest
+ (is (= 0 0))
+ )
diff --git a/src/it/test-with-junit-failure-1.3/verify.bsh b/src/it/test-with-junit-failure-1.3/verify.bsh
new file mode 100644
index 0000000..7744559
--- /dev/null
+++ b/src/it/test-with-junit-failure-1.3/verify.bsh
@@ -0,0 +1,51 @@
+import java.io.*;
+
+File file = new File( basedir, "target/test-reports/failing.xml" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated report: " + file );
+}
+Reader r = new BufferedReader(new FileReader(file));
+String line = r.readLine();
+if (!"<?xml version=\"1.0\" encoding=\"UTF-8\"?>".equals(line)) {
+ throw new RuntimeException("line 1 should be <?xml version=\"1.0\" encoding=\"UTF-8\"?> but was:" + line);
+}
+line = r.readLine();
+if (!"<testsuites>".equals(line)) {
+ throw new RuntimeException("line 2 should be <testsuites> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testsuite name=\"failing\">".equals(line)) {
+ throw new RuntimeException("line 3 should be <testsuite name=\"failing\"> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testcase name=\"atest\" classname=\"failing\">".equals(line)) {
+ throw new RuntimeException("line 4 should be [<testcase name=\"atest\" classname=\"failing\">] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<failure message=\"<>\"><>".equals(line)) {
+ throw new RuntimeException("line 5 should be [<failure message=\"<>\"><>" + line);
+}
+line = r.readLine().trim();
+if (!"expected: false".equals(line)) {
+ throw new RuntimeException("line 6 should be [expected: false] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"actual: false".equals(line)) {
+ throw new RuntimeException("line 7 should be [actual: false] but was:" + line);
+}
+line = r.readLine().trim();
+if (!(line.startsWith("at:") && line.endsWith("</failure>"))) {
+ throw new RuntimeException("line 8 should be [at: test.clj:344</failure>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testcase>".equals(line)) {
+ throw new RuntimeException("line 9 should be [</testcase>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testsuite>".equals(line)) {
+ throw new RuntimeException("line 10 should be [</testsuite>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testsuites>".equals(line)) {
+ throw new RuntimeException("line 11 should be [</testsuites>] but was:" + line);
+}
diff --git a/src/it/test-with-junit-failure/goals.txt b/src/it/test-with-junit-failure/goals.txt
new file mode 100644
index 0000000..3185b32
--- /dev/null
+++ b/src/it/test-with-junit-failure/goals.txt
@@ -0,0 +1,3 @@
+clean clojure:compile clojure:test-with-junit
+
+
diff --git a/src/it/test-with-junit-failure/invoker.properties b/src/it/test-with-junit-failure/invoker.properties
new file mode 100644
index 0000000..bbbc381
--- /dev/null
+++ b/src/it/test-with-junit-failure/invoker.properties
@@ -0,0 +1,2 @@
+# The expected result of the build, possible values are "success" (default) and "failure"
+invoker.buildResult = failure
\ No newline at end of file
diff --git a/src/it/test-with-junit-failure/pom.xml b/src/it/test-with-junit-failure/pom.xml
new file mode 100644
index 0000000..7f03470
--- /dev/null
+++ b/src/it/test-with-junit-failure/pom.xml
@@ -0,0 +1,50 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>test-with-junit-failure</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>test-with-junit-failure</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <xmlEscapeOutput>false</xmlEscapeOutput>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/test-with-junit-failure/src/test/clojure/failing.clj b/src/it/test-with-junit-failure/src/test/clojure/failing.clj
new file mode 100644
index 0000000..4ec127e
--- /dev/null
+++ b/src/it/test-with-junit-failure/src/test/clojure/failing.clj
@@ -0,0 +1,8 @@
+(ns failing
+ (:use
+ clojure.test)
+ )
+
+(deftest atest
+ (is false "<>")
+ )
diff --git a/src/it/test-with-junit-failure/src/test/clojure/passing.clj b/src/it/test-with-junit-failure/src/test/clojure/passing.clj
new file mode 100644
index 0000000..c17b3cb
--- /dev/null
+++ b/src/it/test-with-junit-failure/src/test/clojure/passing.clj
@@ -0,0 +1,8 @@
+(ns passing
+ (:use
+ clojure.test)
+ )
+
+(deftest atest
+ (is (= 0 0))
+ )
diff --git a/src/it/test-with-junit-failure/verify.bsh b/src/it/test-with-junit-failure/verify.bsh
new file mode 100644
index 0000000..949e263
--- /dev/null
+++ b/src/it/test-with-junit-failure/verify.bsh
@@ -0,0 +1,51 @@
+import java.io.*;
+
+File file = new File( basedir, "target/test-reports/failing.xml" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated report: " + file );
+}
+Reader r = new BufferedReader(new FileReader(file));
+String line = r.readLine();
+if (!"<?xml version=\"1.0\" encoding=\"UTF-8\"?>".equals(line)) {
+ throw new RuntimeException("line 1 should be <?xml version=\"1.0\" encoding=\"UTF-8\"?> but was:" + line);
+}
+line = r.readLine();
+if (!"<testsuites>".equals(line)) {
+ throw new RuntimeException("line 2 should be <testsuites> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testsuite name=\"failing\">".equals(line)) {
+ throw new RuntimeException("line 3 should be <testsuite name=\"failing\"> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testcase name=\"atest\" classname=\"failing\">".equals(line)) {
+ throw new RuntimeException("line 4 should be [<testcase name=\"atest\" classname=\"failing\">] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<failure message=\"<>\"><>".equals(line)) {
+ throw new RuntimeException("line 5 should be [<failure message=\"<>\"><>" + line);
+}
+line = r.readLine().trim();
+if (!"expected: false".equals(line)) {
+ throw new RuntimeException("line 6 should be [expected: false] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"actual: false".equals(line)) {
+ throw new RuntimeException("line 7 should be [actual: false] but was:" + line);
+}
+line = r.readLine().trim();
+if (!(line.startsWith("at:") && line.endsWith("</failure>"))) {
+ throw new RuntimeException("line 8 should be [at: test.clj:344</failure>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testcase>".equals(line)) {
+ throw new RuntimeException("line 9 should be [</testcase>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testsuite>".equals(line)) {
+ throw new RuntimeException("line 10 should be [</testsuite>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testsuites>".equals(line)) {
+ throw new RuntimeException("line 11 should be [</testsuites>] but was:" + line);
+}
diff --git a/src/it/test-with-junit/goals.txt b/src/it/test-with-junit/goals.txt
new file mode 100644
index 0000000..3185b32
--- /dev/null
+++ b/src/it/test-with-junit/goals.txt
@@ -0,0 +1,3 @@
+clean clojure:compile clojure:test-with-junit
+
+
diff --git a/src/it/test-with-junit/pom.xml b/src/it/test-with-junit/pom.xml
new file mode 100644
index 0000000..d59b879
--- /dev/null
+++ b/src/it/test-with-junit/pom.xml
@@ -0,0 +1,50 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>test-with-junit</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>test-with-junit</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>clojure-releases</id>
+ <url>http://build.clojure.org/releases</url>
+ </repository>
+ <repository>
+ <id>clojars</id>
+ <url>http://clojars.org/repo/</url>
+ </repository>
+</repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <xmlEscapeOutput>false</xmlEscapeOutput>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/it/test-with-junit/src/test/clojure/succeeding.clj b/src/it/test-with-junit/src/test/clojure/succeeding.clj
new file mode 100644
index 0000000..8e93106
--- /dev/null
+++ b/src/it/test-with-junit/src/test/clojure/succeeding.clj
@@ -0,0 +1,8 @@
+(ns succeeding
+ (:use
+ clojure.test)
+ )
+
+(deftest atest
+ (is true)
+ )
diff --git a/src/it/test-with-junit/verify.bsh b/src/it/test-with-junit/verify.bsh
new file mode 100644
index 0000000..bdd1b96
--- /dev/null
+++ b/src/it/test-with-junit/verify.bsh
@@ -0,0 +1,35 @@
+import java.io.*;
+
+File file = new File( basedir, "target/test-reports/succeeding.xml" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated report: " + file );
+}
+Reader r = new BufferedReader(new FileReader(file));
+String line = r.readLine().trim();
+if (!"<?xml version=\"1.0\" encoding=\"UTF-8\"?>".equals(line)) {
+ throw new RuntimeException("line 1 should be <?xml version=\"1.0\" encoding=\"UTF-8\"?> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testsuites>".equals(line)) {
+ throw new RuntimeException("line 2 should be <testsuites> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testsuite name=\"succeeding\">".equals(line)) {
+ throw new RuntimeException("line 3 should be <testsuite name=\"succeeding\"> but was:" + line);
+}
+line = r.readLine().trim();
+if (!"<testcase name=\"atest\" classname=\"succeeding\">".equals(line)) {
+ throw new RuntimeException("line 4 should be [<testcase name=\"atest\" classname=\"succeeding\">] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testcase>".equals(line)) {
+ throw new RuntimeException("line 5 should be [</testcase>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testsuite>".equals(line)) {
+ throw new RuntimeException("line 6 should be [</testsuite>] but was:" + line);
+}
+line = r.readLine().trim();
+if (!"</testsuites>".equals(line)) {
+ throw new RuntimeException("line 7 should be [</testsuites>] but was:" + line);
+}
\ No newline at end of file
diff --git a/src/main/java/com/theoryinpractise/clojure/AbstractClojureCompilerMojo.java b/src/main/java/com/theoryinpractise/clojure/AbstractClojureCompilerMojo.java
new file mode 100644
index 0000000..cec6dc9
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/AbstractClojureCompilerMojo.java
@@ -0,0 +1,525 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.regex.Pattern;
+
+import com.google.common.base.Strings;
+import org.apache.commons.exec.CommandLine;
+import org.apache.commons.exec.DefaultExecutor;
+import org.apache.commons.exec.ExecuteException;
+import org.apache.commons.exec.ExecuteStreamHandler;
+import org.apache.commons.exec.Executor;
+import org.apache.commons.exec.PumpStreamHandler;
+import org.apache.commons.exec.ShutdownHookProcessDestroyer;
+import org.apache.commons.lang.SystemUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.toolchain.Toolchain;
+import org.apache.maven.toolchain.ToolchainManager;
+
+public abstract class AbstractClojureCompilerMojo extends AbstractMojo {
+
+ @Parameter(required = true, readonly = true, property = "project")
+ protected MavenProject project;
+
+ @Component
+ private ToolchainManager toolchainManager;
+
+ @Parameter(required = true, readonly = true, property = "session")
+ private MavenSession session;
+
+ @Parameter(required = true, readonly = true, property = "basedir")
+ protected File baseDirectory;
+
+ @Parameter(required = true, readonly = true, property = "project.compileClasspathElements")
+ protected List<String> classpathElements;
+
+ @Parameter(required = true, readonly = true, property = "project.testClasspathElements")
+ protected List<String> testClasspathElements;
+
+ @Parameter(required = true, property = "plugin.artifacts")
+ private java.util.List<Artifact> pluginArtifacts;
+
+ @Parameter(required = true, defaultValue = "${project.build.outputDirectory}")
+ protected File outputDirectory;
+
+ @Parameter(required = true, defaultValue = "${project.build.testOutputDirectory}")
+ protected File testOutputDirectory;
+
+ /**
+ * Location of the source files.
+ */
+ @Parameter
+ protected String[] sourceDirectories = new String[] {"src/main/clojure"};
+
+ /**
+ * Location of the source files.
+ */
+ @Parameter
+ protected String[] testSourceDirectories = new String[] {"src/test/clojure"};
+
+ /**
+ * Location of the source files.
+ */
+ @Parameter(required = true, defaultValue = "${project.build.testSourceDirectory}")
+ protected File baseTestSourceDirectory;
+
+ /**
+ * Location of the generated source files.
+ */
+ @Parameter(required = true, defaultValue = "${project.build.outputDirectory}/../generated-sources")
+ protected File generatedSourceDirectory;
+
+ /**
+ * Working directory for forked java clojure process.
+ */
+ @Parameter
+ protected File workingDirectory;
+
+ /**
+ * Should we compile all namespaces or only those defined?
+ */
+ @Parameter(defaultValue = "false")
+ protected boolean compileDeclaredNamespaceOnly;
+
+ /**
+ * A list of namespaces to compile
+ */
+ @Parameter
+ protected String[] namespaces;
+
+ /**
+ * Should we test all namespaces or only those defined?
+ */
+ @Parameter(defaultValue = "false")
+ protected boolean testDeclaredNamespaceOnly;
+
+ /**
+ * A list of test namespaces to compile
+ */
+ @Parameter
+ protected String[] testNamespaces;
+
+ /**
+ * Classes to put onto the command line before the main class
+ */
+ @Parameter
+ private List<String> prependClasses;
+
+ /**
+ * Clojure/Java command-line options
+ */
+ @Parameter(property = "clojure.options")
+ private String clojureOptions = "";
+
+ /**
+ * Run with test-classpath or compile-classpath?
+ */
+ @Parameter(property = "clojure.runwith.test", defaultValue = "true")
+ private boolean runWithTests;
+
+ /**
+ * Include plugin dependencies in classpath?
+ */
+ @Parameter(defaultValue = "false")
+ private boolean includePluginDependencies;
+
+ /**
+ * A list of namespaces whose source files will be copied to the output.
+ */
+ @Parameter
+ protected String[] copiedNamespaces;
+
+ /**
+ * Should we copy the source of all namespaces or only those defined?
+ */
+ @Parameter(defaultValue = "false")
+ protected boolean copyDeclaredNamespaceOnly;
+
+ /**
+ * Source file encoding
+ */
+ @Parameter(defaultValue = "${project.build.sourceEncoding}")
+ protected String charset;
+
+ /**
+ * Should the source files of all compiled namespaces be copied to the output?
+ * This overrides copiedNamespaces and copyDeclaredNamespaceOnly.
+ */
+ @Parameter(defaultValue = "false")
+ private boolean copyAllCompiledNamespaces;
+
+ /**
+ * Should reflective invocations in Clojure source emit warnings? Corresponds with
+ * the *warn-on-reflection* var and the clojure.compile.warn-on-reflection system property.
+ */
+ @Parameter(defaultValue = "false")
+ private boolean warnOnReflection;
+
+ /**
+ * Specify additional vmargs to use when running clojure or swank.
+ */
+ @Parameter(property = "clojure.vmargs")
+ private String vmargs;
+
+
+ /**
+ * Spawn a new console window for interactive clojure sessions on Windows
+ */
+ @Parameter(defaultValue = "true")
+ private boolean spawnInteractiveConsoleOnWindows;
+
+ /**
+ * Which Windows command to use when starting the REPL
+ */
+ @Parameter(defaultValue = "cmd /c start")
+ private String windowsConsole;
+
+ /**
+ * Escapes the given file path so that it's safe for inclusion in a
+ * Clojure string literal.
+ *
+ * @param directory directory path
+ * @param file file name
+ * @return escaped file path, ready for inclusion in a string literal
+ */
+ protected String escapeFilePath(String directory, String file) {
+ return escapeFilePath(new File(directory, file));
+ }
+
+ /**
+ * Escapes the given file path so that it's safe for inclusion in a
+ * Clojure string literal.
+ *
+ * @param file
+ * @return escaped file path, ready for inclusion in a string literal
+ */
+ protected String escapeFilePath(final File file) {
+ // TODO: Should handle also possible newlines, etc.
+ return file.getPath().replace("\\", "\\\\");
+ }
+
+ private String getJavaExecutable() throws MojoExecutionException {
+
+ Toolchain tc = toolchainManager.getToolchainFromBuildContext("jdk", //NOI18N
+ session);
+ if (tc != null) {
+ getLog().info("Toolchain in clojure-maven-plugin: " + tc);
+ String foundExecutable = tc.findTool("java");
+ if (foundExecutable != null) {
+ return foundExecutable;
+ } else {
+ throw new MojoExecutionException("Unable to find 'java' executable for toolchain: " + tc);
+ }
+ }
+
+ return "java";
+ }
+
+ protected File getWorkingDirectory() throws MojoExecutionException {
+ if (workingDirectory != null) {
+ if (workingDirectory.exists()) {
+ return workingDirectory;
+ } else {
+ throw new MojoExecutionException("Directory specified in <workingDirectory/> does not exists: " + workingDirectory.getPath());
+ }
+ } else {
+ return session.getCurrentProject().getBasedir();
+ }
+ }
+
+ protected File createTemporaryDirectory(String name) throws MojoExecutionException {
+ File temp;
+ try {
+ temp = File.createTempFile(name, ".dir");
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to create temporary output directory: " + e.getMessage());
+ }
+ temp.delete();
+ temp.mkdir();
+ return temp;
+ }
+
+ private File[] translatePaths(String[] paths) {
+ File[] files = new File[paths.length];
+ for (int i = 0; i < paths.length; i++) {
+ files[i] = new File(baseDirectory, paths[i]);
+ }
+ return files;
+ }
+
+ protected NamespaceInFile[] discoverNamespaces() throws MojoExecutionException {
+ return new NamespaceDiscovery(getLog(), outputDirectory, charset, compileDeclaredNamespaceOnly, false).discoverNamespacesIn(namespaces, translatePaths(sourceDirectories));
+ }
+
+ protected NamespaceInFile[] discoverNamespacesToCopy() throws MojoExecutionException {
+ if (copyAllCompiledNamespaces)
+ return discoverNamespaces();
+ else
+ return new NamespaceDiscovery(getLog(), outputDirectory, charset, copyDeclaredNamespaceOnly, false).discoverNamespacesIn(copiedNamespaces, translatePaths(sourceDirectories));
+ }
+
+ public enum SourceDirectory {
+ COMPILE, TEST
+ }
+
+ public File[] getSourceDirectories(SourceDirectory... sourceDirectoryTypes) {
+ List<File> dirs = new ArrayList<File>();
+
+ if (Arrays.asList(sourceDirectoryTypes).contains(SourceDirectory.COMPILE)) {
+ dirs.add(generatedSourceDirectory);
+ dirs.addAll(Arrays.asList(translatePaths(sourceDirectories)));
+ }
+ if (Arrays.asList(sourceDirectoryTypes).contains(SourceDirectory.TEST)) {
+ dirs.add(baseTestSourceDirectory);
+ dirs.addAll(Arrays.asList(translatePaths(testSourceDirectories)));
+ }
+
+ return dirs.toArray(new File[] {});
+
+ }
+
+ public List<String> getRunWithClasspathElements() {
+ Set<String> classPathElements = new HashSet<String>();
+ if (includePluginDependencies) {
+ for (Artifact artifact : pluginArtifacts) {
+ classPathElements.add(artifact.getFile().getPath());
+ }
+ }
+ classPathElements.addAll(runWithTests ? testClasspathElements : classpathElements);
+
+ return new ArrayList<String>(classPathElements);
+ }
+
+ protected void copyNamespaceSourceFilesToOutput(File outputDirectory, NamespaceInFile[] discoveredNamespaces) throws MojoExecutionException {
+ for (NamespaceInFile ns : discoveredNamespaces) {
+ File outputFile = new File(outputDirectory, ns.getFilename());
+ outputFile.getParentFile().mkdirs();
+ try {
+ FileInputStream is = new FileInputStream(ns.getSourceFile());
+ try {
+ FileOutputStream os = new FileOutputStream(outputFile);
+ try {
+ int amountRead;
+ byte[] buffer = new byte[4096];
+ while ((amountRead = is.read(buffer)) >= 0) {
+ os.write(buffer, 0, amountRead);
+ }
+ } finally {
+ os.close();
+ }
+ } finally {
+ is.close();
+ }
+ } catch (IOException ex) {
+ throw new MojoExecutionException("Couldn't copy the clojure source files to the output", ex);
+ }
+ }
+ }
+
+ protected void callClojureWith(
+ File[] sourceDirectory,
+ File outputDirectory,
+ List<String> compileClasspathElements,
+ String mainClass,
+ NamespaceInFile[] namespaceArgs) throws MojoExecutionException {
+ callClojureWith(ExecutionMode.BATCH, sourceDirectory, outputDirectory, compileClasspathElements, mainClass, namespaceArgs);
+ }
+
+ protected void callClojureWith(
+ File[] sourceDirectory,
+ File outputDirectory,
+ List<String> compileClasspathElements,
+ String mainClass,
+ String[] clojureArgs) throws MojoExecutionException {
+ callClojureWith(ExecutionMode.BATCH, sourceDirectory, outputDirectory, compileClasspathElements, mainClass, clojureArgs);
+ }
+
+ protected void callClojureWith(
+ ExecutionMode executionMode,
+ File[] sourceDirectory,
+ File outputDirectory,
+ List<String> compileClasspathElements,
+ String mainClass,
+ NamespaceInFile[] namespaceArgs) throws MojoExecutionException {
+ String[] stringArgs = new String[namespaceArgs.length];
+ for (int i = 0; i < namespaceArgs.length; i++) {
+ stringArgs[i] = namespaceArgs[i].getName();
+ }
+ callClojureWith(executionMode, sourceDirectory, outputDirectory, compileClasspathElements, mainClass, stringArgs);
+ }
+
+ protected void callClojureWith(
+ ExecutionMode executionMode,
+ File[] sourceDirectory,
+ File outputDirectory,
+ List<String> compileClasspathElements,
+ String mainClass,
+ String[] clojureArgs) throws MojoExecutionException {
+
+ outputDirectory.mkdirs();
+
+ String classpath = manifestClasspath(sourceDirectory, outputDirectory, compileClasspathElements);
+
+ final String javaExecutable = getJavaExecutable();
+ getLog().debug("Java exectuable used: " + javaExecutable);
+ getLog().debug("Clojure manifest classpath: " + classpath);
+ CommandLine cl = null;
+
+ if (ExecutionMode.INTERACTIVE == executionMode && SystemUtils.IS_OS_WINDOWS && spawnInteractiveConsoleOnWindows) {
+ Scanner sc = new Scanner(windowsConsole);
+ Pattern pattern = Pattern.compile("\"[^\"]*\"|'[^']*'|[\\w'/]+");
+ cl = new CommandLine(sc.findInLine(pattern));
+ String param;
+ while ((param = sc.findInLine(pattern)) != null) {
+ cl.addArgument(param);
+ }
+ cl.addArgument(javaExecutable);
+ } else {
+ cl = new CommandLine(javaExecutable);
+ }
+
+ if (vmargs != null) {
+ cl.addArguments(vmargs, false);
+ }
+
+ cl.addArgument("-Dclojure.compile.path=" + escapeFilePath(outputDirectory), false);
+
+ if (warnOnReflection) cl.addArgument("-Dclojure.compile.warn-on-reflection=true");
+
+ cl.addArguments(clojureOptions, false);
+
+ cl.addArgument("-jar");
+ File jar;
+ if (prependClasses != null && prependClasses.size() > 0) {
+ jar = createJar(classpath, prependClasses.get(0));
+ cl.addArgument(jar.getAbsolutePath(), false);
+ List<String> allButFirst = prependClasses.subList(1, prependClasses.size());
+ cl.addArguments(allButFirst.toArray(new String[allButFirst.size()]));
+ cl.addArgument(mainClass);
+ } else {
+ jar = createJar(classpath, mainClass);
+ cl.addArgument(jar.getAbsolutePath(), false);
+ }
+
+
+ if (clojureArgs != null) {
+ cl.addArguments(clojureArgs, false);
+ }
+
+ getLog().debug("Command line: " + cl.toString());
+
+ Executor exec = new DefaultExecutor();
+ Map<String, String> env = new HashMap<String, String>(System.getenv());
+// env.put("path", ";");
+// env.put("path", System.getProperty("java.home"));
+
+ ExecuteStreamHandler handler = new PumpStreamHandler(System.out, System.err, System.in);
+ exec.setStreamHandler(handler);
+ exec.setWorkingDirectory(getWorkingDirectory());
+ ShutdownHookProcessDestroyer destroyer = new ShutdownHookProcessDestroyer();
+ exec.setProcessDestroyer(destroyer);
+
+ int status;
+ try {
+ status = exec.execute(cl, env);
+ } catch (ExecuteException e) {
+ status = e.getExitValue();
+ } catch (IOException e) {
+ status = 1;
+ }
+
+ if (status != 0) {
+ throw new MojoExecutionException("Clojure failed.");
+ }
+
+ }
+
+ private String manifestClasspath(final File[] sourceDirectory, final File outputDirectory,
+ final List<String> compileClasspathElements) {
+ String cp = getPath(sourceDirectory);
+
+ cp = cp + outputDirectory.toURI() + " ";
+
+ for (String classpathElement : compileClasspathElements) {
+ cp = cp + new File(classpathElement).toURI() + " ";
+ }
+
+ cp = cp.replaceAll("\\s+", "\\ ");
+ return cp;
+ }
+
+ private String getPath(File[] sourceDirectory) {
+ String cp = "";
+ for (File directory : sourceDirectory) {
+ cp = cp + directory.toURI() + " ";
+ }
+ return cp;
+ }
+
+ private File createJar(final String cp, final String mainClass) {
+ try {
+ Manifest manifest = new Manifest();
+ manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ manifest.getMainAttributes().put(Attributes.Name.CLASS_PATH, cp);
+ manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, mainClass);
+ File tempFile = File.createTempFile("clojuremavenplugin", "jar");
+ tempFile.deleteOnExit();
+ JarOutputStream target = new JarOutputStream(new FileOutputStream(tempFile), manifest);
+ target.close();
+ return tempFile;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ protected boolean isExistingTestScriptFile(String path) {
+
+ if(!Strings.isNullOrEmpty(path)) {
+ File scriptFile = new File(path);
+ if (scriptFile.isAbsolute()) {
+ return scriptFile.exists();
+ } else {
+ return new File(baseDirectory, path).exists();
+ }
+ }
+
+ return false;
+ }
+
+ protected boolean isClasspathResource(String path) {
+ return !Strings.isNullOrEmpty(path) && path.startsWith("@");
+ }
+
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureAddSourceMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureAddSourceMojo.java
new file mode 100644
index 0000000..0545ee2
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureAddSourceMojo.java
@@ -0,0 +1,20 @@
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+import java.io.File;
+
+/**
+ * Add Clojure source directories to the POM
+ */
+ at Mojo(name = "add-source", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
+public class ClojureAddSourceMojo extends AbstractClojureCompilerMojo {
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ for (File file : this.getSourceDirectories(SourceDirectory.COMPILE)) {
+ this.project.addCompileSourceRoot(file.getAbsolutePath());
+ }
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureAddTestSourceMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureAddTestSourceMojo.java
new file mode 100644
index 0000000..163e0cd
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureAddTestSourceMojo.java
@@ -0,0 +1,20 @@
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+import java.io.File;
+
+/**
+ * Add Clojure test source directories to the POM
+ */
+ at Mojo(name = "add-test-source", defaultPhase = LifecyclePhase.GENERATE_TEST_SOURCES)
+public class ClojureAddTestSourceMojo extends AbstractClojureCompilerMojo {
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ for (File file : this.getSourceDirectories(SourceDirectory.TEST)) {
+ this.project.addTestCompileSourceRoot(file.getAbsolutePath());
+ }
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureAutodocMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureAutodocMojo.java
new file mode 100644
index 0000000..bbd6cac
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureAutodocMojo.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+
+ at Mojo(name = "autodoc", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureAutodocMojo extends AbstractClojureCompilerMojo {
+
+ @Parameter(property = "project.name")
+ private String projectName;
+
+ @Parameter(property = "project.description")
+ private String projectDescription;
+
+ @Parameter(property = "project.build.directory")
+ private String projectBuildDir;
+
+ @Parameter(defaultValue = "${project.build.directory}/autodoc")
+ private String autodocTargetDirectory;
+
+ @Parameter
+ private Map<String, String> autodoc;
+
+ public void execute() throws MojoExecutionException {
+ Map<String, String> effectiveProps = new HashMap<String, String>();
+ effectiveProps.put("name", projectName);
+ effectiveProps.put("description", projectDescription);
+ effectiveProps.put("param-dir", "src/main/autodoc");
+ effectiveProps.put("root", ".");
+ effectiveProps.put("source-path", sourceDirectories[0]);
+ effectiveProps.put("output-path", new File(autodocTargetDirectory).getAbsolutePath());
+ effectiveProps.put("page-title", projectName);
+
+ // Not implemented with defaults:
+ //effectiveProps.put("web-src-dir", "");
+ //effectiveProps.put("external-doc-tmpdir", "");
+ //effectiveProps.put("load-classpath", "");
+ //effectiveProps.put("load-jar-dirs", "");
+ //effectiveProps.put("namespaces-to-document", "");
+ //effectiveProps.put("trim-prefix", "");
+ //effectiveProps.put("load-except-list", "");
+ //effectiveProps.put("copyright", null);
+
+ if (autodoc != null) {
+ effectiveProps.putAll(autodoc);
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("(use 'autodoc.autodoc)\n");
+ sb.append("(autodoc {\n");
+ for (Map.Entry<String, String> entry : effectiveProps.entrySet()) {
+ String key = entry.getKey();
+ String value = entry.getValue();
+ sb.append(" :" + key);
+ if (value != null) {
+ // TODO: Handle possible newlines, etc.
+ sb.append(" \"" + value.replace("\\", "\\\\") + "\"");
+ } else {
+ sb.append(" nil");
+ }
+ sb.append("\n");
+ }
+ sb.append("})\n");
+
+ try {
+ File autodocClj = File.createTempFile("autodoc", ".clj");
+ final PrintWriter pw = new PrintWriter(autodocClj);
+ pw.print(sb.toString());
+ pw.close();
+
+ getLog().info("Generating docs to " + effectiveProps.get("output-path") + " with " + autodocClj.getPath());
+ getLog().debug(sb.toString());
+
+ callClojureWith(
+ getSourceDirectories(SourceDirectory.COMPILE, SourceDirectory.TEST),
+ outputDirectory, testClasspathElements, "clojure.main",
+ new String[]{autodocClj.getPath()});
+
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureCompilerMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureCompilerMojo.java
new file mode 100644
index 0000000..348012a
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureCompilerMojo.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+
+ at Mojo(name = "compile", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE)
+public class ClojureCompilerMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * Should the compile phase create a temporary output directory for .class files?
+ */
+ @Parameter(required = true, defaultValue = "false")
+ protected Boolean temporaryOutputDirectory;
+
+ public void execute() throws MojoExecutionException {
+
+ File outputPath = (temporaryOutputDirectory)
+ ? createTemporaryDirectory("classes")
+ : outputDirectory;
+
+ getLog().debug("Compiling clojure sources to " + outputPath.getPath());
+
+ callClojureWith(
+ getSourceDirectories(SourceDirectory.COMPILE),
+ outputPath, classpathElements, "clojure.lang.Compile",
+ discoverNamespaces());
+
+ copyNamespaceSourceFilesToOutput(outputDirectory, discoverNamespacesToCopy());
+ }
+
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureGenDocMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureGenDocMojo.java
new file mode 100644
index 0000000..461dec2
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureGenDocMojo.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+ at Mojo(name = "gendoc", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureGenDocMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * Should we compile all namespaces or only those defined?
+ */
+ @Parameter(defaultValue = "false")
+ private boolean generateTestDocumentation;
+
+ public void execute() throws MojoExecutionException {
+ File genDocClj;
+ File docsDir;
+ try {
+ genDocClj = File.createTempFile("generate-docs", ".clj");
+ if (!outputDirectory.getParentFile().exists()) {
+ outputDirectory.getParentFile().mkdir();
+ }
+ docsDir = new File(outputDirectory.getParentFile(), "clojure");
+ getLog().debug("Creating documentation directory " + docsDir.getPath());
+ docsDir.mkdir();
+ System.out.println(docsDir.getPath() + " exists " + docsDir.exists());
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage());
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("(use 'clojure.contrib.gen-html-docs)\n");
+ sb.append("(generate-documentation-to-file \n");
+ int count = 0;
+ sb.append(" \"").append(docsDir.getPath().replace('\\', '/')).append("/index.html\"\n");
+ sb.append(" [");
+
+ final NamespaceInFile[] allNamespaces = new NamespaceDiscovery(getLog(), outputDirectory, charset, compileDeclaredNamespaceOnly)
+ .discoverNamespacesIn(namespaces, getSourceDirectories(SourceDirectory.COMPILE, SourceDirectory.TEST));
+
+ for (NamespaceInFile namespace : allNamespaces) {
+ sb.append("'").append(namespace.getName());
+ if (count++ < allNamespaces.length - 1) {
+ sb.append("\n ");
+ }
+ }
+ sb.append("])\n");
+ try {
+ final PrintWriter pw = new PrintWriter(genDocClj);
+ pw.print(sb.toString());
+ pw.close();
+ getLog().info("Generating docs to " + docsDir.getCanonicalPath() + " with " + genDocClj.getPath());
+ getLog().debug(sb.toString());
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage());
+ }
+
+ callClojureWith(
+ getSourceDirectories(SourceDirectory.COMPILE, SourceDirectory.TEST),
+ outputDirectory, testClasspathElements, "clojure.main",
+ new String[]{genDocClj.getPath()});
+ }
+
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureMarginaliaMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureMarginaliaMojo.java
new file mode 100644
index 0000000..a6b4c4b
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureMarginaliaMojo.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+
+/**
+ * Mojo for running Marginalia. Allows configuration of the source list
+ * and target directory.
+ */
+ at Mojo(name = "marginalia", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureMarginaliaMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * The Maven Project.
+ */
+ @Parameter(readonly = true, required = true, property = "project")
+ private MavenProject project = null;
+
+ @Parameter(property = "project.name")
+ private String projectName;
+
+ @Parameter(property = "project.version")
+ private String projectVersion;
+
+ @Parameter(property = "project.description")
+ private String projectDescription;
+
+ @Parameter(property = "project.build.directory")
+ private String projectBuildDir;
+
+ /**
+ * Location of the source files.
+ */
+ @Parameter
+ private String[] marginaliaSourceDirectories;
+
+ /**
+ * Location of the output files.
+ */
+ @Parameter(defaultValue = "${project.build.directory}/marginalia")
+ private String marginaliaTargetDirectory;
+
+ @Parameter
+ private Map<String, String> marginalia;
+
+ private Set<Artifact> filterScope(Set<Artifact> artifacts, String scope) {
+ Vector to_remove = new Vector();
+ for (Artifact artifact : artifacts) {
+ if (artifact.getScope() != scope)
+ to_remove.add(artifact);
+ }
+ artifacts.removeAll(to_remove);
+ return artifacts;
+ }
+
+
+ private String quote(String s) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("\"");
+ sb.append(s);
+ sb.append("\"");
+ return sb.toString();
+ }
+
+ private String formatDependencies(Set<Artifact> artifacts) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[\n");
+
+ for (Artifact artifact : artifacts) {
+ sb.append("[\"");
+ sb.append(artifact.getGroupId());
+ sb.append("/");
+ sb.append(artifact.getArtifactId());
+ sb.append("\" \"");
+ sb.append(artifact.getVersion());
+ sb.append("\"]\n");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+
+ private String formatMap(Map<String, String> map) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("{\n");
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ String key = entry.getKey();
+ String value = entry.getValue();
+ sb.append(" :" + key + " ");
+ if (value != null) {
+ sb.append(value);
+ } else {
+ sb.append("nil");
+ }
+ sb.append("\n");
+ }
+ sb.append("}\n");
+
+ return sb.toString();
+ }
+
+ public void execute() throws MojoExecutionException {
+ // Build a project info map
+ Map<String, String> effectiveProps = new HashMap<String, String>();
+ effectiveProps.put("name", quote(projectName));
+ effectiveProps.put("version", quote(projectVersion));
+ effectiveProps.put("description", quote(projectDescription));
+ effectiveProps.put("dependencies",
+ formatDependencies(
+ filterScope(
+ project.getDependencyArtifacts(),
+ Artifact.SCOPE_COMPILE)));
+ effectiveProps.put("dev-dependencies",
+ formatDependencies(
+ filterScope(
+ project.getDependencyArtifacts(),
+ Artifact.SCOPE_TEST)));
+
+ if (marginalia != null) {
+ effectiveProps.put("marginalia", formatMap(marginalia));
+ }
+
+ boolean multiDoc = ( marginalia == null ? false : ("true".equals(marginalia.get("multi"))) );
+
+ // Build the script to run marginalia
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("(use `marginalia.core '[marginalia.html :only (*resources*)])\n");
+ // fix per https://github.com/fogus/marginalia/issues/43
+ sb.append("(binding [*resources* \"\"]\n");
+
+ sb.append("(ensure-directory! \"");
+ sb.append(marginaliaTargetDirectory);
+ sb.append("\")\n");
+
+ sb.append( multiDoc ? "(multidoc!\n" : "(uberdoc!\n" );
+
+ // Create the output destination
+ sb.append(" \"");
+ sb.append(marginaliaTargetDirectory);
+ if ( !multiDoc ) sb.append("/uberdoc.html");
+ sb.append("\"\n");
+
+ // Create the list of sources to process
+ sb.append(" (format-sources [");
+
+ // Append the explicit marginalia source paths, or project source paths
+ for (String entry : (marginaliaSourceDirectories != null
+ && marginaliaSourceDirectories.length > 0 ?
+ marginaliaSourceDirectories : sourceDirectories)) {
+ sb.append("\"");
+ sb.append(baseDirectory);
+ sb.append("/");
+ sb.append(entry);
+ sb.append("\" ");
+ }
+ sb.append("])\n");
+
+ // and the project map
+ sb.append(formatMap(effectiveProps));
+ sb.append(")\n");
+ sb.append(")\n");
+
+ // Run it
+ try {
+ File marginaliaClj = File.createTempFile("marginalia", ".clj");
+ final PrintWriter pw = new PrintWriter(marginaliaClj);
+ pw.print(sb.toString());
+ pw.close();
+
+ getLog().info("Generating marginalia docs");
+ getLog().debug(sb.toString());
+
+ callClojureWith(
+ getSourceDirectories(SourceDirectory.COMPILE, SourceDirectory.TEST),
+ outputDirectory, testClasspathElements, "clojure.main",
+ new String[]{marginaliaClj.getPath()});
+
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureNReplMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureNReplMojo.java
new file mode 100644
index 0000000..baa8757
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureNReplMojo.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.commons.lang.SystemUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+ at Mojo(name = "nrepl", requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureNReplMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * The clojure script to preceding the switch to the repl
+ */
+ @Parameter
+ private String replScript;
+
+ @Parameter(defaultValue = "4005", property = "clojure.nrepl.port")
+ protected int port;
+
+ @Parameter(defaultValue = "localhost", property = "clojure.nrepl.host")
+ protected String nreplHost;
+
+ public void execute() throws MojoExecutionException {
+ StringBuilder sb = new StringBuilder();
+ sb.append("(do ");
+ sb.append("(clojure.tools.nrepl.server/start-server");
+ sb.append(" :bind \"").append(nreplHost).append("\"");
+ sb.append(" :port ");
+ sb.append(Integer.toString(port));
+ sb.append("))");
+ String nreplLoader = sb.toString();
+
+ if (SystemUtils.IS_OS_WINDOWS) {
+ nreplLoader = windowsEscapeCommandLineArg(nreplLoader);
+ }
+
+ List<String> args = new ArrayList<String>();
+ if (replScript != null && new File(replScript).exists()) {
+ args.add("-i");
+ args.add(replScript);
+ }
+
+ args.add("-e");
+ args.add("(require (quote clojure.tools.nrepl.server))");
+ args.add("-e");
+ args.add(nreplLoader);
+
+ callClojureWith(
+ getSourceDirectories(SourceDirectory.TEST, SourceDirectory.COMPILE),
+ outputDirectory, getRunWithClasspathElements(), "clojure.main",
+ args.toArray(new String[args.size()]));
+
+ }
+
+ private String windowsEscapeCommandLineArg(String arg) {
+ return "\"" + arg.replace("\"", "\\\"") + "\"";
+ }
+
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureNailgunMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureNailgunMojo.java
new file mode 100644
index 0000000..707b4ec
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureNailgunMojo.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+ * Mojo to start a clojure REPL running vimclojure's nailgun.
+ */
+ at Mojo(name = "nailgun", defaultPhase = LifecyclePhase.TEST_COMPILE, requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureNailgunMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * The clojure script to preceding the switch to the repl
+ */
+ @Parameter
+ private String replScript;
+
+ @Parameter(defaultValue = "2113", property = "clojure.nailgun.port")
+ protected int port;
+
+ /**
+ * pre vimclojure 2.2.0: com.martiansoftware.nailgun.NGServer
+ */
+ @Parameter(defaultValue = "vimclojure.nailgun.NGServer", property = "clojure.nailgun.server")
+ protected String server;
+
+ public void execute() throws MojoExecutionException {
+
+ String[] args = new String[]{Integer.toString(port)};
+ callClojureWith(getSourceDirectories(SourceDirectory.TEST, SourceDirectory.COMPILE),
+ outputDirectory,
+ getRunWithClasspathElements(),
+ server, args);
+ }
+
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureReplMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureReplMojo.java
new file mode 100644
index 0000000..54fa852
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureReplMojo.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Mojo to start a clojure repl
+ */
+ at Mojo(name = "repl", defaultPhase = LifecyclePhase.TEST_COMPILE, requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureReplMojo extends AbstractClojureCompilerMojo {
+
+ private static final String REPLY_REPLY_MAIN = "reply.ReplyMain";
+ /**
+ * The clojure script to preceding the switch to the repl
+ */
+ @Parameter
+ private String replScript;
+
+ private static final Pattern JLINE = Pattern.compile("^.*/jline-[^/]+.jar$");
+ private static final Pattern ICLOJURE = Pattern.compile("^.*/iclojure(-[^/]+)?.jar$");
+ private static final Pattern REPLY = Pattern.compile("^.*/reply(-[^/]+)?.jar$");
+
+ boolean isJLineAvailable(List<String> elements) {
+ return isPatternFoundInClasspath(elements, JLINE);
+ }
+
+ boolean isIClojureAvailable(List<String> elements) {
+ return isPatternFoundInClasspath(elements, ICLOJURE);
+ }
+
+ boolean isReplyAvailable(List<String> elements) {
+ return isPatternFoundInClasspath(elements, REPLY);
+ }
+
+ private boolean isPatternFoundInClasspath(List<String> elements, Pattern pattern) {
+ if (elements != null) {
+ for (String e : elements) {
+ Matcher m = pattern.matcher(new File(e).toURI().toString());
+ if (m.matches())
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void execute() throws MojoExecutionException {
+
+ List<String> args = new ArrayList<String>();
+ String mainClass = "clojure.main";
+
+ if (isIClojureAvailable(classpathElements)) {
+ mainClass = "com.offbytwo.iclojure.Main";
+ } else if (isReplyAvailable(classpathElements)) {
+ mainClass = REPLY_REPLY_MAIN;
+ } else if (isJLineAvailable(classpathElements)) {
+ getLog().info("Enabling JLine support");
+ args.add("clojure.main");
+ mainClass = "jline.ConsoleRunner";
+ }
+
+ if (replScript != null && new File(replScript).exists()) {
+ args.add("-i");
+ args.add(replScript);
+ if (!mainClass.equals(REPLY_REPLY_MAIN)) {
+ args.add("-r");
+ }
+ }
+
+ callClojureWith(
+ ExecutionMode.INTERACTIVE,
+ getSourceDirectories(SourceDirectory.TEST, SourceDirectory.COMPILE),
+ outputDirectory, getRunWithClasspathElements(), mainClass,
+ args.toArray(new String[args.size()]));
+ }
+
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureRunMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureRunMojo.java
new file mode 100644
index 0000000..3897fa2
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureRunMojo.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+ at Mojo(name = "run", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
+public class ClojureRunMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * The main clojure script to run
+ */
+ @Parameter(property = "clojure.script")
+ private String script;
+
+ /**
+ * Additional scripts to run
+ */
+ @Parameter
+ private String[] scripts;
+
+ /**
+ * The fully qualified name of the main class to run. This main class is intended
+ * to be one generated by :gen-class, although any Java class with a standard main()
+ * function will do.
+ */
+ @Parameter(property = "clojure.mainClass")
+ private String mainClass;
+
+ /**
+ * args specified on the command line.
+ */
+ @Parameter(property = "clojure.args")
+ private String args;
+
+ /**
+ * Returns either a path to a temp file that loads all of the provided scripts,
+ * or simply returns the singular <code>script</code> String (which therefore allows
+ * for @ classpath-loading paths to be passed in as a script).
+ * <p/>
+ * If multiple scripts are defined, they must all exist; otherwise an exception is thrown.
+ */
+ private static String mergeScripts(String script, String[] scripts) throws MojoExecutionException {
+ if (script == null || script.trim().equals("")) {
+ throw new MojoExecutionException("<script> is undefined");
+ }
+ if (scripts == null) {
+ return script;
+ } else if (scripts.length == 0) {
+ throw new MojoExecutionException("<scripts> is defined but has no <script> entries");
+ }
+
+ List<String> paths = new ArrayList<String>();
+ paths.add(script);
+
+ paths.addAll(Arrays.asList(scripts));
+ for (String scriptFile : paths) {
+ if (scriptFile == null || scriptFile.trim().equals("")) {
+ throw new MojoExecutionException("<script> entry cannot be empty");
+ }
+ if (!(new File(scriptFile).exists())) {
+ throw new MojoExecutionException(scriptFile + " cannot be found");
+ }
+ }
+
+ try {
+ File testFile = File.createTempFile("run", ".clj");
+ final FileWriter writer = new FileWriter(testFile);
+
+ for (String scriptFile : paths) {
+ writer.write("(load-file \"" + scriptFile + "\")");
+ writer.write(System.getProperty("line.separator"));
+ }
+ writer.close();
+ return testFile.getPath();
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+
+ public void execute() throws MojoExecutionException {
+ if (script != null && mainClass != null) {
+ throw new MojoExecutionException("Specify either 'script' or 'mainClass - not both.");
+ }
+ if (script == null && mainClass == null) {
+ throw new MojoExecutionException("Specify either 'script' or 'mainClass'.");
+ }
+
+ try {
+ if (script != null) {
+ String path = mergeScripts(script, scripts);
+
+ List<String> clojureArguments = new ArrayList<String>();
+ clojureArguments.add(path);
+
+ if (args != null) {
+ clojureArguments.addAll(Arrays.asList(args.split(" ")));
+ }
+
+ getLog().debug("Running clojure:run against " + path);
+
+ callClojureWith(
+ getSourceDirectories(SourceDirectory.COMPILE),
+ outputDirectory, getRunWithClasspathElements(), "clojure.main",
+ clojureArguments.toArray(new String[clojureArguments.size()]));
+ } else if (mainClass != null) {
+ callClojureWith(
+ getSourceDirectories(SourceDirectory.COMPILE),
+ outputDirectory, getRunWithClasspathElements(), mainClass,
+ args == null ? new String[0] : args.split(" "));
+ }
+ } catch (MojoExecutionException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureRunTestMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureRunTestMojo.java
new file mode 100644
index 0000000..a77e68a
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureRunTestMojo.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.util.Properties;
+
+ at Mojo(name = "test", defaultPhase = LifecyclePhase.TEST, requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureRunTestMojo extends ClojureRunTestWithJUnitMojo {
+ /**
+ * Whether to produce junit output or not
+ *
+ * @noinspection UnusedDeclaration
+ */
+ @Parameter(defaultValue = "false", property = "clojure.junitOutput")
+ private boolean junitOutput;
+
+ protected Properties getProps(NamespaceInFile[] ns) {
+ Properties props = super.getProps(ns);
+ props.put("junit", String.valueOf(junitOutput));
+ return props;
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureRunTestWithJUnitMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureRunTestWithJUnitMojo.java
new file mode 100644
index 0000000..a793113
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureRunTestWithJUnitMojo.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import static org.apache.commons.io.IOUtils.copy;
+
+ at Mojo(name = "test-with-junit", defaultPhase = LifecyclePhase.TEST, requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureRunTestWithJUnitMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * Flag to allow test compiliation to be skipped.
+ *
+ * @noinspection UnusedDeclaration
+ */
+ @Parameter(required = true, property = "maven.test.skip", defaultValue = "false")
+ private boolean skip;
+
+ /**
+ * Flag to allow test execution to be skipped.
+ *
+ * @noinspection UnusedDeclaration
+ */
+ @Parameter(required = true, property = "skipTests", defaultValue = "false")
+ private boolean skipTests;
+
+ /**
+ * The main clojure script to run
+ *
+ * @noinspection UnusedDeclaration
+ */
+ @Parameter
+ private String testScript;
+
+ /**
+ * Output directory for test results
+ *
+ * @noinspection UnusedDeclaration
+ */
+ @Parameter(defaultValue = "${project.build.directory}/test-reports", property = "clojure.testOutputDirectory")
+ private String testOutputDirectory;
+
+ /**
+ * Whether to XML escape non-report output sent to *out*
+ *
+ * @noinspection UnusedDeclaration
+ */
+ @Parameter(defaultValue = "true", property = "clojure.xmlEscapeOutput")
+ private boolean xmlEscapeOutput;
+
+ /**
+ * Provide a comma separated list of tests to run, instead of trying to run all of the test.
+ */
+ @Parameter(property = "test")
+ private String test;
+
+ public void execute() throws MojoExecutionException {
+ if (skip || skipTests) {
+ getLog().info("Test execution is skipped");
+ } else {
+ try {
+ final File[] testSourceDirectories = getSourceDirectories(SourceDirectory.TEST);
+ final File[] allSourceDirectories = getSourceDirectories(SourceDirectory.TEST, SourceDirectory.COMPILE);
+ final File outputFile = new File(testOutputDirectory);
+ NamespaceInFile[] ns = new NamespaceDiscovery(getLog(), outputFile, charset, testDeclaredNamespaceOnly).discoverNamespacesIn(testNamespaces, testSourceDirectories);
+ if (test != null) {
+ ArrayList<NamespaceInFile> filteredNS = new ArrayList<NamespaceInFile>();
+ String[] patterns = test.split("\\s*,\\s*");
+ for (NamespaceInFile nsinf: ns) {
+ for ( String pattern: patterns) {
+ if (nsinf.getName().contains(pattern)) {
+ filteredNS.add(nsinf);
+ break;
+ }
+ }
+ }
+ ns = filteredNS.toArray(new NamespaceInFile[filteredNS.size()]);
+ }
+ File confFile = File.createTempFile("run-test", ".txt");
+ confFile.deleteOnExit();
+ final PrintWriter confWriter = new PrintWriter(new FileWriter(confFile));
+ generateConfig(confWriter, ns);
+ confWriter.close();
+ String testConf = confFile.getPath();
+
+ // if the test script is supposed to be found on the classpath, skip all file checking
+ if (!isClasspathResource(testScript)) {
+ if (!isExistingTestScriptFile(testScript)) {
+ // Generate test script
+ outputFile.mkdir();
+
+ File testFile = File.createTempFile("run-test", ".clj");
+ testFile.deleteOnExit();
+ final PrintWriter writer = new PrintWriter(new FileWriter(testFile));
+
+ generateTestScript(writer);
+
+ writer.close();
+
+ testScript = testFile.getPath();
+
+ } else {
+ File testFile = new File(testScript);
+
+ if (!testFile.exists()) {
+ testFile = new File(getWorkingDirectory(), testScript);
+ }
+
+ if (!(testFile.exists())) {
+ throw new MojoExecutionException("testScript " + testFile.getPath() + " does not exist.");
+ }
+ }
+ }
+
+ getLog().debug("Running clojure:test-with-junit against " + testScript);
+ callClojureWith(allSourceDirectories, outputDirectory, testClasspathElements, "clojure.main", new String[] {testScript, testConf});
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ }
+ }
+
+ protected void generateConfig(PrintWriter writer, NamespaceInFile[] ns) throws IOException {
+ Properties props = getProps(ns);
+ props.store(writer,"Test Run Properties");
+ }
+
+ protected Properties getProps(NamespaceInFile[] ns) {
+ Properties props = new Properties();
+ for(int i = 0; i < ns.length; i++) {
+ props.put("ns."+i, ns[i].getName());
+ }
+ props.put("junit", "True");
+ props.put("outputDir", testOutputDirectory);
+ props.put("xmlEscape", String.valueOf(xmlEscapeOutput));
+ return props;
+ }
+
+ private void generateTestScript(PrintWriter writer) throws IOException {
+ copy(ClojureRunTestWithJUnitMojo.class.getResourceAsStream("/default_test_script.clj"), writer);
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java b/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java
new file mode 100644
index 0000000..12ef3a0
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ClojureSwankMojo.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.commons.lang.SystemUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+ at Mojo(name = "swank", requiresDependencyResolution = ResolutionScope.TEST)
+public class ClojureSwankMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * The clojure script to preceding the switch to the repl
+ */
+ @Parameter
+ private String replScript;
+
+ @Parameter(defaultValue = "4005", property = "clojure.swank.port")
+ protected int port;
+
+ @Parameter(defaultValue = "2009-09-14", property = "clojure.swank.protocolVersion")
+ protected String protocolVersion;
+
+ @Parameter(defaultValue = "iso-8859-1", property = "clojure.swank.encoding")
+ protected String encoding;
+
+ @Parameter(defaultValue = "localhost", property = "clojure.swank.host")
+ protected String swankHost;
+
+ public void execute() throws MojoExecutionException {
+ StringBuilder sb = new StringBuilder();
+ sb.append("(do ");
+ sb.append("(swank.swank/start-server");
+ sb.append(" :host \"").append(swankHost).append("\"");
+ sb.append(" :port ");
+ sb.append(Integer.toString(port));
+ sb.append(" :encoding \"").append(encoding).append("\"");
+ sb.append(" :dont-close true");
+ sb.append("))");
+ String swankLoader = sb.toString();
+
+ if (SystemUtils.IS_OS_WINDOWS) {
+ swankLoader = windowsEscapeCommandLineArg(swankLoader);
+ }
+
+ List<String> args = new ArrayList<String>();
+ if (replScript != null && new File(replScript).exists()) {
+ args.add("-i");
+ args.add(replScript);
+ }
+
+ args.add("-e");
+ args.add("(require (quote swank.swank))");
+ args.add("-e");
+ args.add(swankLoader);
+
+ callClojureWith(
+ getSourceDirectories(SourceDirectory.TEST, SourceDirectory.COMPILE),
+ outputDirectory, getRunWithClasspathElements(), "clojure.main",
+ args.toArray(new String[args.size()]));
+
+ }
+
+ private String windowsEscapeCommandLineArg(String arg) {
+ return "\"" + arg.replace("\"", "\\\"") + "\"";
+ }
+
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/ExecutionMode.java b/src/main/java/com/theoryinpractise/clojure/ExecutionMode.java
new file mode 100644
index 0000000..5d55984
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/ExecutionMode.java
@@ -0,0 +1,6 @@
+package com.theoryinpractise.clojure;
+
+public enum ExecutionMode {
+ INTERACTIVE,
+ BATCH
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/NamespaceDiscovery.java b/src/main/java/com/theoryinpractise/clojure/NamespaceDiscovery.java
new file mode 100644
index 0000000..928500f
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/NamespaceDiscovery.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
+import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
+import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
+import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
+import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Scanner;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class NamespaceDiscovery {
+
+ private static final String TEMPORARY_FILES_REGEXP = "^(\\.|#).*";
+
+ private final Pattern nsPattern = Pattern.compile("^\\s*\\(\\s*ns(\\s.*|$)");
+ private Log log;
+ private boolean compileDeclaredNamespaceOnly;
+ private File targetPath;
+ private boolean includeStale;
+ private String charset;
+
+ public NamespaceDiscovery(Log log, File targetPath, String charset, boolean compileDeclaredNamespaceOnly) {
+ this(log, targetPath, charset, compileDeclaredNamespaceOnly, true);
+ }
+
+ public NamespaceDiscovery(Log log, File targetPath, String charset, boolean compileDeclaredNamespaceOnly, boolean includeStale) {
+ this.log = log;
+ this.targetPath = targetPath;
+ this.compileDeclaredNamespaceOnly = compileDeclaredNamespaceOnly;
+ this.includeStale = includeStale;
+ this.charset = charset;
+ }
+
+ /**
+ * Discover namespaces in a list of source directories filtered by a list of namespace regexs
+ *
+ * @param namespaceFilterRegexs
+ * @param paths
+ * @return
+ * @throws FileNotFoundException
+ */
+ public NamespaceInFile[] discoverNamespacesIn(String[] namespaceFilterRegexs, File... paths) throws MojoExecutionException {
+
+ if (namespaceFilterRegexs == null || namespaceFilterRegexs.length == 0) {
+ namespaceFilterRegexs = new String[]{".*"};
+ }
+
+ Set<NamespaceInFile> namespaces = new HashSet<NamespaceInFile>();
+
+ for (NamespaceInFile namespace : discoverNamespacesInPath(paths)) {
+
+ boolean toAdd = !compileDeclaredNamespaceOnly;
+ for (String regex : namespaceFilterRegexs) {
+
+ if (regex.startsWith("!")) {
+ // exclude regex
+ if (Pattern.compile("^" + regex.substring(1)).matcher(namespace.getName()).matches()) {
+ toAdd = false;
+ break;
+ }
+
+ } else {
+ // include regex
+ if (Pattern.compile("^" + regex).matcher(namespace.getName()).matches()) {
+ toAdd = true;
+ }
+ }
+ }
+
+ if (toAdd) {
+ namespaces.add(namespace);
+ } else if (log.isDebugEnabled()) {
+ log.debug("Filtered namespace " + namespace.getName() + " from clojure build.");
+ }
+ }
+ return namespaces.toArray(new NamespaceInFile[]{});
+
+ }
+
+ public List<NamespaceInFile> discoverNamespacesInPath(File... paths) throws MojoExecutionException {
+
+ List<NamespaceInFile> namespaces = new ArrayList<NamespaceInFile>();
+ for (File path : paths) {
+ namespaces.addAll(discoverNamespacesIn(path));
+ }
+ return namespaces;
+ }
+
+ public List<NamespaceInFile> discoverNamespacesIn(File basePath) throws MojoExecutionException {
+
+ if (!basePath.exists()) return Collections.EMPTY_LIST;
+
+ SourceInclusionScanner scanner = getSourceInclusionScanner(includeStale);
+
+ scanner.addSourceMapping(new SuffixMapping(".clj", new HashSet(Arrays.asList(".clj", "__init.class"))));
+ scanner.addSourceMapping(new SuffixMapping(".cljc", new HashSet(Arrays.asList(".cljc", "__init.class"))));
+
+ final Set<File> sourceFiles;
+
+ try {
+ sourceFiles = scanner.getIncludedSources(basePath, targetPath);
+ } catch (InclusionScanException e) {
+ throw new MojoExecutionException("Error scanning source path: \'" + basePath.getPath() + "\' " + "for files to recompile.", e);
+ }
+
+ List<NamespaceInFile> namespaces = new ArrayList<NamespaceInFile>();
+ for (File file : sourceFiles) {
+ if (!file.getName().matches(TEMPORARY_FILES_REGEXP)) {
+ namespaces.addAll(findNamespaceInFile(basePath, file));
+ }
+ }
+
+ return namespaces;
+ }
+
+ protected SourceInclusionScanner getSourceInclusionScanner(boolean includeStale) {
+ return includeStale
+ ? new SimpleSourceInclusionScanner(Collections.singleton("**/*"), Collections.EMPTY_SET)
+ : new StaleSourceScanner(1024);
+ }
+
+ private List<NamespaceInFile> findNamespaceInFile(File path, File file) throws MojoExecutionException {
+
+ List<NamespaceInFile> namespaces = new ArrayList<NamespaceInFile>();
+
+ Scanner scanner = null;
+ try {
+ scanner = new Scanner(file, charset != null ? charset : Charset.defaultCharset().name());
+
+ scanner.useDelimiter("\n");
+
+ while (scanner.hasNext()) {
+ String line = scanner.next();
+
+ Matcher matcher = nsPattern.matcher(line);
+
+ if (matcher.find()) {
+ String ns = file.getPath();
+ ns = ns.substring(
+ path.getPath().length() + 1,
+ ns.lastIndexOf("."));
+ ns = ns.replace(File.separatorChar, '.');
+ ns = ns.replace('_', '-');
+
+ log.debug("Found namespace " + ns + " in file " + file.getPath());
+ namespaces.add(new NamespaceInFile(ns, file));
+ }
+ }
+ } catch (FileNotFoundException e) {
+ throw new MojoExecutionException(e.getMessage());
+ } finally {
+ if (scanner != null) {
+ scanner.close();
+ }
+ }
+ return namespaces;
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/NamespaceInFile.java b/src/main/java/com/theoryinpractise/clojure/NamespaceInFile.java
new file mode 100644
index 0000000..af4fa6a
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/NamespaceInFile.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) Antony Blakey 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import java.io.File;
+
+public class NamespaceInFile {
+
+ private String namespace;
+ private File sourceFile;
+
+ public NamespaceInFile(String namespace, File sourceFile) {
+ this.namespace = namespace;
+ this.sourceFile = sourceFile;
+ }
+
+ public String getName() {
+ return namespace;
+ }
+
+ public String getFilename() {
+ String base = namespace.replace('.', File.separatorChar).replace('-', '_');
+ String sourceName = sourceFile.getName();
+ String suffix = sourceName.substring(sourceName.lastIndexOf("."));
+ return base + suffix;
+ }
+
+ public File getSourceFile() {
+ return sourceFile;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ NamespaceInFile that = (NamespaceInFile) o;
+
+ if (!namespace.equals(that.namespace)) return false;
+ if (!sourceFile.equals(that.sourceFile)) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = namespace.hashCode();
+ result = 31 * result + sourceFile.hashCode();
+ return result;
+ }
+}
diff --git a/src/main/java/com/theoryinpractise/clojure/TestClojureCompilerMojo.java b/src/main/java/com/theoryinpractise/clojure/TestClojureCompilerMojo.java
new file mode 100644
index 0000000..fd057d4
--- /dev/null
+++ b/src/main/java/com/theoryinpractise/clojure/TestClojureCompilerMojo.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+import java.io.File;
+
+ at Mojo(name = "testCompile", defaultPhase = LifecyclePhase.TEST_COMPILE, requiresDependencyResolution = ResolutionScope.TEST)
+public class TestClojureCompilerMojo extends AbstractClojureCompilerMojo {
+
+ /**
+ * Flag to allow test compiliation to be skipped.
+ */
+ @Parameter(required = true, property = "maven.test.skip", defaultValue = "false")
+ private boolean skip;
+
+ /**
+ * Should the test-compile phase create a temporary output directory for .class files?
+ */
+ @Parameter(required = true, defaultValue = "false")
+ protected Boolean temporaryTestOutputDirectory;
+
+ public void execute() throws MojoExecutionException {
+ if (skip) {
+ getLog().info("Test compilation is skipped");
+ } else {
+ File outputPath = (temporaryTestOutputDirectory)
+ ? createTemporaryDirectory("test-classes")
+ : testOutputDirectory;
+
+ getLog().debug("Compiling clojure sources to " + outputPath.getPath());
+
+ final File[] testSourceDirectories = getSourceDirectories(SourceDirectory.TEST);
+ callClojureWith(testSourceDirectories, outputPath, testClasspathElements, "clojure.lang.Compile",
+ new NamespaceDiscovery(getLog(), outputPath, charset, testDeclaredNamespaceOnly, true).discoverNamespacesIn(testNamespaces, testSourceDirectories));
+ }
+ }
+
+}
diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000..0e9edc6
--- /dev/null
+++ b/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,72 @@
+<!--
+ ~ Copyright (c) Mark Derricutt 2010.
+ ~
+ ~ The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ ~ (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ ~ at the root of this distribution.
+ ~
+ ~ By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ ~
+ ~ You must not remove this notice, or any other, from this software.
+ -->
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>clojure</role-hint>
+ <implementation>
+ org.apache.maven.artifact.handler.DefaultArtifactHandler
+ </implementation>
+ <configuration>
+ <type>clojure</type>
+ <extension>jar</extension>
+ <language>java</language>
+ <addedToClasspath>true</addedToClasspath>
+ </configuration>
+ </component>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>clojure</role-hint>
+ <implementation>
+ org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
+ </implementation>
+ <configuration>
+ <phases>
+ <clean>
+ org.apache.maven.plugins:maven-clean-plugin:clean
+ </clean>
+ <generate-sources>
+ com.theoryinpractise:clojure-maven-plugin:add-source
+ </generate-sources>
+ <process-resources>
+ org.apache.maven.plugins:maven-resources-plugin:resources
+ </process-resources>
+ <compile>
+ org.apache.maven.plugins:maven-compiler-plugin:compile,com.theoryinpractise:clojure-maven-plugin:compile
+ </compile>
+ <generate-test-sources>
+ com.theoryinpractise:clojure-maven-plugin:add-test-source
+ </generate-test-sources>
+ <process-test-resources>
+ org.apache.maven.plugins:maven-resources-plugin:testResources
+ </process-test-resources>
+ <test-compile>
+ org.apache.maven.plugins:maven-compiler-plugin:testCompile,com.theoryinpractise:clojure-maven-plugin:testCompile
+ </test-compile>
+ <test>
+ org.apache.maven.plugins:maven-surefire-plugin:test,com.theoryinpractise:clojure-maven-plugin:test
+ </test>
+ <package>
+ org.apache.maven.plugins:maven-jar-plugin:jar
+ </package>
+ <install>
+ org.apache.maven.plugins:maven-install-plugin:install
+ </install>
+ <deploy>
+ org.apache.maven.plugins:maven-deploy-plugin:deploy
+ </deploy>
+ </phases>
+ </configuration>
+ </component>
+ </components>
+</component-set>
diff --git a/src/main/resources/default_test_script.clj b/src/main/resources/default_test_script.clj
new file mode 100644
index 0000000..ea49f59
--- /dev/null
+++ b/src/main/resources/default_test_script.clj
@@ -0,0 +1,80 @@
+(ns com.theoryinpractise.clojure.testrunner)
+
+(import `java.util.Properties)
+(import `java.io.FileInputStream)
+(import `java.io.FileWriter)
+(use 'clojure.test)
+(use 'clojure.test.junit)
+
+(def props (Properties.))
+(.load props (FileInputStream. (first *command-line-args*)))
+
+(def namespaces (into []
+ (for [[key val] props
+ :when (.startsWith key "ns.")]
+ (symbol val))))
+
+(def junit (Boolean/valueOf (.get props "junit")))
+(def output-dir (.get props "outputDir"))
+(def xml-escape (Boolean/valueOf (.get props "xmlEscape")))
+
+(dorun (for [ns namespaces]
+ (require ns)))
+
+(def escape-xml-map
+ (zipmap "'<>\"&" (map #(str \& % \;) '[apos lt gt quot amp])))
+
+(defn- escape-xml [text]
+ (apply str (map #(escape-xml-map % %) text)))
+
+(defn xml-escaping-writer
+ [writer]
+ (proxy
+ [java.io.FilterWriter] [writer]
+ (write [text]
+ (if (string? text)
+ (.write writer (escape-xml text))
+ (.write writer text)))
+ ))
+
+(defn total_errors [summary]
+ (+ (:error summary 0) (:fail summary 0)))
+
+(defn print-results [results]
+ (println (str "Tests run: " (:test results)
+ ", Assertions: " (:pass results)
+ ", Failures: " (:fail results)
+ ", Errors: " (:error results)))
+ (if (> (total_errors results) 0)
+ (println "There are test failures.")))
+
+(when-not *compile-files*
+ (let [results (atom {})]
+ (let [report-orig report
+ junit-report-orig junit-report]
+ (binding [report (fn [x] (report-orig x)
+ (swap! results (partial merge-with +)
+ (select-keys (into {} (rest x)) [:pass :test :error :fail ])))
+ junit-report (fn [x] (junit-report-orig x)
+ (swap! results (partial merge-with +)
+ (select-keys (into {} (rest x)) [:pass :test :error :fail ])))]
+ (dorun (for [ns namespaces]
+ (if junit
+ (if xml-escape
+ (do
+ (with-open [writer (FileWriter. (str output-dir "/" ns ".xml"))
+ escaped (xml-escaping-writer writer)]
+ (binding [*test-out* writer *out* escaped]
+ (with-junit-output
+ (run-tests ns)))))
+ (do
+ ;;Use with-test-out to fix with-junit-output for Clojure 1.2 (See http://dev.clojure.org/jira/browse/CLJ-431)
+ (with-open [writer (FileWriter. (str output-dir "/" ns ".xml"))]
+ (binding [*test-out* writer]
+ (with-test-out
+ (with-junit-output
+ (run-tests ns)))))))
+ (run-tests ns))))
+ (shutdown-agents)
+ (print-results @results)
+ (System/exit (total_errors @results))))))
diff --git a/src/test/java/com/theoryinpractise/clojure/ClojureReplMojoTest.java b/src/test/java/com/theoryinpractise/clojure/ClojureReplMojoTest.java
new file mode 100644
index 0000000..7f1d541
--- /dev/null
+++ b/src/test/java/com/theoryinpractise/clojure/ClojureReplMojoTest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import junit.framework.TestCase;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+public class ClojureReplMojoTest extends TestCase {
+
+ public void testJLineAvailable() throws Exception {
+ ClojureReplMojo mojo = new ClojureReplMojo();
+ assertTrue(mojo.isJLineAvailable(Arrays.asList("test/jline-0.9.94.jar")));
+ assertTrue(mojo.isJLineAvailable(Arrays.asList("test/jline-0.9.95-SNAPSHOT.jar")));
+ assertTrue(mojo.isJLineAvailable(Arrays.asList("test/test-0.1.jar", "test/jline-0.9.94.jar")));
+ assertFalse(mojo.isJLineAvailable(Arrays.asList("test/test-0.1.jar")));
+ assertFalse(mojo.isJLineAvailable(Collections.<String>emptyList()));
+ assertFalse(mojo.isJLineAvailable(null));
+ }
+}
diff --git a/src/test/java/com/theoryinpractise/clojure/NamespaceDiscoveryTest.java b/src/test/java/com/theoryinpractise/clojure/NamespaceDiscoveryTest.java
new file mode 100644
index 0000000..b91f11a
--- /dev/null
+++ b/src/test/java/com/theoryinpractise/clojure/NamespaceDiscoveryTest.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) Mark Derricutt 2010.
+ *
+ * The use and distribution terms for this software are covered by the Eclipse Public License 1.0
+ * (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html
+ * at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.theoryinpractise.clojure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.logging.Log;
+import org.junit.Test;
+import org.junit.experimental.theories.DataPoint;
+import org.junit.experimental.theories.Theories;
+import org.junit.experimental.theories.Theory;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.fest.assertions.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+
+ at RunWith(Theories.class)
+public class NamespaceDiscoveryTest {
+
+ @Test
+ public void testNamespaceDiscovery() throws MojoExecutionException {
+
+ final NamespaceDiscovery namespaceDiscovery = new NamespaceDiscovery(mock(Log.class), new File("target/test-classes"), "UTF-8", true);
+
+ List<String> namespaces = new ArrayList<String>() {{
+ for (NamespaceInFile s : namespaceDiscovery.discoverNamespacesInPath(new File("src/test/resources"))) {
+ System.out.println(s.getName());
+ add(s.getName());
+ }
+ }};
+
+ assertThat(namespaces)
+ .isNotNull()
+ .isNotEmpty()
+ .hasSize(5)
+ .contains("test1")
+ .contains("test2")
+ .contains("test.test3")
+ .contains("nsmeta")
+ .contains("charset")
+ .doesNotContain("test.test4");
+ }
+
+ public static class NamespaceData {
+ public String[] namespaces;
+ public File[] sourceDirectories;
+ public boolean compileDeclaredNamespaceOnly;
+
+ public int expectedSize;
+
+ public NamespaceData(String[] namespaces, File[] sourceDirectories, boolean compileDeclaredNamespaceOnly, int expectedSize) {
+ this.namespaces = namespaces;
+ this.sourceDirectories = sourceDirectories;
+ this.compileDeclaredNamespaceOnly = compileDeclaredNamespaceOnly;
+ this.expectedSize = expectedSize;
+ }
+ }
+
+ @DataPoint
+ public static NamespaceData ns1 = new NamespaceData(new String[]{"test.*"}, new File[]{new File("src/test/resources")}, true, 3);
+
+ @DataPoint
+ public static NamespaceData ns2 = new NamespaceData(new String[]{"!test\\..*"}, new File[]{new File("src/test/resources")}, false, 4);
+
+ @DataPoint
+ public static NamespaceData ns3 = new NamespaceData(new String[]{"test1"}, new File[]{new File("src/test/resources")}, true, 1);
+
+ @DataPoint
+ public static NamespaceData ns4 = new NamespaceData(new String[]{"test\\..*"}, new File[]{new File("src/test/resources")}, true, 1);
+
+ @DataPoint
+ public static NamespaceData ns5 = new NamespaceData(new String[]{"!test\\..*", "test.*"}, new File[]{new File("src/test/resources")}, true, 2);
+
+ @DataPoint
+ public static NamespaceData ns6 = new NamespaceData(new String[]{"!test\\..*", "test.*"}, new File[]{new File("src/test/resources"), new File("src/test/resources")}, true, 2);
+
+ @DataPoint
+ public static NamespaceData ns7 = new NamespaceData(new String[]{"charset.*"}, new File[]{new File("src/test/resources")}, true, 1);
+
+ @Theory
+ public void testNamespaceFiltering(NamespaceData ns) throws MojoExecutionException {
+
+ NamespaceDiscovery namespaceDiscovery = new NamespaceDiscovery(mock(Log.class), new File("target/test-classes"), "UTF-8", ns.compileDeclaredNamespaceOnly);
+
+ assertThat(namespaceDiscovery.discoverNamespacesIn(ns.namespaces, ns.sourceDirectories))
+ .describedAs("Discovered Namespaces")
+ .isNotNull()
+ .isNotEmpty()
+ .hasSize(ns.expectedSize);
+ }
+
+}
diff --git a/src/test/resources/charset.clj b/src/test/resources/charset.clj
new file mode 100644
index 0000000..bc83c4d
--- /dev/null
+++ b/src/test/resources/charset.clj
@@ -0,0 +1,5 @@
+(ns charset
+ (require [clojure.string as s]))
+
+;; Copyright © 2013 Very Important People
+;; Blah Blah
diff --git a/src/test/resources/nsmeta.clj b/src/test/resources/nsmeta.clj
new file mode 100644
index 0000000..19be3a7
--- /dev/null
+++ b/src/test/resources/nsmeta.clj
@@ -0,0 +1,2 @@
+(ns #^{:doc "This is my namespace."}
+ nsmeta)
diff --git a/src/test/resources/test/#test4.clj b/src/test/resources/test/#test4.clj
new file mode 100644
index 0000000..16f626a
--- /dev/null
+++ b/src/test/resources/test/#test4.clj
@@ -0,0 +1,3 @@
+(ns test.test4)
+
+# This file should be ignored
diff --git a/src/test/resources/test/test3.clj b/src/test/resources/test/test3.clj
new file mode 100644
index 0000000..0054263
--- /dev/null
+++ b/src/test/resources/test/test3.clj
@@ -0,0 +1,3 @@
+(ns test.test3)
+
+(defn hello [] (println "hello"))
diff --git a/src/test/resources/test1.clj b/src/test/resources/test1.clj
new file mode 100644
index 0000000..a06cf76
--- /dev/null
+++ b/src/test/resources/test1.clj
@@ -0,0 +1,5 @@
+; Copyright © 2010 Theory In Practise
+
+(ns test1)
+
+(defn test [] (println "test"))
diff --git a/src/test/resources/test2.clj b/src/test/resources/test2.clj
new file mode 100644
index 0000000..f6d6375
--- /dev/null
+++ b/src/test/resources/test2.clj
@@ -0,0 +1,7 @@
+;; (ns your-ns
+;; (:use [clojure.http.resourcefully :as resourcefully]))
+
+(ns test2
+ )
+
+(defn hello [] (println "hello"))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/clojure-maven-plugin.git
More information about the pkg-java-commits
mailing list