Awesome
Zi
Zi is a maven plugin for clojure. It does something similar to clojure-maven-plugin, but does so differently.
It uses the maven pom sourceDirectory
and testSourceDirectory
settings to
locate source, which by default means that it uses src/main/clojure
and
src/test/clojure
. The goals should work with a pom.xml
generated by
leiningen.
From an implementation perspecitve, most of the goals are written in clojure.
Zi requires maven 3.0.4.
Available goals
- zi:resources
- zi:testResources
- zi:compile
- zi:ritz
- zi:ritz-nrepl
- zi:swank-clojure
- zi:test
- zi:codox
- zi:marginalia
- zi:ring-genfiles
Install
Globally installing the plugin allows you to run the goals without modifying a project's pom file.
To globally enable the zi plugin, you need to add pluginGroup
and
pluginRepository
configuration to your ~/.m2/settings.xml
file.
<pluginGroups>
<pluginGroup>org.cloudhoist.plugin</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>clojure-dev</id>
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/releases</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>clojure-dev</activeProfile>
</activeProfiles>
To enable zi in a project pom, without globally enabling the plugin, you will
need to add a pluginRepositories
entry to your pom:
<pluginRepositories>
<pluginRepository>
<id>sonatype-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/releases</url>
</pluginRepository>
</pluginRepositories>
Configuration
It uses the maven pom sourceDirectory
and testSourceDirectory
settings to
locate source, which by default means that it uses src/main/clojure
and
src/test/clojure
.
Goals
resources
The resources goal copies clojure source to the target. This is probably what you need to make sure that your clj source files end up in your jar file.
<build>
<plugins>
<plugin>
<groupId>org.cloudhoist.plugin</groupId>
<artifactId>zi</artifactId>
<version>0.5.5</version>
<executions>
<execution>
<id>default-resources</id>
<phase>process-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
testResources
The testResources goal copies clojure test source to the target. This is probably what you need to make sure that your clj source files end up in your test-jar file.
<build>
<plugins>
<plugin>
<groupId>org.cloudhoist.plugin</groupId>
<artifactId>zi</artifactId>
<version>0.5.5</version>
<executions>
<execution>
<id>default-test-resources</id>
<phase>process-test-resources</phase>
<goals>
<goal>test-resources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
compile
The compile goal AOT compiles clojure source.
<build>
<plugins>
<plugin>
<groupId>org.cloudhoist.plugin</groupId>
<artifactId>zi</artifactId>
<version>0.5.5</version>
<executions>
<execution>
<id>default-compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/test.clj</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<table>
<tr>
<th>Property</th>
<th>Variable</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>includes</td>
<td>
<td>**/*.clj</td>
<td>A set of source patterns to include</td>
</tr>
<tr>
<td>excludes</td>
<td>
<td></td>
<td>A set of source patterns to exclude</td>
</tr>
</table>
ritz
The ritz goal starts a ritz server.
<table> <tr> <th>Property</th> <th>Variable</th> <th>Default</th> <th>Description</th> </tr> <tr> <td>port</td> <td>clojure.swank.port</td> <td>4005</td> <td>The swank server port</td> </tr> <tr> <td>encoding</td> <td>clojure.swank.encoding</td> <td>iso-8859-1</td> <td>The swank encoding to use</td> </tr> </table>The ritz, ritz-nrepl and swank-clojure goals all recognise sub-projects linked in a checkouts directory, and adds their sources and resources to the the classpath.
The ritz and ritz-nrepl goals also adds source jars to the classpath if they are
available in the local repository. You can resolve the source jars using mvn dependency:sources
.
ritz-nrepl
The ritz-nrepl goal starts a ritz nREPL server.
<table> <tr> <th>Property</th> <th>Variable</th> <th>Default</th> <th>Description</th> </tr> <tr> <td>port</td> <td>clojure.nrepl.port</td> <td>4005</td> <td>The nrepl server port</td> </tr> </table>swank-clojure
The swank-clojure goal starts a swank-clojure server.
<table> <tr> <th>Property</th> <th>Variable</th> <th>Default</th> <th>Description</th> </tr> <tr> <td>port</td> <td>clojure.swank.port</td> <td>4005</td> <td>The swank server port</td> </tr> <tr> <td>encoding</td> <td>clojure.swank.encoding</td> <td>iso-8859-1</td> <td>The swank encoding to use</td> </tr> </table>test
The test goal runs clojure.test tests.
<table> <tr> <th>Property</th> <th>Variable</th> <th>Default</th> <th>Description</th> </tr> <tr> <td>initScript</td> <td>clojure.initScript</td> <td></td> <td>A clojure source string that is run before the tests</td> </tr> </table>codox
The codox goal creates codox generated API documentation in the doc
directory.
marginalia
The marginalia goal creates a marginalia annotated source page.
<table> <tr> <th>Property</th> <th>Variable</th> <th>Default</th> <th>Description</th> </tr> <tr> <td>marginaliaTargetDirectory</td> <td></td> <td>${project.build.directory}</td> <td>The directory where marginalia should write uberdoc.html</td> </tr> </table>ring-genfiles
The ring-genfiles goal creates files required for a war packaging. See lein-ring plugin.
<table> <tr> <th>Property</th> <th>Default</th> <th>Description</th> </tr> <tr> <td>ringServletClass</td> <td></td> <td>The name of the servlet class</td> </tr> <tr> <td>ringServletName</td> <td></td> <td>The name of the servlet</td> </tr> <tr> <td>ringListenerClass</td> <td></td> <td>The name of the ServletContextListener class</td> </tr> <tr> <td>ringHandler</td> <td></td> <td>The name of the ring handler</td> </tr> <tr> <td>ringInit</td> <td></td> <td>The name of an initialisation hook function</td> </tr> <tr> <td>ringDestroy</td> <td></td> <td>The name of a shutdown hook function</td> </tr> <tr> <td>ringUrlPattern</td> <td></td> <td>The url pattern of the servlet mapping (in web.xml). Defaults to "/*".</td> </tr> </table>Zi, the builder
Zi was a builder in northern mythology.
License
Licensed under EPL
Copyright 2011 Hugo Duncan.