We write an application that is deployed to JBoss AS. We currently have two customers, and one is running JBoss EAP 6.1 and the other JBoss AS 7.1.1. I am converting our build system from Ant to Maven. My question has two parts.
What is the best way to specify JBoss dependencies in Maven?
I tried something like:
<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency>
and also
<dependency> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-ee</artifactId> <version>7.1.1.Final</version> <scope>provided</scope> </dependency>
but these don't include all the necessary transitive dependencies to compile. We have some JBoss-dependent code (probably not a best practice, I know). In Ant we include specific JBoss JARs (jboss-common-core-xxx.jar, jboss-ejb3-api_3.1_spec-xxx.jar, etc.) in the classpath when compiling. Is there a catch-all dependency, or am I stuck specifying individual dependencies until we use standard EE code?
How can I target two different versions of JBoss?
There are some differences in the versions of libraries that JBoss provides between EAP 6.1 and AS 7.1.1. For example, AS 7.1.1 provides jboss-jms-api_1.1_spec-1.0.0.Final.jar, and EAP 6.1 provides jboss-jms-api_1.1_spec-1.0.1.Final-redhat-2.jar.
So far I have been using Maven profiles
<profiles> <profile> <id>jboss-as-7.1.1.Final</id> <dependencies> ... </dependencies> </profile> <profile> <id>jboss-eap-6.1</id> <dependencies> ... </dependencies> </profile> </profiles>
I am not a JBoss expert, though. Does JBoss itself provide some better solution that I'm not seeing?