Maven Erlang Plug-In

The Maven Erlang Plug-In manages Erlang projects under Maven2, enabling building, testing, deployment and of course erlang project dependency management - as expected by Maven users.

This project is based on the ideas of maven-erlang, created by Paul Guyot and Olivier Sambourg, but is maintained under this new regime in order to improve and extend it. This incarnation also provides a little bit more definition for development - be sure to check it out if you are interested in contributing.

Prerequisites

You will need to have maven2 and erlang version R13B04 or later installed.

Getting started

The plug-in is available from the Sonatype OSS Repository https://repository.sonatype.org/. Add this to your POM plugins section:

...
<plugin>
  <groupId>eu.lindenbaum</groupId>
  <artifactId>maven-erlang-plugin</artifactId>
  <version>2.0.0</version>
  <extensions>true</extensions>
</plugin>
...

Or you may check out the latest development source code from the repository and install it locally.

 svn co https://erlang-plugin.svn.sourceforge.net/svnroot/erlang-plugin/trunk/maven-erlang-plugin maven-erlang-plugin
 cd maven-erlang-plugin/
 mvn install

This will build, test, package and install the plug-in.

To install the download version of the plug-in you need to extract the provided package and install the .jar artifacts with the following:

 tar xzvf maven-erlang-plugin-2.0.0.tar.gz
 
 cd maven-erlang-plugin-2.0.0
 
 mvn install:install-file \
    -Dfile=maven-erlang-plugin-2.0.0.jar \
    -DgroupId=eu.lindenbaum \
    -DartifactId=maven-erlang-plugin \
    -Dversion=2.0.0 \
    -Dpackaging=jar
 
 mvn install:install-file \
    -Dfile=maven-erlang-plugin-2.0.0-javadoc.jar \
    -DgroupId=eu.lindenbaum \
    -DartifactId=maven-erlang-plugin \
    -Dversion=2.0.0 \
    -Dpackaging=jar \
    -Dclassifier=javadoc
 
 mvn install:install-file \
    -Dfile=maven-erlang-plugin-2.0.0-sources.jar \
    -DgroupId=eu.lindenbaum \
    -DartifactId=maven-erlang-plugin \
    -Dversion=2.0.0 \
    -Dpackaging=jar \
    -Dclassifier=sources

Packaging Type

Three custom components are defined in the plug-in, and can be used by configuring the packaging type of a project.

  • erlang-otp - An application development project, aimed at supporting the conventions of the Erlang OTP Design Principles respecting the default maven2 directory layout.
  • erlang-std - An application development project, aimed at supporting the conventions of the Erlang OTP Design Principles respecting the default erlang/OTP directory layout.
  • erlang-rel - A release and packaging project that supports building an erlang/OTP packaged and distributable solution.

Configuration

Here is an example of the minimum required configuration for any project that wishes to use the Maven Erlang Plug-In:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>[your-gropupId]</groupId>
  <artifactId>[your-artifactId]</artifactId>
  <version>[your-version]</version>
  <packaging>erlang-std</packaging>                       <-- erlang-std, erlang-otp or erlang-erl
  <build>
    <plugins>
      <plugin>
        <groupId>eu.lindenbaum</groupId>
        <artifactId>maven-erlang-plugin</artifactId>
        <version>2.0.0</version>
        <extensions>true</extensions>                     <-- required
      </plugin>
    </plugins>
  </build>
</project> 

To generate erlang specific output for site generation you may also configure the plug-in into the reporting section of your project's pom:

  <reporting>
    <plugins>
      <plugin>
        <groupId>eu.lindenbaum</groupId>
        <artifactId>maven-erlang-plugin</artifactId>
        <version>2.0.0</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>edoc</report>
              <report>coverage</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

For more information about project reports please refer to:

Directory Structure

The default directory structure that is supported for projects depends on the project's packaging. For further information please refer to the documentation of the specific PackagingType. Please note that target folder structure is omitted in this listing.

Goals

The tables below shows how the plug-in goals are mapped to the Maven default lifecycle.

erlang-otp and erlang-std
Maven lifecycle phaseGoal in the Maven Erlang Plug-In
initializeinitialize
generate-sourcesextract-dependencies
process-sourcesreload-dependencies
generate-resourcesgenerate-resources
compilecompile
generate-test-sourcestest-initialize
process-test-sourcesreload-test-dependencies
generate-test-resourcesgenerate-test-resources
test-compiletest-compile
testtest
prepare-packagedialyzer
packagepackage
erlang-rel
Maven lifecycle phaseGoal in the Maven Erlang Plug-In
initializeinitialize
generate-sourcesextract-dependencies
process-sourcesreload-release-dependencies
generate-resourcesgenerate-release-resources
compiledialyzer-release
testtest-release
packagepackage-release

Setup

Provides the option to generate sensible defaults for erlang projects, replacing the need for a maven archetype.

More information:

Run Application Projects

There is a plug-in goal to run application projects (optionally even on a remote node) for testing purposes. Simply typing mvn clean erlang:run will start the application and all required (transitive) applications needed. On successfull start the build will be paused to allow you to connect to the running application using the erlang remote shell. To shutdown the application just finish the build by pressing ENTER.

When specifying a running remote node using -Dremote=REMOTE_NODE the application code will be uploaded to the specified node (without resources) and the application will be started there. To additionally upload the projects transitive dependencies specify -DwithDependencies. Please note that the applications started on the remote node will not be stopped when the build finishes. The node owner has to take care of that.

More information:

Upload

The upload goal will upload the compiled artifacts of an erlang project on a remote node specified by the -Dremote parameter. In case of application projects the compiled source code will be uploaded (except for project resource files). The dependencies of the project will only be uploaded when specifying the withDependencies parameter. In case of release projects the packaged release .tar.gz will be uploaded into the remote node's releases directory. Please note that the remote node's process will have to have write access to its releases directory to be able to successfully execute this goal.

More information:

Target-System

On UNIX hosts the target-system goal will package a release as a startable target system according to the official documentation on erlang.org. Please note that a target system is highly system dependent since the runtime of the current backend node (binaries) is packaged along with the target system.

More information:

Help

Prints a generated list of the available goals and their documentation.

More information: