Plugin Documentation

Goals available for this plugin:

GoalReport?Description
erlang:compileNoThis Mojo compiles the projects erlang sources and SNMP files.
erlang:copy-resourcesNo

This Mojo copies the private resources to the AbstractErlangMojo.targetPriv directory. Default source folders for private resources are AbstractErlangMojo.srcMainPriv and AbstractErlangMojo.srcMainResourcesPriv.

erlang:copy-test-resourcesNo

This Mojo copies test resources to the AbstractErlangMojo.targetTest directory. Default source folders for test resources are AbstractErlangMojo.srcTestResources.

erlang:coverageYesGenerates a test coverage report with: project summary, showing the number of functions, clauses executable lines and their test coverage percentage. A module list with individual coverage reports and an extensive source code report, with lines annotated in red or green, showing the exact coverage.
erlang:dialyzerNo

This Mojo runs the erlang dialyzer tool on the project sources found in AbstractErlangMojo.srcMainErlang as well as the project includes in AbstractErlangMojo.srcMainInclude. This means dialyzer will run over the complete project code (excluding test modules).

The dialyzer can be skipped using the useDialyzer parameter in the projects pom. Additionally, the user can choose to run dialyzer also on the projects dependencies using the dialyzerWithDependencies pom parameter. This is disabled by default for the erlang-otp application packaging.

erlang:dialyzer-releaseNo

This Mojo runs the erlang dialyzer tool on a complete release found in AbstractErlangMojo.targetLib. The dialyzer can be skipped using the useDialyzer paramter in the projects pom. Since this Mojo is called in order to check a complete release it is run over all release dependencies.

erlang:docYes

This Mojo will generate EDoc documentation for the sources found in AbstractErlangReport.srcMainErlang.

The output will be put into AbstractErlangReport.targetSite/doc. The user may specify custom EDoc options in the project pom using the eDocOptions parameter.

BUG It is known that edoc does not generate a charset meta tag for the resulting html output.

BUG It is known that doxia overwrites the reports index.html with a broken template when the report is invoked as standalone.

erlang:packageNo

This Mojo packages all application artifacts into a single .tar.gz package. This includes .beam files, the .hrl include files, SNMP resources, private data from the priv and resources directories and non-erlang sources.

Besides that this Mojo also copies the erlang application resource file. In order to manage the project over the project pom there is the possibility to let the Mojo automatically fill in values from the project pom into the .app file. This can be done by using one of the supported variables into the application resource files. Below is a list of supported variables and their substitutions:

  • ${ARTIFACT}: the projects artifact id (atom)
  • ${DESCRIPTION}: the projects description (string)
  • ${ID}: the projects id (string)
  • ${VERSION}: the projects version (string)
  • ${MODULES}: all compiled .beam files found in the target ebin folder (list)
  • ${REGISTERED}: all registered names, based on the -registered(Names). attribute retrieved from the compiled .beam files (list)

In case there is no application resouce file specified the Mojo will generate a default .app file which looks like this:

{application, ${ARTIFACT},
  [{description, ${DESCRIPTION}},
   {id, ${ID}},
   {vsn, ${VERSION}},
   {modules, ${MODULES}},
   {maxT, infinity},
   {registered, ${REGISTERED}},
   {included_applications, []},
   {applications, []},
   {env, []},
   {mod, undefined},
   {start_phases, []}]}.

The resulting application resource file as well as the application upgrade file will be checked for plausability regardless if generated or not. This is done by checking the application version against the project version, checking the application modules against the found compiled modules as well as checking the application's start module.

erlang:package-releaseNo

This Mojo packages creates a release .tar.gz using the erlang systools modules make_tar/2 function.

The build can be customized by providing additional options through the tarOptions parameter in the specific project pom. By default all release dependecies will be packaged including their ebin, include, mibs and non-erlang source directories.

erlang:prepare-releaseNo

This Mojo prepares the packaging of a release .tar.gz package by creating the release upgrade/downgrade scripts as well as the boot and start scripts. The scripts are created using the erlang systools modules make_relup and make_script functions.

The builds can be customized by passing user options through the scriptOptions and relupOptions parameters in the specific project pom. In order to manage the project over the project pom there is the possibility to let the Mojo automatically fill in values from the project pom into the .rel file. This can be done by using one of the supported variables into the release file. Below is a list of supported variables and their substitutions:

  • ${ARTIFACT}: the projects artifact id (atom)
  • ${VERSION}: the projects version (string)
  • ${APPLICATIONS}: a list of the project dependencies application and version tuples
  • ${APPLICATION_NAME}: will be replaced by a string representing the available application version on this host

In case there is no release file specified the Mojo will generate a default .rel file which looks like this:

{release,
  {${ARTIFACT}, ${VERSION}},
  {erts, ${ERTS}},
  [{kernel, ${KERNEL}}, 
   {stdlib, ${STDLIB}}] ++ ${APPLICATIONS}}.

The resulting release file will be checked for plausability regardless if generated or not. This is done by checking the release version against the project version and checking all dependency versions against the application versions in the release file.

In order to create the release downgrade/upgrade script the Mojo also needs a list of versions to upgrade from or to downgrade to. If the user chooses to not specify both lists the release script generation will be skipped.

TODO The generation of relup files has not yet been tested.

erlang:runNo

This Mojo runs a, erlang-otp packaged project interactively in a shell. Therefore an erlang shell with sasl is started and the application is started using application:start/1. To package and start the application simply use

mvn erlang:run


BUG It is known that control characters cannot be used in the interactive shell.

TODO Running release projects is currently not supported, but could be useful to be implemented in the future.

erlang:setupNo

Utility goal that will setup a new Erlang/OTP Maven project, creating the basic resources and folders required, from a best practice point of view.

This will typically replaces the functionality given by a Maven archetype, checking and creating any missing resource:

  • src/main/erlang
  • src/main/erlang/[artifactId].app
  • src/main/include
  • src/main/priv
  • src/test/erlang
  • src/test/include
  • src/site/site.xml
  • src/site/apt/index.apt[.vm]
  • src/changes/changes.xml
erlang:testNo

Mojo running test cases.

This Mojo will either run a specific test case (if the user specified one using -Dtest=test_module_test) or run all test cases found in the AbstractErlangMojo.srcTestErlang directory.

The user can also choose to skip testing by specifying -DskipTests. A test code coverage will automatically be applied. A report about the test coverage may be created using the CoverageReport.

erlang:test-compileNoCompile erlang test sources and recompile erlang sources with debug information using the export_all option.
erlang:test-docYes

This Mojo will generate EDoc documentation for the test sources found in AbstractErlangReport.srcTestErlang.

The output will be put into AbstractErlangReport.targetSite/test-doc. The user may specify custom EDoc options in the project pom using the eDocOptions parameter.

BUG It is known that edoc does not generate a charset meta tag for the resulting html output.

BUG It is known that doxia overwrites the reports index.html with a broken template when the report is invoked as standalone.

erlang:unpack-dependenciesNoUnpack erlang-otp dependencies. This will unpack all dependencies of this MavenProject into the AbstractErlangMojo.targetLib directory. This is done only in case the dependency has changed since the last unpack process.

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven2.0
JDK1.6
MemoryNo minimum requirement.
Disk SpaceNo minimum requirement.

Usage

You should specify the version in your project's plugin configuration:

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>eu.lindenbaum</groupId>
          <artifactId>maven-erlang-plugin</artifactId>
          <version>1.0.0-beta</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>eu.lindenbaum</groupId>
        <artifactId>maven-erlang-plugin</artifactId>
        <version>1.0.0-beta</version>
      </plugin>
      ...
    </plugins>
  </build>
  ...
  <!-- To use the report goals in your POM or parent POM -->
  <reporting>
    <plugins>
      <plugin>
        <groupId>eu.lindenbaum</groupId>
        <artifactId>maven-erlang-plugin</artifactId>
        <version>1.0.0-beta</version>
      </plugin>
      ...
    </plugins>
  </reporting>
  ...
</project>

For more information, see "Guide to Configuring Plug-ins"