0
votes

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.

  1. 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?

  2. 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?

1

1 Answers

0
votes

Try to use the jboss BOM (Bill of Materials), so you can just define which BOM version you are going to use and you'll be sure to get the correct versions of artifacts.

this articles will help you : Maven and JBoss: how to use BOMs to keep releases in sync