Search code examples
mavendependenciespom.xml

What is the difference between the dependency types ejb and ejb-client


What is the difference if you include a dependency in your pom.xml like

<dependency>
    <groupId>group.Id</groupId>
    <artifactId>artifact.Id</artifactId>
    <type>ejb-client</type>
    <scope>runtime</scope>
</dependency>

versus

<dependency>
    <groupId>group.Id</groupId>
    <artifactId>artifact.Id</artifactId>
    <type>ejb</type>
    <scope>runtime</scope>
</dependency>

Solution

  • The ejb type refers to a jar file containing the ejb interfaces and implementation, config files, etc.

    The ejb-client type refers to a jar file containing just the ejb interface classes. ie. only what is needed by a client of the ejb in order to invoke it.

    The maven-ejb-plugin has default or customized in its configuration, that allows for the EJB implementation classes to be excluded from the client.