esacchi
esacchi

Reputation: 23

Maven EAR project for multiple application servers

I have a EAR project that I want automatize the building process using maven exclusively.

The EAR project has

To be able to execute the product in Jboss 4.2.3 and WebSphere 7 the EJB and RAR descriptors must be configured in different way. Also we have one jar library for each app server.

What I want is to be able to build one EAR for each apps server using the same projects, and for that I need

  1. Include a JAR module depending of the app server
  2. Use the customized descriptor in the EJB/RAR modules depending of the app server
  3. Package all this customized modules in an EAR

Can this be done using the same set of project in maven?

Upvotes: 2

Views: 431

Answers (2)

khmarbaise
khmarbaise

Reputation: 97517

The best is to create separate modules like ear-websphere, or ear-jboss and make an appropriate pom file which contains the needed configuration for maven-ear-plugin.

Upvotes: 0

mamboking
mamboking

Reputation: 4637

Sure. Have a look at profiles in maven. They allow you to adjust various things (from the link) like:

  • <repositories>
  • <pluginRepositories>
  • <dependencies>
  • <plugins>
  • <properties> (not actually available in the main POM, but used behind the scenes)
  • <modules>
  • <reporting>
  • <dependencyManagement>
  • <distributionManagement>
  • a subset of the element, which consists of:
    • <defaultGoal>
    • <resources>
    • <testResources>
    • <finalName>

Upvotes: 3

Related Questions