Search code examples
jakarta-eewildflyear

Where to put external jars in an EAR?


I'm building an enterprise application and I wanted to know if there is some standard way of packaging an application into an EAR. As the application server I'm using Wildfly 10.

I found multiple questions for this, but these are not state of the art (2007, 2009 etc.).

Currently I have the following components:

  • war for the static content
  • several JARs including
    • a jar for the pages and servlets
    • multiple seperate jars for the EJBs
  • external libraries which are used by the JARs

Now I want to put everything together in an EAR and I wanted to know if there is any state of the art way to do so.

I read about an APP-INF dir here, but I couldn't find anything about this in the wildfly documentation.


Solution

  • I guess that depends upon what you think "state of the art" is. The only reason to use an EAR file these days is if you need to package more than one web module and have it share classes and EJBs from other jars.

    If you have a single web module then put all your jars in the WEB-INF/lib directory of a WAR file and deploy that.

    As you have "a jar for the pages and servlets" then you should read up on web fragments in the Java Servlet Specification.