Page tree

 

Describes how to deal with project types BOM, Non-POM, and multi-module POM.

Dependent of the project type, the configuration of the plugin is slightly different.

BOM

Projects that define a bill of materials (BOM) per default also export dependencies in the dependency management block as modules.

<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>

  <groupId>de.smartics.maven.plugin</groupId>
  <artifactId>bom-pom</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>

  <dependencyManagement>
    <dependencies>
      <!-- These dependencies will be exported -->
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>de.smartics.maven.plugin</groupId>
        <artifactId>smartics-jboss-modules-maven-plugin</artifactId>
        <version>2.1.5</version>
        <executions>
          <execution>
            <id>create-modules-archive</id>
            <goals>
              <goal>create-modules-archive</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Non-POM

Non-POM projects (eg. projects of type 'jar') export dependencies as modules, but not dependencies in the dependency management block.

<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>

  <groupId>de.smartics.sandbox</groupId>
  <artifactId>jar-project</artifactId>
  <version>1.0.0</version>
  <packaging>jar</packaging>

  <dependencyManagement>
    <dependencies>
      <!-- These dependencies will NOT be exported -->
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- These dependencies will be exported -->
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>de.smartics.maven.plugin</groupId>
        <artifactId>smartics-jboss-modules-maven-plugin</artifactId>
        <version>2.1.5</version>
        <executions>
          <execution>
            <id>create-modules-archive</id>
            <goals>
              <goal>create-modules-archive</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Multi-module POM

To handle projects of type 'pom' to not export dependencies defined in the dependency managment block. This approach is useful in case of multi-module projects.

<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>

  <groupId>de.smartics.sandbox</groupId>
  <artifactId>multimodule-project</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>

  <dependencyManagement>
    <dependencies>
      <!-- These dependencies will NOT be exported -->
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- These dependencies will be exported -->
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>de.smartics.maven.plugin</groupId>
        <artifactId>smartics-jboss-modules-maven-plugin</artifactId>
        <version>2.1.5</version>
        <executions>
          <execution>
            <id>create-modules-archive</id>
            <goals>
              <goal>create-modules-archive</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
        <configuration>
          <excludeDependencyManagementDependenciesInPomProject>true</excludeDependencyManagementDependenciesInPomProject>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>