mavenclojureleiningenclojure-java-interop

pom.xml maven properties in leiningen project.clj


I use the $ lein pom command to genereate a maven pom.xml from a Leiningen project.clj file. I do that because I have Java source files in my Clojure project.

I would like to make sure the following maven properties are embedded into the generated pom.xml file:

<properties>
   <maven.compiler.source>1.7</maven.compiler.source>
   <maven.compiler.target>1.7</maven.compiler.target>
</properties>

I do this by hand now. However, I do not want to check in the generated file into version control and I would like to be able to regenerate it any time. How can I make Leiningen to embed the maven properties in the generated pom.xml file every time I generate the pom.xml?

Thank you


Solution

  • You can add custom pom.xml entries using :pom-addition:

    (defproject ...
      ...
      :pom-addition [:properties
                      ["maven.compiler.source" "1.7"]
                      ["maven.compiler.target" "1.7"]])