user623941
user623941

Reputation: 739

How to specify a classpath for a module in application.xml for an EAR

So I have an EAR that contains all of my modules. The shared JARs that are used by all the modules are placed in the default ./lib/ folder of the EAR. I also have multiple version of a JAR file that each module will use a version of. For example, if I have the following wars in my EAR:

project1.war
project2.war
project3.war

And I have a couple of JAR files:

common-classes-1.0.jar
common-classes-1.1.jar

So, how can I associate project1 with common-classes-1.0.jar, and project2 and project3 with common-classes-1.1.jar?

Thanks in advance

Upvotes: 2

Views: 919

Answers (2)

Luciano Fiandesio
Luciano Fiandesio

Reputation: 10207

Alternatively, you can "repackage" your war files to include the desidered commons Jars. In this way, you can keep a single EAR file.

Upvotes: 1

skaffman
skaffman

Reputation: 403441

You can't; EARs don't have that level of fine control over their classpath, unless your app-server has non-standard extensions that let you do this.

This is the sort of use-case that OSGi was designed for, but standard JavaEE EARs can't do this.

Your simplest option is to break up your EAR into 2, one with project1.war and common-classes-1.0.jar, and the other with project2.war, project3.war and common-classes-1.1.jar.

Upvotes: 1

Related Questions