Specifying an EJB-client with Maven

3

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

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

Following structure:

  • EAR

    1.2 - EJB

  • WAR (with EJB-client dependency).

  • When compiling the WAR it comes with all classes of the EJB module and not only with the interfaces needed for its use.

    Following 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>
    
        
    asked by anonymous 31.01.2014 / 16:55

    2 answers

    1

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

    If all of your projects (both the EJBs that contain the EJBs and the WAR that use the EJBs client interfaces) are in the same workspace, you should close the EJB project before generating the 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.

        
    13.02.2014 / 19:51
    0

    Your question was not very clear, but from what I understand you have 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.

        
    12.02.2014 / 18:46