Project Structure for Java EE7 using Maven (Core App Ejb, Children apps Ejb)

I am trying to create a project structure using Maven and Eclipse, I uses the archetype called jboss-ee6-webapp-ear-archetype (7.1.3.Final) and It generates the structure that I want to use with 4 projects Parent,EAR,EJB and WEB. Once I get this I modify each pom files in order to work with Java EE7 and Wildfly 8, until that all is ok, but now I want to add a new project which will have the base code for this and other applications. This "core" project will have code like daos, ejbs, entities, utils and another common functionality that can be reused for EJB and Web Projects.

What is the best method to add this project?, I thought to add it as a child module as well but it creates a dependency to the parent(that is not good because it has to be shared with other projects), so I added it as a dependency (jar), nevertheless it has problem when it uses managed beans from this "core" jar. Do I need to change it to EJB project?

Answers


This "core" project will have code like daos, ejbs, entities, utils and another common functionality that can be reused for EJB and Web Projects.

It really sounds like you need to split this 'core' project into multiple subprojects before doing anything else. After you've done that, IMHO this kind of a project shouldn't really contain full EJBs, but abstract base classes that can be implemented as EJBs in the actual applications (often just by adding proper annotations/configurations). That will fix your managed beans issue and you can use it as a dependency like you should, so it will be a separate multi-module project.

Since you're planning to use Wildfly, I'd suggest taking a look into jboss modules, so you can have your shared functionality as a module that can be imported.


Need Your Help

Composer.phar cannot install dependencies

php symfony

I have been trying to install all dependencies using phar but it always give me an error