Skip to content
Daniel Compton edited this page Aug 1, 2015 · 6 revisions

N.B. This page is out of date and not recommended anymore. You should probably use Maven/Leiningen/Boot to build a POM instead of hand rolling your own.

Clojars needs a minimal Maven-style pom.xml file to describe any jar you upload. At the bare minimum you will at least need to specify an artifactId, groupId, version and dependencies. It’s also preferred to fill in some of the metadata fields such as description, url and license so that the Clojars site will be able to index and search on them. Here’s an example:

While POMs are the standard way of describing Java libraries, they unfortunately have a very verbose syntax. Check out the tutorial for an easy way to generate POMs for Clojure libraries using Leiningen.

If you need to add a non-clojure jar you can create a POM file by hand. Something like that:

<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.clojars.YOUR-CLOJARS-USERNAME-HERE</groupId>
  <artifactId>JAR-NAME-HERE</artifactId>
  <version>JAR-VERSION-HERE</version>
  <name>JAR-NAME-HERE</name>
  <description>JAR-DESCRIPTION-HERE</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>
  <repositories>
    <repository>
      <id>clojars</id>
      <url>http://clojars.org/repo/</url>
    </repository>
  </repositories>
</project>

Save as pom.xml and upload that and your jar to Clojars:

scp pom.xml your-jar.jar [email protected]:

If your jar have some dependencies you will need to create one POM file to every dependency and push it to Clojars following the same process described above. You will also need to include the dependencies on your first POM. For example, if your jar depends on org.clojars.automata/jl and overtone/jsyntaxpane your POM will be something like that:

<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.clojars.YOUR-CLOJARS-USERNAME-HERE</groupId>
  <artifactId>JAR-NAME-HERE</artifactId>
  <version>JAR-VERSION-HERE</version>
  <name>JAR-NAME-HERE</name>
  <description>JAR-DESCRIPTION-HERE</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>
  <repositories>
    <repository>
      <id>clojars</id>
      <url>http://clojars.org/repo/</url>
    </repository>
  </repositories>
  <dependencies>
   <dependency>
    <groupId>org.clojars.automata</groupId>
    <artifactId>jl</artifactId>
    <version>1.0.0</version>
   </dependency>
   <dependency>
    <groupId>overtone</groupId>
    <artifactId>jsyntaxpane</artifactId>
    <version>0.9.5-b27</version>
   </dependency>
 </dependencies>
</project>

You can take a look at the Clojars jar page to see what to insert as dependency entry. For example, see the maven section on http://clojars.org/overtone/jsyntaxpane. It’s the same as the dependency entry inserted above.