clojure-maven-plugin
https://github.com/talios/clojure-maven-plugin
THE REPL
$ java -jar clojure.jar
user=> (+ 1 2)
3
user=>
- Interactive
- Cumbersome
- ...without rlwrap or JLine
- Somewhat retarded/amemic
- ...without dependencies
The command Line
java -jar ~/.m2/repository/com/talios/test/1.0/test-1.0.jar:\
~/.m2/repository/com/talios/test2/1.0/test2-1.0.jar:\
~/.m2/repository/com/talios/foo/1.1/foo-1.1.jar:\
~/.m2/repository/com/xml/parser/1.5/parser-1.5.jar:\
~/.m2/repository/com/xmpp/xmpp/4.0/xmpp-4.0.jar org.clojure.Main
- Manually download JAR files?
- Keep JARs in source project?
- Not VCS friendly
- Not developer friendly
- ...without tooling support...
Apache Maven
- Familiar to Developers
- Tool Support ( Jenkins, Idea etc. etc. )
- Dependency Management
- Convention Over Configuration
- Extendable
- ...maven-exec-plugin to the rescue
CLOJURE-MAVEN-PLUGIN
- clojure 1.0 - may 4, 2009
- clojure-maven-plugin repo - Feb 1, 2009
- clojure-maven-plugin 1.0 - Aug 24, 2009
clojure-maven-plugin
<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>rawdef1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>clojure</packaging>
<build>
<plugins>
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>clojure-maven-plugin</artifactId>
<version>1.3.15</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>1.5.0</version>
</dependency>
</dependencies>
</project>
"SIMPLE" Minimum Maven POMmvn clojure:Repl
$ mvn clojure:repl
Scanning for projects... [INFO] [INFO] --------------------------------------------------------------- [INFO] Building packaging-test 1.0-SNAPSHOT [INFO] --------------------------------------------------------------- [INFO] [INFO] --- clojure-maven-plugin:1.3.15:repl (default-cli) @ rawdef1 -- Clojure 1.5.0 user=>
- Automatically downloaded JAR files!
- JARs NOT in source project!
- VCS friendly!
- Tool Managed Classpath!
- Developer friendly!
mvn clojure:compile
$ mvn clojure:compile
[INFO] --- clojure-maven-plugin:1.3.15:compile (default-cli) @ rawdef1 ---
Compiling packaging to /Users/amrk/Dropbox/cljmeetup/rawdef1/target/classes
Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration println should be a vector
at clojure.core$assert_valid_fdecl.invoke(core.clj:6732)
...
[INFO] ------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------
[INFO] Total time: 1:30.115s
[INFO] Finished at: Mon May 20 21:52:04 NZST 2013
[INFO] Final Memory: 6M/76M
- "Compile Time" Failure!
- Non-standard error format :(
- Tool somewhat unfriendly :(
- Developer somewhat friendly :(
the "compiler" is a LIE
(ns packaging)
(println "Hello During Compile")
- Code runs during "compile"
- There is no "compile", just "eval and write class files"
[INFO] --- clojure-maven-plugin:1.3.15:compile (default-cli) @ rawdef1
Compiling packaging to ~/Dropbox/cljmeetup/rawdef1/target/classes
Hello During Compile
[INFO] --------------------------------------------------------------
[INFO] BUILD SUCCESS
java interop
- Support for maven-toolchain-plugin
- Beware of compile order...
- Clojures Java interop could do with improving
aot or not aot - that...is the question
- Support for AOT and NON-AOT "Compilation"
<configuration>
<temporaryOutputDirectory>true</temporaryOutputDirectory>
</configuration>
other goals... aka bloat...
- add-source
- add-test-source
- test
- test-with-junit
- run
- repl
- nrepl
- swank
- nailgun
- gendoc
- autodoc
- marginalia
contact
- mark@talios.com
- @talios on twitter
- http://gplus.to/talios
-
https://github.com/talios/clojure-maven-plugin
clojure-maven-plugin
By talios
clojure-maven-plugin
An introduction to the clojure-maven-plugin
- 2,773