Mark W
Mark W

Reputation: 5964

Maven: how to build jar and include as a dependency

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)

Upvotes: 0

Views: 80

Answers (1)

Gerold Broser
Gerold Broser

Reputation: 14762

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.

Upvotes: 1

Related Questions