0

I am using Apache Maven 3.0.4 to build a web service and since I am splitting my web application in different libraries using an Aggregator project I would like to have for all of them a different jar file.

I don't know if it is possible but what I would like to do is to package a war that contains all my jars, so I created a parent maven project with his pom.xml and I am including several modules that are generating the jars of my libraries.

The normal parent pom.xml is something like this:

  <artifactId>parent</artifactId>
  <packaging>pom</packaging>
  <name>Parent</name>

  <modules>
    <module>child_1</module>
    <module>child_2</module>
  </modules>

If I try to have a different packaging I get an error saying: Aggregator projects require 'pom' as packaging

There is a clean way to generate a war package including the jar packages of all my modules or a better approach to deploy my war?

luduvigo
  • 51
  • 3

1 Answers1

2

A Parent pom never produces any artifact on his own (beside the pom itself), it's just the container for multiple modules that belong together.

Nevertheless it' simple what you want to achieve. Just declare your service.jar module as a dependency in the war module and the jar will be packaged in the WEB-INF/lib folder of the war.

Here is already a good explanation: Maven: Combining multiple module jars into one war file?

Community
  • 1
  • 1
dag
  • 1,133
  • 12
  • 25