For many years acting as a JBoss Enterprise Middleware consultant, many customers among many other requests wanted to:
- Migrate their existing applications to a Maven build
- Migrate their existing Maven applications to a JBoss Stack
- Start the development of a new application using the JBoss Stack and our best practices and solutions.
The Java EE spec is an umbrella spec to another specs. Each one with its different versions (JSF 2.0, JPA 2.0, Servlet 3.0, EJB 3.1, etc). Developers shouldn't mix different APIs versions from different JAVA EE specs. The application should be targeted to only one Java EE spec. The same recommendation applies not only to spec APIs but also with other dependencies whose its API could change on each version.
Well, there were situations where the existing Maven applications were using different versions of spec APIs (Java EE 4, 5, 6) on the same project or were using dependencies of versions that were not planned to use on the version of their existing JBoss infrastructure.
The BOM concept.
For that reason the BOM (Bill of Materials) concept in Maven addresses this kind of issue very well and I have always recommended it to our customers. BOM's are maven pom.xml files that specify the versions of all runtime dependencies for a given module or project. Fortunately Red Hat is helping the developers to use this kind of approach for Java EE 6 projects by providing all Java EE 6 APIs as Maven dependencies.
The new JDF (JBoss Developer Framework) that was announced in June, provides an easy way to add Java EE spec and also the JBoss tools/projects/products (errai, hibernate, arquilian, etc) dependencies to your project.
The JBoss BOMs project provides Maven BOM files enhancing Jave EE 6 with deployment and test tooling. These files manage the version of the dependencies you use in your project, ensuring you always get a compatible stack." (JDF JBoss BOM Site)
The list of all these JBoss BOMs can be found at http://www.jboss.org/jdf/stack/jboss-bom/
Can it be easier ? - JDF plugin announcement
Sure it can!. JDF has a plugin to JBoss Forge that helps the using of the JBoss BOMs in your Maven Project. To use it, first you need to install the plugin running the following command at Forge prompt:
$ forge install-plugin jdf
This command will trigger the installation proccess of the JDF plugin in to JBoss Forge. To see the list of all available JBoss BOMs you can run:
$ jdf show-stacks
After evaluating what is the best Stack for your project, simply run the jdf use-stack command.
$ jdf use-stack --stack
$ jdf use-stack --stack
You can add more than one Stack to your project.