Fernando
Fernando

Reputation: 146

Different maven dependencies for different application servers

I have an artifact used in two different application servers, WL103 and JBOSS 7. This artifact needs differents dependencies in each server, basically needs the wlthint3client.jar when is deployed in JBOSS.

What is the better way to manage this? Two different main poms in the same maven project, one for each application server?

Upvotes: 0

Views: 513

Answers (1)

tmarwen
tmarwen

Reputation: 16354

The best approach is to use two different profiles for each Application Server in the same Project Object Model deescriptor and the activation of the profiles could be done regarding some properties:

<profiles>
<profile>
  <id>pkg-all</id>
  <activation>
    <property>
      <name>targetedAS</name>
    </property>
  </activation>
  <modules>
    <module>jboss</module>
    <module>weblogic</module>
  </modules>
</profile>
<profile>
  <id>pkg-jboss</id>
  <activation>
    <property>
      <name>targetedAS</name>
      <value>jboss</value>
    </property>
  </activation>
  <modules>
    <module>jboss</module>
  </modules>
</profile>
<profile>
  <id>pkg-weblogic</id>
  <activation>
    <property>
      <name>targetedAS</name>
      <value>weblogic</value>
    </property>
  </activation>
  <modules>
    <module>weblogic</module>
  </modules>
</profile>

If you are not already familiar with Maven profiles you can refer to the official documentation.

Upvotes: 1

Related Questions