0

I use maven to create war files for my app. The war file in turn uses some 3rd party libraries. The app is run on Jboss 4.x. Now we are moving over to Jboss 7.

Some of the 3rd party libraries are provided by default in Jboss 6, hence I would not like to include them when I build my war file for it.

The problem I have is I need to support the build of war files for both versions of Jboss without doing too many changes. I need to include the 3rd party lib's in the war file if I want it to be deployed for 4.x but do not want it to be included when i do the build for Jboss7.

I looked at maven dependency but I think that is not the way. Is there any way for me to achieve it.

Vogel612
  • 5,620
  • 5
  • 48
  • 73
Chris
  • 129
  • 2
  • 8

1 Answers1

1

you could make use of maven profiles, and add a profile to package for the different JBoss versions.

For more information see: Different dependencies for different build profiles in maven

The plan then would be to include all common dependencies (wars, jars, poms) on "root level", and the specific dependencies in the profiles.

<profiles>
    <profile>
        <id>jboss-7</id>
        <dependencies>
            <!-- the special jboss 7 dependencies -->
        </dependencies>
    </profile>
    <profile>
        <id>jboss-4</id>
        <dependencies>
            <!-- the special jboss 4 dependencies -->
        </dependencies>
    </profile>
</profiles>
Community
  • 1
  • 1
Vogel612
  • 5,620
  • 5
  • 48
  • 73
  • Thanks for the tip. It solved the problem. I do not know, why I did not thought about having dependencies under profile before. Many thanks. Chris – Chris Aug 20 '14 at 07:20