Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Code Block
languagexml
titlePOM Skeleton
linenumberstrue
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <!-- (1) -->
    <parent>
        <artifactId>snap-engine</artifactId>
        <groupId>org.esa.snap</groupId>
        <version>2.0.0-SNAPSHOT</version>
    </parent>

    <artifactId>mymod</artifactId>
 <!-- (2) -->
  <packaging>nbm</packaging>  <artifactId>mymod</artifactId>
    <name>Human<!--readable mymod name</name>(3) -->
    <description>Human-readable mymod description.</description>

    <dependencies>
  <packaging>nbm</packaging>

    <!-- The following 3rd-party dependency will result in a private 
(4) -->
    <name>Human-readable mymod name</name>
    <!-- (5) -->
    <description>Human-readable JAR located in ${cluster}/modules/ext/org.esa.snap.mymod/jdom2.jar.mymod description.</description>

    <dependencies>
       Another NB module depending on mymod and wanting to use jdom2
             does not need to import it explicitely again as long as you export 
             its API as a public package(s). See below.
 If you don't export the jdom2 API, a second private ext-JAR will be 
 created in the cluster.
         -- <!-- (6) -->
        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom2</artifactId>
            <version>2.1</version>
        </dependency>
        <!-- The following are NB-module dependencies from which the manifest header
             OpenIDE-Module-Module-Dependencies will be derived.             
         --(7) -->
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-ceres-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.esa.snap</groupId>
            <artifactId>snap-core</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- (8) -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>nbm-maven-plugin</artifactId>
                <configuration>
                    <publicPackages>
                        <!-- optionally export API from 3rd parthy JARs(9) -->
                        <publicPackage>org.jdom2.*</publicPackage>
                        <!-- optionally export API from myext (10) -->
                        <publicPackage>org.esa.snap.myext</publicPackage>
                        ...
   </publicPackages>
                </publicPackages>configuration>
                </configuration>plugin>
            </plugin>!-- (11) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <useDefaultManifestFile>true</useDefaultManifestFile>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

  1. Use the parent for extension modules.
  2. The artifactId will be used with the group id to generate the manifest header OpenIDE-Module-Module. The groupId and version are inherited from parent here.
  3. Packing must always be nbm to generate NBM files.
  4. Name will generate the manifest header OpenIDE-Module-Name
  5. Description will be used to generate OpenIDE-Module-Short-Description
  6. This 3rd-party dependency will result in a private JAR located in ${cluster}/modules/ext/org.esa.snap.mymod/jdom2.jar. Another NB module depending on mymod and wanting to use jdom2 does not need to import it explicitely again as long as you export its API as a public package(s). See below. If you don't export the jdom2 API, a second private ext-JAR will be created in the cluster.
  7. The following are NB-module dependencies from which the manifest header OpenIDE-Module-Module-Dependencies will be derived.
  8. Required declaration of the  Maven NBM plugin.
  9. Optinally export the 3rd party jdom2 API so that other modules don't need to import the JAR. 
  10. Optionally export API from myext.
    Note that org.esa.snap.myext only exports classes in the myext  package, while the value org.esa.snap.myext.* exports myext plus all subpackages, recursively.
  11. Required declaration of the Maven JAR PluginuseDefaultManifestFile must be set to true.