Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Execute Clojure script in Maven
(ns cljmvn)
(println (str "Hello " (first *command-line-args*)))
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>${clojure.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>clojure-maven-plugin</artifactId>
<version>1.3.11</version>
<executions>
<execution>
<id>exec-clojure-script</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<script>src/build/scripts/cljmvn.clj</script>
<args>Stuart</args>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>exec-clojure-script</id>
<phase>validate</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<arguments>
<!-- the script to import -->
<argument>src/build/scripts/cljmvn.clj</argument>
<!-- script args -->
<argument>Stuart</argument>
</arguments>
<mainClass>clojure.main</mainClass>
<includePluginDependencies>true</includePluginDependencies>
<includeProjectDependencies>false</includeProjectDependencies>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>${clojure.version}</version>
</dependency>
</dependencies>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment