How to generate an ear file from a maven-archetype-webapp artifact?

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-05-15T02:20:44Z Indexed on 2010/05/15 2:24 UTC
Read the original article Hit count: 301

Filed under:
|
|
|
|

I currently have a project built with maven-archetype-webapp artifact. The default packaging for this project is war.

Is it possible for me to insert the maven-ear-plugin in this webapp pom.xml generate an ear file that contains this project war? I tried that, but the war file doesn't get embedded in the generated ear file. It has everything except the war file.

I read many Maven related articles, and perhaps I could use maven-archetype-j2ee-simple artifact. However, I'm reluctant to this use for 2 reasons:-

  • This artifact handles ejbs and all the extra features that I don't use. It makes my project looks bloated.
  • Second, it seems like it requires me to install the web module into the repository first before I can create the ear file. Is this the preferred way to create an ear file?

How do I create an ear file that contains the war file using maven-ear-plugin from my webapp's pom.xml? If this way is not possible, what's the preferred way?

I'm sorry if my questions sound a little novice, I realized I have whole lot more to learn about Maven.

Thanks much.

© Stack Overflow or respective owner

Related posts about maven

Related posts about ear