jenne
jenne

Reputation:

Packaging Maven multi-module project

I have a multi-module project that looks like this:

Module1
   Sub-moduleEar 
   Sub-moduleJar
   Sub-moduleEJB
   Sub-moduleWar

Module2
   Sub-moduleEar
   Sub-moduleJar
   Sub-moduleWar
   Sub-moduleEJB

Is it possible to package Module1 and Module2 together in one file for deployment?

Upvotes: 0

Views: 92

Answers (1)

Avinash Babu
Avinash Babu

Reputation: 6252

You could use maven dependency plugin

You have to add the lines of codes below to the pom of all submodules.

<build>
    <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <execution>             
              <id>copy-artifact</id>
              <phase>package</phase>
              <goals>
                <goal>copy</goal>
              </goals>
              <configuration>
                <artifactItems>
                    <artifactItem>
                      <groupId>${project.groupId}</groupId>
                      <artifactId>${project.artifactId}</artifactId>
                      <version>${project.version}</version>
                      <type>${project.packaging}</type>
                    </artifactItem>
                </artifactItems>
                <outputDirectory>../Main/target/dependencies</outputDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>
    </plugins>
</build>

See this.It would be helpful.

Upvotes: 2

Related Questions