Fork me on GitHub

Usage

The Device Package Maven Plugin supports multiple project types, and is configured by setting the appropriate packaging type for your project:

  • Device Profile: By using <packaging>dar</packaging>
  • Network Feature: By using <packaging>feature</packaging>
  • XDE: By using <packaging>xar</packaging>

Example:

<project>
  <groupId>com.cisco.sample</groupId>
  <artifactId>SampleDeviceProfile</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>dar</packaging>
  [...]
</project>

Once the packaging is set, update the build section to use the device-package-maven-plugin, being sure to set extensions=true, so that the custom packaging types can be registered with Maven.

Example:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>com.cisco.maven.plugins</groupId>
        <artifactId>device-package-maven-plugin</artifactId>
        <version>1.0.0</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
</project>              

NOTE: If you are using a Parent POM the version and extensions configuration can be managed centrally in the Parent POM's <build><pluginManagement> section.

SDU Creation

For the supported project types, SDU creation is disabled by default, but can be built with -DcreateSDU=true command line argument, or by configuring the plugin in the POM:

<build>
  <plugins>
    <plugin>
      <groupId>com.cisco.maven.plugins</groupId>
      <artifactId>device-package-maven-plugin</artifactId>
      <version>1.0.0</version>
      <extensions>true</extensions>
      <configuration>
        <createSDU>true</createSDU>
      </configuration>
    </plugin>
  </plugins>
</build>

Aggregated SDU of All Projects

SDU Creation is also supported on Maven aggregator projects with <packaging>pom</packaging>, but with the following caveat:

  • The aggregator POM cannot also be the Parent POM of the child device package projects. Such configuration creates a circular dependency where the Aggregator needs its modules to build first so it can create the aggregated SDU, but the child modules need the parent to build so it can inherit the POM configuration.

To resolve this, a stand-alone Parent POM must be created. The Parent POM can be used as the parent for both the aggregator POM as well as all device package projects to help ensure common configuration across all projects. It can even be listed as module of the aggregator POM.

To enable aggregated SDU creation, the create-sdu goal needs to be explicitly configured as an execution step in your aggregator POM.

Example:

<build>
  <plugins>
    <plugin>
      <groupId>com.cisco.maven.plugins</groupId>
      <artifactId>device-package-maven-plugin</artifactId>
      <version>1.0.0</version>
      <extensions>true</extensions>
      <configuration>
        <createSDU>true</createSDU>
      </configuration>
      <executions>
        <execution>
          <id>create-aggregated-sdu</id>
          <goals>
            <goal>create-sdu</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>