Maven vs. Eclipse Project Facets for Java EE 6

时光怂恿深爱的人放手 提交于 2019-12-05 06:30:33

Eclipse facets and maven archetypes are orthogonal - i.e. they have no influence on each other, or rather no knowledge of each other. You can safely add the facets if it will facilitate your work with eclipse.

After some experimenting I think I have something that works (except that I cannot get m2e to accept Java 1.7 for EJBs).

Versions:

  • Eclipse Juno 4.2
  • m2e 1.3.1
  • GlassFish 3.1.2
  • JDK 1.7.0_17 (Oracle)

IMPORTANT USAGE NOTE: With the setup below, you should disable automatic publishing to GlassFish ("Never publish automatically") if you want to run Maven clean & install. For the usual editing and saving work in Eclipse, automatic publishing can be enabled and seems to work fine. Only when starting Maven explicitly (inside Eclipse) did I encounter problems.

Setting up an EJB project with Maven in Eclipse

Create Maven projects in Eclipse with these archetypes:
 ejb-javaee6
 ear-javaee6
 webapp-javaee6

webapp-javaee6
--------------
- Convert to faceted form, select GlassFish in Runtimes and enable:
  - Dynamic Web Module
  - GlassFish Deployment Descriptors Files
  - Java
  - JavaScript
  - JavaServer Faces
  Further configuration available...
  - Content directory: src/main/webapp
  - NOT checked: Generate web.xml deployment descriptor
  - JSF Capabilities (all defaults): JSF 2.1 + PrimeFaces selected
    CHECKED: "Include libraries with this application"

ejb-javaee6
-----------
- Convert to faceted form, select GlassFish in Runtimes and enable:
  - EJB Module
  - GlassFish Deployment Descriptors Files
  - Java
  Further configuration available...
  - NOT checked: Generate ejb-jar.xml deployment descriptor

ear-javaee6
-----------
- Convert to faceted form, select GlassFish in Runtimes and enable:
  - EAR
  - GlassFish Deployment Descriptors Files
  Further configuration available...
  - Add EJB and WEB projects as dependencies
  - Content directory: src/main/application (META-INF location used by Maven)
  - NOT checked: Generate application.xml deployment descriptor
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!