Setting up a new Erlang/OTP release project

When starting a new project, define a minimal POM with the following properties:

  • GROUP-ID
  • ARTIFACT-ID
  • VERSION
  • NAME
  • DESCRIPTION
  • and dependencies

    It would look something like this:

    <project>
      <modelVersion>4.0.0</modelVersion>
      <groupId>[GROUP-ID]</groupId>
      <artifactId>[ARTIFACT-ID]</artifactId>
      <version>[VERSION]</version>
      <packaging>erlang-rel</packaging>
      <name>[NAME]</name>
      <description>[DESCRIPTION]</description>
      <build>
        <plugins>
          <plugin>
            <groupId>eu.lindenbaum</groupId>
            <artifactId>maven-erlang-plugin</artifactId>
            <version>2.1.0</version>
            <extensions>true</extensions>
            <configuration>
              <otpRelease>R13B04</otpRelease> <!-- the OTP version this release must be based on -->
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <artifactId>dependency1</artifactId>
          <groupId>some.group</groupId>
          <version>1.0.0</version>
          <type>erlang-otp</type>
        </dependency>
       <dependency>
          <artifactId>dependency2</artifactId>
          <groupId>some.group</groupId>
          <version>2.0.0</version>
          <type>erlang-std</type>
        </dependency>
      </dependencies>
    </project>

    Note: This release is configured to be created using the Erlang/OTP standard applications from R13B04. Thus the executing backend node must run this OTP release. By default the backend node is spawned using the erl command in the system path. To use another OTP version the erlCommand can be set to the matching erl command.

    The following steps can be omitted when using the setup mojo. It will automatically generate the required configuration files.

    In case you want to manually configure your project, place a release file in the same directory named [ARTIFACT-ID].rel, a minimal erlang release file could look like this:

    {release,
     {${ARTIFACT}, ${VERSION}}, % will expand to the projects artifactId annd version
     ${ERTS}, % will expand to the tuple {erts, ERTS_VERSION} with the version of erts available on the backend node
     ${AUTODEPS}}. % will expand to all transitive dependencies

    If standard erlang dependencies should not be added automatically another possibility for the release file content could be:

    {release,
     {${ARTIFACT}, ${VERSION}}, % will expand to the projects artifactId annd version
     ${ERTS}, % will expand to the tuple {erts, ERTS_VERSION} with the version of erts available on the backend node
     [${APPLICATIONS}, % will expand to all transitive dependencies
      ${APPMON}, % will expand to {appmon, APPMON_VERSION} with the version of appmon available on the backend node
      ${TV}, % will expand to {tv, TV_VERSION} with the version of tv available on the backend node
      ...
     ]}.

    The system configuration sys.config and the release upgrade file relup are mandatory and must be placed in the project's root directory. Again the setup mojo will provide minimal defaults for you.

    After a call to mvn clean package the target directory should contain the release .tar.gz that can be installed using the erlang release_handler. The directory also contains the expanded release file that was packaged.

    schlager@tirana:~/project$ ls -l target/
    drwxr-xr-x 4 schlager schlager    4096 2011-02-03 14:27 lib
    -rw-r--r-- 1 schlager schlager    7631 2011-02-03 14:27 [ARTIFACT-ID]-[VERSION].boot
    -rw-r--r-- 1 schlager schlager     185 2011-02-03 14:27 [ARTIFACT-ID]-[VERSION].rel
    -rw-r--r-- 1 schlager schlager    9339 2011-02-03 14:27 [ARTIFACT-ID]-[VERSION].script
    -rw-r--r-- 1 schlager schlager 3240027 2011-02-03 14:27 [ARTIFACT-ID]-[VERSION].tar.gz
    -rw-r--r-- 1 schlager schlager      15 2011-02-03 14:27 relup