4

This should be simple but can't figure it out. I have a web project that is built using Maven and will be deployed on a JBOSS-EAP 5.1 server. What do I add to my pom.xml so that Maven has access to the JBOSS EAP libraries at build time?

Is there a particular dependency or plugin I can use?

Duncan Jones
  • 67,400
  • 29
  • 193
  • 254
CodeClimber
  • 4,584
  • 8
  • 46
  • 55

5 Answers5

3

Considering JBoss is an EE container, adding the JavaEE dependency should be enough.

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
</dependency>

Scope provided ensures that JBoss's own libraries are used once the application is deployed to the server.

Vedran
  • 10,369
  • 5
  • 50
  • 57
1

You have to first identify what exactly are your projects dependencies and add them as dependencies in your pom.xml. Now identity what all are available with jboss and make the scope of those dependencies as <scope>provided</scope> so that it is not bundled with war. During build time maven will have to take the jars from maven repository.

basiljames
  • 4,777
  • 4
  • 24
  • 41
  • that's the good (manual) way, but it could be easier to define all the JBoss dependencies as provided scope with just one dependency like org.jboss.as:jboss-eap:5.1.0.GA:pom (and its related dependencies) in a provided scope : so nobody has done that work ? – Donatello Nov 26 '14 at 13:39
1

AFAIK this is a feature for EAP 6, and experimental even at that. See more information from here and here:

A magnificent enhancement to the previous version is, that the EAP 6 ships with a Maven repository, which includes all EAP-related Maven artifacts. The missing maven repository was a big disadvantage of previous EAP versions. The required Maven artifacts had to be manually deployed from the EAP distribution into your own local Maven repository or into your enterprise Maven repository like Nexus or Artifactory.

So no, I don't think such repository exists for Jboss EAP 5.X.

This means that in practice you have the following choices, from most recommended to the least:

  • Have an intranet repo, such as Nexus or Artifactory, and install the items there. Then you can refer to them as dependencies from your pom. This option is recommended.
  • Install them locally only into each developers local maven repo. You would use mvn install-file for this, and each developer would need to do this by themselves. After that, each dependency could be referenced from pom in the way other dependencies are.
  • Use system scope on your pom, pointing directly to the libraries stored somewhere on your hard drive. This would be a fragile setup, easy to break.

It shouldn't be too hard to just store the libraries on your intranet repository and use that. Having an intranet repo for developers is a best practice you should be using anyway.

eis
  • 51,991
  • 13
  • 150
  • 199
  • See what I did above. Just used a generic Java EE dependency as opposed to a specific JBOSS one. Your answer was closest to answering what I asked so have marked it as accepted answer. – CodeClimber Sep 14 '12 at 16:03
  • Yes, using just a generic JEE dependency is the recommended way, and only using JBoss-specifics if absolutely neccessary. I had the same recommendation in my answer, but changed it due to not really fitting what was asked. Glad it worked out that way :) – eis Sep 20 '12 at 13:28
1

Jboss packages are available now (and have been for some years) at

        <repository>
            <id>jboss-repository</id>
            <name>JBoss Repository</name>
            <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
        </repository>
motobói
  • 1,687
  • 18
  • 24
0

(Below is the answer that the OP erroneously included in the question)

What I did in the end was add the following dependency to my pom:

    <dependency>
        <groupId>javax.j2ee</groupId>
        <artifactId>j2ee</artifactId>
        <version>1.5</version>
        <scope>provided</scope>
    </dependency>

Not a direct answer to what I asked (I asked specifically about JBOSS) but it gives me all the Java EE APIs I need to compile. I can't running anything using this as it doesn't implement any of the APIs - this is provided by my Java EE app server (JBOSS in this instance).

Community
  • 1
  • 1
Duncan Jones
  • 67,400
  • 29
  • 193
  • 254