Maven Erlang Plug-In

The Maven Erlang Plug-In manages Erlang projects under Maven, enabling building, testing, deployment and of course Erlang/OTP 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.

Requirements

You will need to have Maven and Erlang/OTP 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.2.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.2.0.tar.gz
 
 cd maven-erlang-plugin-2.2.0
 
 mvn install:install-file \
    -Dfile=maven-erlang-plugin-2.2.0.jar \
    -DgroupId=eu.lindenbaum \
    -DartifactId=maven-erlang-plugin \
    -Dversion=2.2.0 \
    -Dpackaging=jar
 
 mvn install:install-file \
    -Dfile=maven-erlang-plugin-2.2.0-javadoc.jar \
    -DgroupId=eu.lindenbaum \
    -DartifactId=maven-erlang-plugin \
    -Dversion=2.2.0 \
    -Dpackaging=jar \
    -Dclassifier=javadoc
 
 mvn install:install-file \
    -Dfile=maven-erlang-plugin-2.2.0-sources.jar \
    -DgroupId=eu.lindenbaum \
    -DartifactId=maven-erlang-plugin \
    -Dversion=2.2.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.2.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.2.0</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>edoc</report>
              <report>coverage</report>
              <report>profiling</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:

Goals

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

erlang-otp and erlang-std
Maven lifecycle phase Goal in the Maven Erlang Plug-In
initialize initialize
generate-sources extract-dependencies
process-sources reload-dependencies
generate-resources generate-resources
compile compile
generate-test-sources test-initialize
process-test-sources reload-test-dependencies
generate-test-resources generate-test-resources
test-compile test-compile
test test
prepare-package dialyzer
package package
erlang-rel
Maven lifecycle phase Goal in the Maven Erlang Plug-In
initialize initialize
generate-sources extract-dependencies
process-sources reload-release-dependencies
generate-resources generate-release-resources
compile dialyzer-release
test test-release
package package-release

Setup

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

More information:

Application Upgrade File Generation

The plug-in can generate a sensible application upgrade file template for a project based on all available (local and remote repositories) earlier versions of the project.

More information:

Release Upgrade File Generation

The plug-in can generate a sensible release upgrade file template for a project based on all available (local and remote repositories) earlier versions of the project. The generation will use systools:make_relup/4 internally.

More information:

Run Projects

There is a plug-in goal to run erlang projects (optionally on a remote node) for testing purposes. Simply typing mvn clean erlang:run will start the project's application(s) 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 project code and resources will be uploaded to the specified node and the application(s) will be started there. 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 and the application resources will be uploaded. 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 must have write access to its releases directory to be able to successfully execute this goal.

More information:

Upload Tests

The upload tests goal is useful for debugging of unit tests. It works similar to the previously mentioned upload goal except that the project's test modules will also be uploaded and all modules (except the dependencies) are compiled with debug information.

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: