A simple maven wrapper over leiningen 2.X
Clone or download
abailly Merge pull request #1 from hlprmnky/master
Add tag file to allow leinTest.setUp to succeed (line 36)
Latest commit bc5a673 Sep 7, 2014
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Add tag file to allow leinTest.setUp to succeed (line 36) Aug 28, 2014
README.md can set the build directory where lein is downloaded and executed Oct 4, 2013
pom.xml test mojo, fix mock tests and use jdk7 Sep 30, 2013

README.md

A maven plugin that wraps leiningen build tool.

Getting Started

  1. Download & build source code (assume git and mvn are in your PATH):

    git clone https://github.com/abailly/lein-maven-plugin.git
    cd lein-maven-plugin
    mvn install
    
  2. Configure your project to use the plugin.

    <plugin>
        <groupId>foldlabs</groupId>
        <artifactId>lein-maven-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <executions>
          <execution>
            <goals>
              <goal>lein</goal>
            </goals>
            <configuration>
              <environment>
                <PORT>${server.port}</PORT>
              </environment>
              <targets>
                <target>deps</target>
                <target>run</target>
              </targets>
            </configuration>
          </execution>
        </executions>
      </plugin>
  3. Run maven in your project with suitable target:

    mvn compile
    ...
    [INFO]
    [INFO] --- lein-maven-plugin:1.0-SNAPSHOT:lein (default) @ colonel-train ---
    [INFO] using default system utilities provider
    [INFO] downloading https://raw.github.com/technomancy/leiningen/stable/bin/lein.bat to lein.bat
    [INFO] lein.bat exists, skipping download
    [INFO] downloading https://leiningen.s3.amazonaws.com/downloads/leiningen-2.3.2-standalone.jar to leiningen-2.3.2-standalone.jar
    [INFO] leiningen-2.3.2-standalone.jar exists, skipping download
    [INFO] lein deps...
    [INFO] done
    [INFO] lein run...
    INFO  org.eclipse.jetty.server.Server - jetty-7.6.1.v20120215
    INFO  org.eclipse.jetty.server.AbstractConnector - Started SelectChannelConnector@0.0.0.0:3000
    

Public repository access

If you don't want or cannot build the plugin yourself, a binary version is available from Dropbox. Add the following repository definition to your pom.xml or settings.xml file:

<pluginRepository>
  <id>foldlabs</id>
  <url>https://dl.dropboxusercontent.com/u/2060057/maven/</url>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
</pluginRepository>

Thanks to http://code.google.com/p/peter-lavalle/wiki/MavenOnDropBox for the idea.

Configuration details

This simple mojo wraps leiningen execution with maven. It is extremely dumb, simple and dirty:

  • download leiningen uber-jar,
  • download platform-dependent script,
  • run lein repeatedly for each given do element.

Current help is always available inline with the following command (assuming plugin group foldlabs is configured in settings...):

mvn lein:help -Ddetail

Available parameters:

environment

Sets environment variables to pass to underlying processes. Each leiningen execution will be run in an environment with all this configured variables set. Of course the variables content may use maven properties.

leinVersion (Default: 2.3.2)

Defines which leiningen's version to use. Required: Yes

targets (Default: compile)

Sets leiningen's tasks to execute. Each task will be executed in sequence. Default task is compile. For example:

<targets>
  <target>deps</target>
  <target>run</target>
</targets>

This instructs plugin to run deps task followed by run task.

CAVEAT: Note each task is run in a sub-process of the current maven process. If the current process is killed while sub-processes are still alive, this will create orphan processes that must be killed manually. Required: Yes