java – Specifying an EJB-client with Maven


I'm not able to use the interfaces of an EJB-client generated by Maven.

I basically have 2 separate projects with different functions. An EAR that contains EJB's and a WAR that uses interfaces from the EJB's from the EAR package.

Here's structure:

  1. EAR

    1.2 – EJB

  2. WAR (with EJB-client dependency).

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

Here is pom.xml from the WAR project:



For those who are facing the same problem, here is the solution:

If all your projects (both the EAR that contains the EJB's and the WAR that uses the EJB's client interfaces) are in the same workspace, you must close the EJB project before generating the WAR with the EJB-CLIENT interfaces, otherwise , the WAR project will be compiled with all the EJB classes and not just the required client interfaces.

Scroll to Top