- Use NetBeans to do all the Java / Maven specific stuff.
- Use Emacs to do all the Clojure programming.
- Use the clojure-maven-plugin to compile the .clj files, and to start the swank server for the project.
I could do all my development in Emacs, but I am unwilling to part with NetBeans. For the pure Java / Maven side, I am very comfortable with NetBeans. This setup gives me the best of both worlds - NetBeans does what it is good at. Emacs does what it is good at.
Let's test this out. I will create a project, add a Jakarta Commons dependency, then try to call it from the repl. Here is the pom:
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" 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.nwalex</groupid>
<artifactid>mrtj-clojure</artifactid>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>mrtj-clojure</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>build.clojure</id>
<url>http://build.clojure.org/snapshots</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupid>org.clojure</groupid>
<artifactid>clojure</artifactid>
<version>1.1.0</version>
</dependency>
<dependency>
<groupid>com.codestuffs.clojure</groupid>
<artifactid>swank-clojure</artifactid>
<version>1.1.0</version>
</dependency>
<dependency>
<groupid>commons-lang</groupid>
<artifactid>commons-lang</artifactid>
<version>2.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupid>com.theoryinpractise</groupid>
<artifactid>clojure-maven-plugin</artifactid>
<version>1.3.1</version>
<executions>
<execution>
<id>compile-clojure</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</pre>
Some things to note:- I added a repository to pick up the clojure dependency
- I had to manually install the swank-clojure dependency to my local repository.
user> (org.apache.commons.lang.StringUtils/isBlank " ") true user> (org.apache.commons.lang.StringUtils/isBlank "not blank ") falseYes! That proves the set up.
And does the clojure-maven-plugin compile my .clj files?
neill@korzybski:~/src/mrtj-clojure$ ls target/classes/com/nwalex/mrtj test$hello_world__3.class test__init.class test$loading__6309__auto____1.classYes it does.
I am very happy with this. I started down this road yesterday afternoon when I struggled and failed to configure the NetBeans Enclojure plugin to work with Clojure 1.1.0. 1 day later I have a working Clojure development environment integrating NetBeans, Maven, and Emacs. I don't need to mess about with classpaths. Maven will sort all of that out for me when I add dependencies to the pom.
Time to start hacking!
0 comments:
Post a Comment