문제

I want to create a JSF2.2 + EJB3 + JPA2 project from scratch. The structure should look something like:

myapp-ejb
myapp-web
myapp-ear

And I'll package my project as a EAR file then deploy it on JBoss WildFly application server. I'm struggling about which archetype should I use to do that. Thanks!

도움이 되었습니까?

해결책

Maven comes already with some default archetypes for mentioned project types and there is also some vendor specific maven archetypes. Meanwhile you should note that there is no convention rule to follow for creating a J2EE application project with maven (that's what you are trying to achieve ;) )

You can use the maven-archetype-j2ee-simple to generate a project with related modules for ear, dynamic webapps, ejbs...:

mvn archetype:generate -DgroupId=org.apache.maven.archetypes -DartifactId=maven-archetype-j2ee-simple

Or create some parent project then each module on its own and import then all modules in the same project, and here you can find a list for basic archetypes you can use.

You should then configure the related plugins for each project/module:

Finally here is a maven archetype I would use for sample Java EE application generation: org.jboss.weld.archetypes:weld-jsf-jee which, from description, Weld archetype for creating a Java EE 6 application using JSF 2.0, CDI 1.0, EJB 3.1 and JPA 2.0 (persistence unit included).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top