Maven - Module

Card Puncher Data Processing

About

module management in Maven.

A multi-module project is defined by a parent POM referencing one or more sub-modules. The mechanism in Maven that handles multi-module projects is referred to as the reactor.

A parent project with pom packaging does not have any resources, it is just a build file, that can be installed/deployed as an artifact.

Structure

The parent POM (also called the top-level POM)

<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>net.bytle</groupId>
    <artifactId>bytle-parent</artifactId>
     <version>1.0</version>
    <packaging>pom</packaging>

    <name>Multi Module Parent Project</name>

    <modules>
        <module>client</module>
        <module>application</module>
        <module>web-app</module>
    </modules>
    
    <!--Global Element such as dependency-->
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

where:

  • groupid, artifactid, version are the project Id
  • the pom packaging indicates that this is a parent PO
  • Each sub-module is represented by a sub-directory in the same directory as pom.xml

Idea

Idea Maven Module

Documentation / Reference





Discover More
Card Puncher Data Processing
Maven - Package

Packaging in Maven. Package is a phase that bundle the code in a way suitable to be distributed. By default, this phase will take the compiled code and make an archive of it as define in the packaging...
Card Puncher Data Processing
Maven - Reactor (Multiple Module)

The mechanism in Maven that handles Multiple Module projects is referred to as the reactor. To build module Foo and its module dependency See mvn...
Card Puncher Data Processing
Maven - test jar

A test jar is a jar file used to share test code between module. In two steps: Creating the test jar that is shared with the other modules (ie all test class will be package in a test jar) ...



Share this page:
Follow us:
Task Runner