maven - need to create ear bundle

254 views Asked by At

I have a maven project which currently creates a war package on build. Now I need to bundle it as an ear project. Any pointers on how to do this. I added the m2e plugin and modified the pom.xml file, but, i am not able to get the directory structure as expected. I need the dir structure as below

project-name
  - project-name.ear
  - pom.xml
  - project-name.war
  - projec-name.jar
  - META-INF/application.xml

Thanks.

1

There are 1 answers

0
Adrian Shum On

It is strongly recommend that you organize your project structure in proper Maven style:

project-name/
  - pom.xml  (POM of project-name, multi-module POM)
  + project-name-jar
    - pom.xml  (main app JAR)
  + project-name-web
    - pom.xml  (WAR project to construct WAR by project-name-jar etc)
  + project-name-ear
    - pom.xml  (EAR project to construct EAR by project-name-war etc)

Normally I will have another child project call project-name-parent which use as parent POM for the whole project.

In Maven, you don't and you shouldn't have META-INF/application.xml as part of your source. It is generated dynamically base on configuration of maven-ear-plugin.