Fork me on GitHub

Plugin Documentation

Goals available for this plugin:

Goal Description
nar:help Display help information on nar-maven-plugin.
Call mvn nar:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
nar:nar-assembly Assemble libraries of NAR files.
nar:nar-compile Compiles native source files.
nar:nar-download List all the dependencies which are needed by the project (for compilation, tests, and execution) and downloads the NAR files in local maven repository if needed. This includes the noarch and aol type NAR files. Technical note : the requiresDependencyResolution = ResolutionScope.TEST in the Mojo Annotation is important to get all the dependencies including test dependencies.
nar:nar-download-dependencies List all the dependencies of the project and downloads the NAR files in local maven repository if needed, this includes the noarch and aol type NAR files.
nar:nar-gnu-configure Copies the GNU style source files to a target area, autogens and configures them.
nar:nar-gnu-make Runs make on the GNU style generated Makefile
nar:nar-gnu-process Move the GNU style output in the correct directories for nar-package
nar:nar-gnu-resources Move the GNU style include/lib to some output directory
nar:nar-integration-test Run integration tests using Surefire. This goal was copied from Maven's surefire plugin to accomodate a few things for the NAR plugin:

1. To test a jar file with its native module we can only run after the package phase, so we use the integration-test phase.

2. We need to set java.library.path to an AOL (architecture-os-linker) specific value, but AOL is only known in the NAR plugin and thus cannot be set from the pom.

3. To have the java.library.path definition picked up by java we need the "pertest" forkmode. To use this goal you need to put the test sources in the regular test directories but disable the running of the tests by the maven-surefire-plugin by setting maven.test.skip.exec to false in your pom.

nar:nar-javah Compiles class files into c/c++ headers using "javah". Any class file that contains methods that were declared "native" will be run through javah.
nar:nar-package Jar up the NAR files and attach them to the projects main artifact (for installation and deployment).
nar:nar-prepare-package Create the nar.properties file.
nar:nar-process-libraries Adds the ability to run arbitrary command line tools to post-process the compiled output (ie: ranlib/ar/etc)
nar:nar-resources Copies any resources, including AOL specific distributions, to the target area for packaging
nar:nar-system-generate Generates a NarSystem class with static methods to use inside the java part of the library. Runs in generate-resources rather than generate-sources to allow the maven-swig-plugin (which runs in generate-sources) to configure the nar plugin and to let it generate a proper system file.
nar:nar-test Tests NAR files. Runs Native Tests and executables if produced.
nar:nar-test-unpack Unpacks NAR files needed for tests compilation and execution. Unpacking happens in the project target folder, and also sets flags on binaries and corrects static libraries.
nar:nar-testCompile Compiles native test source files.
nar:nar-unpack Unpacks NAR files needed for compilation. Unpacking happens in the project target folder, and also sets flags on binaries and corrects static libraries.
nar:nar-unpack-dependencies List all the dependencies of the project and downloads the NAR files in local maven repository if needed, this includes the noarch and aol type NAR files, and then unpack the files in the project target folder. This also sets flags on binaries and corrects static libraries.
nar:nar-validate Validates the configuration of the NAR project (aol and pom)
nar:nar-vcproj Generates a Visual Studio 2005 project file (vcproj) Heavily inspired by NarCompileMojo.

System Requirements

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

Maven 2.0.9
JDK 1.7
Memory No minimum requirement.
Disk Space No 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>com.github.maven-nar</groupId>
          <artifactId>nar-maven-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>com.github.maven-nar</groupId>
        <artifactId>nar-maven-plugin</artifactId>
        <version>3.5.0</version>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

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