3

This might be a silly question. But I have a doubt, why do we need the following dependency to run EJB in Wildfly?

<dependency>
    <groupId>org.jboss.spec.javax.ejb</groupId>
    <artifactId>jboss-ejb-api_3.2_spec</artifactId>
    <scope>provided</scope>
</dependency>

Do we have something similar which is customized for Wildfly only?

Pritam Banerjee
  • 17,953
  • 10
  • 93
  • 108
  • 2
    To be able to compile EJB related code? You probably don't really need it, you can include the [javaee7 API](https://mvnrepository.com/artifact/javax/javaee-api/7.0) dependency instead and compile everything JavaEE related. – Gimby Nov 07 '16 at 09:27
  • @Gimby Yes. Right now it compiles and runs fine. But why do we use a jboss spec? Do we have something customized for Wildfly? – Pritam Banerjee Nov 07 '16 at 09:28
  • 1
    I wouldn't know, but in my experience JBoss/Red Hat has the custom of including all specifications inside their own dependencies so they can provide everything and the kitchen sink with one parent dependency / bill of materials. – Gimby Nov 07 '16 at 09:30
  • @Gimby Ok. I didn't find anything concrete on their website. May be I need to google a little bit more. – Pritam Banerjee Nov 07 '16 at 09:32

1 Answers1

5

Actually, you just need this maven dependency so your code can compile successfully during maven compile phase. For example, EJB annotations such as @Stateless are provided by it.

I use to declare this maven dependency instead for my Java EE 7 projects, so the whole bunch of JEE specs are available :

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

Finally this maven dependency has to be declared with "provided" scope as you don't need it within your package. Indeed it is already provided by Wildfly, as described in this documentation: Implicit module dependencies for deployments

Rémi Bantos
  • 1,899
  • 14
  • 27