Maven: how to build jar and include as a dependency

91 views Asked by At

I have a multi module project. I am using eclipse and Maven 3. I wish to first build a jar (a standalone project with its own pom). This is not the problem.

The problem is this jar is included as a dependency of my multi-module EAR project (used by two of the wars). The code of the JAR will often change and will require building before the EAR project is built.

How can I make this jar build prior to the EAR build in one action?

Here's my setup:

parentProject (packaging=pom, dependency[filters down to wars]=jarProject)
earproject (packaging ear, parent=parentProject)
war1Project (packaging war, parent=parentProject)
war2Project (packaging war, parent=parentProject)
jarProject (packaging=jar, no parent)
1

There are 1 answers

5
Gerold Broser On BEST ANSWER

Add your jar project as topmost <module> in your multi-module EAR project's POM.

See also Maven: The Complete Reference, Multi-module vs. Inheritance.