>> I highly recommend you use the snapshots on
build.clojure.org. �Lein
>> already has
build.clojure.org snapshots in it's repo list. �You don't
>> need to do anything more than put
>>
>> ďż˝:dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"]
It seems that everyone uses homemade pom.xml. I fully agree that having
standard one where "mvn install" will just work would be great.
I'm not really an expert on maven (and to be honest don't want to be),
but I managed to create something like that and indeed "mvn install" works
for me.
So here it is pom.xml and two descriptors for jars:
# clojure-jar.xml
<assembly>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${build}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>**/*.class</include>
</includes>
</fileSet>
<fileSet>
<directory>${cljsrc}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>**/*.clj</include>
<include>clojure/version.properties</include>
</includes>
</fileSet>
</fileSets>
</assembly>
# slim-jar.xml
<assembly>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${build}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>clojure/asm/**</include>
<include>clojure/lang/**</include>
<include>clojure/main.class</include>
</includes>
</fileSet>
<fileSet>
<directory>${cljsrc}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>**/*.clj</include>
<include>clojure/version.properties</include>
</includes>
</fileSet>
</fileSets>
</assembly>
# pom.xml
<?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>
<groupId>org.clojure</groupId>
<artifactId>clojure-contrib</artifactId>
<name>clojure-contrib</name>
<version>1.0-SNAPSHOT</version>
<url>
http://clojure.org/</url>
<packaging>pom</packaging>
<description>Clojure user contributions library.</description>
<licenses>
<license>
<name>Eclipse Public License 1.0</name>
<url>
http://opensource.org/licenses/eclipse-1.0.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<src>src</src>
<test>test</test>
<jsrc>${src}/jvm</jsrc>
<cljsrc>${src}/clj</cljsrc>
<build>classes</build>
<jarfile>clojure-contrib-${project.version}</jarfile>
<slimjarfile>clojure-contrib-slim-${project.version}</slimjarfile>
</properties>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure-lang</artifactId>
<version>1.1.0-alpha-SNAPSHOT</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>releases</id>
<name>release</name>
<url>
http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>snapshot</name>
<url>
http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<sourceDirectory>${src}</sourceDirectory>
<outputDirectory>${build}</outputDirectory>
<resources>
<resource>
<directory>${src}</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy-clojure</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${build}</outputDirectory>
<resources>
<resource>
<directory>${src}</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>compile-classes</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<!-- automatically creates the classpath using all project
dependencies,
also adding the project build directory -->
<classpath/>
<argument>-Dclojure.compile.path=${build}</argument>
<argument>clojure.lang.Compile</argument>
<argument>clojure.contrib.pprint.ColumnWriter</argument>
<argument>clojure.contrib.pprint.PrettyWriter</argument>
<argument>clojure.contrib.fnmap.PersistentFnMap</argument>
<argument>clojure.contrib.condition.Condition</argument>
<argument>clojure.contrib.jmx.Bean</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>compile-clojure</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<!-- automatically creates the classpath using all project
dependencies,
also adding the project build directory -->
<classpath/>
<argument>-Dclojure.compile.path=${build}</argument>
<argument>-Djava.awt.headless=true</argument>
<argument>clojure.lang.Compile</argument>
<argument>clojure.contrib.accumulators</argument>
<argument>clojure.contrib.agent-utils</argument>
<argument>clojure.contrib.classpath</argument>
<argument>clojure.contrib.combinatorics</argument>
<argument>clojure.contrib.command-line</argument>
<argument>clojure.contrib.complex-numbers</argument>
<argument>clojure.contrib.cond</argument>
<argument>clojure.contrib.condition</argument>
<argument>clojure.contrib.core</argument>
<argument>clojure.contrib.dataflow</argument>
<argument>clojure.contrib.datalog</argument>
<argument>clojure.contrib.datalog.database</argument>
<argument>clojure.contrib.datalog.literals</argument>
<argument>clojure.contrib.datalog.magic</argument>
<argument>clojure.contrib.datalog.rules</argument>
<argument>clojure.contrib.datalog.softstrat</argument>
<argument>clojure.contrib.datalog.util</argument>
<argument>clojure.contrib.def</argument>
<argument>clojure.contrib.duck-streams</argument>
<argument>clojure.contrib.error-kit</argument>
<argument>clojure.contrib.except</argument>
<argument>clojure.contrib.mock</argument>
<argument>clojure.contrib.mock.test-adapter</argument>
<argument>clojure.contrib.fcase</argument>
<argument>clojure.contrib.find-namespaces</argument>
<argument>clojure.contrib.fnmap</argument>
<argument>clojure.contrib.gen-html-docs</argument>
<argument>clojure.contrib.generic</argument>
<argument>clojure.contrib.generic.arithmetic</argument>
<argument>clojure.contrib.generic.collection</argument>
<argument>clojure.contrib.generic.comparison</argument>
<argument>clojure.contrib.generic.functor</argument>
<argument>clojure.contrib.generic.math-functions</argument>
<argument>clojure.contrib.graph</argument>
<argument>clojure.contrib.greatest-least</argument>
<argument>clojure.contrib.import-static</argument>
<argument>clojure.contrib.jar</argument>
<argument>clojure.contrib.java-utils</argument>
<argument>clojure.contrib.javadoc.browse</argument>
<argument>clojure.contrib.javadoc.browse-ui</argument>
<argument>clojure.contrib.jmx</argument>
<argument>clojure.contrib.json.read</argument>
<argument>clojure.contrib.json.write</argument>
<argument>clojure.contrib.lazy-seqs</argument>
<argument>clojure.contrib.lazy-xml</argument>
<argument>clojure.contrib.macro-utils</argument>
<argument>clojure.contrib.macros</argument>
<argument>clojure.contrib.map-utils</argument>
<argument>clojure.contrib.math</argument>
<argument>clojure.contrib.miglayout</argument>
<argument>clojure.contrib.miglayout.internal</argument>
<argument>clojure.contrib.mmap</argument>
<argument>clojure.contrib.monads</argument>
<argument>clojure.contrib.ns-utils</argument>
<argument>clojure.contrib.pprint.ColumnWriter</argument>
<argument>clojure.contrib.pprint.PrettyWriter</argument>
<argument>clojure.contrib.pprint</argument>
<argument>clojure.contrib.pprint.utilities</argument>
<argument>clojure.contrib.probabilities.finite-distributions</argument>
<argument>clojure.contrib.probabilities.monte-carlo</argument>
<argument>clojure.contrib.probabilities.random-numbers</argument>
<argument>clojure.contrib.prxml</argument>
<argument>clojure.contrib.repl-ln</argument>
<argument>clojure.contrib.repl-utils</argument>
<argument>clojure.contrib.seq-utils</argument>
<argument>clojure.contrib.server-socket</argument>
<argument>clojure.contrib.set</argument>
<argument>clojure.contrib.shell-out</argument>
<argument>clojure.contrib.singleton</argument>
<argument>clojure.contrib.sql</argument>
<argument>clojure.contrib.sql.internal</argument>
<argument>clojure.contrib.str-utils</argument>
<argument>clojure.contrib.stream-utils</argument>
<argument>clojure.contrib.swing-utils</argument>
<argument>clojure.contrib.trace</argument>
<argument>clojure.contrib.types</argument>
<argument>clojure.contrib.with-ns</argument>
<argument>clojure.contrib.zip-filter</argument>
<argument>clojure.contrib.zip-filter.xml</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>test-contrib</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>-Djava.security.policy=config/jmx.policy</argument>
<argument>clojure.main</argument>
<argument>-e</argument>
<argument>(ns test (:require [clojure.contrib [test-contrib :as main]])) (main/run)</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>test-contrib</id>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>!!! For testing use integration-test phase !!!</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>clojure-contrib-jar</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${jarfile}</finalName>
<outputDirectory>.</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
<descriptors>
<descriptor>clojure-contrib-jar.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>slim-jar</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${slimjarfile}</finalName>
<outputDirectory>.</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
<descriptors>
<descriptor>contrib-slim-jar.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>skip-install</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>!!! Don't use default install phase !!!</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-clojure-contrib</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${jarfile}.jar</file>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-clojure-contrib</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>.</directory>
<includes>
<include>${jarfile}.jar</include>
<include>${slimjarfile}.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
HTH,
Rob