开发者

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

开发者 https://www.devze.com 2022-12-30 03:53 出处:网络
I currently have a project built with maven-archetype-webapp artifact. The default packaging for this project is war.

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 开发者_JS百科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.


The maven ear plugin assumes that any WAR is a separate project, so you need two projects, plus a parent project. It's a function of how maven does packaging. Each project produces one artifact. There are ways around this, but Maven will punish you for your sins. This question goes into some detail on this topic.

0

精彩评论

暂无评论...
验证码 换一张
取 消