JBOSS dependencies for project using maven

妖精的绣舞 提交于 2019-12-05 23:02:02

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.

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.

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.

Duncan Jones

(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).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!