Specifying an EJB-client with Maven

Asked

Viewed 451 times

3

I am unable to use the interfaces of an EJB-client generated by Maven.

I have basically two separate projects with different functions. An EAR containing EJB’s and a WAR using EJB’s interfaces from the EAR package.

Follows structure:

  1. EAR

    1.2 - EJB

  2. WAR (with EJB-client dependency).

When I compile WAR it comes with all classes of the EJB module and not only with the interfaces necessary for its use.

Follows pom.xml of the WAR project:

<dependency>
  <groupId>br.com</groupId>
  <artifactId>dependencia-ejb</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <type>ejb-client</type>
</dependency>

2 answers

1


For those who are facing the same problem, follow the solution:

If all your projects (both the EAR containing the EJB’s and the WAR using the EJB’s client interfaces) are on the same Workspace, you must close the EJB project before generating WAR with the EJB-CLIENT interfaces, otherwise, the WAR project will be compiled with all EJB classes and not only with the required client interfaces.

0

It was not very clear your question, but from what I understand you are having problems with your EJB module interface in WAR... in this case change the pom.xml of your WAR module to the following:

<dependency>
  <groupId>br.com</groupId>
  <artifactId>dependencia-ejb</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>

Also check that your EAR project has both dependencies declared in pom.xml And also, in this case, you should package and run your project as EAR not as WAR.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.