viartemev
viartemev

Reputation: 301

Maven multi-project library dependency

I have the enterprise project (*.ear), what packaged by maven. Ear file have include many files:

final.ear
|-lib
|-META-INF 
|--web.war
|--bla-bla.jar
|--web-bla.war

Each file (jar, war) packaged by maven.
1) How put all required libraries from all files (war, jar) into final.ear/lib?
2) How group libraries from /lib, for example: lib/axis, lib/logging?

Upvotes: 0

Views: 85

Answers (2)

Gimby
Gimby

Reputation: 5274

1 EJB jar) in the pom.xml of the jar make the dependency "not provided" so Maven knows the dependency is needed on the runtime classpath and thus to be deployed with the application - that will trigger it to add it to the ear/lib.

1 war) Basically what you describe here is that "instead of packaging the dependency with the war, package it in the parent EAR". In Maven terms you then add the dependency to the pom.xml of the ear (so it is on the runtime classpath there), and you mark the dependency as provided in the pom.xml of the war (so it is on the compile time classpath but not on the runtime classpath there). OR use the skinny wars feature as Steve C suggests.

2) The only way I would see this happening is if you micromanage the dependencies in the pom.xml of the ear entirely:

http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-module-location.html

Upvotes: 1

Steve C
Steve C

Reputation: 19445

Using the Maven EAR Plugin - Skinny Wars feature has worked well for me for this problem.

Upvotes: 1

Related Questions