如何使用 Maven 在 EAR 中添加 WAR
我有一个带有 EAR 的应用程序,我需要使用我自己的打包为 WAR 的代码来扩展该应用程序。有没有一个 Maven 插件可以帮助我将 WAR 放入 EAR 中?
手动过程是将WAR放入EAR中并将模块添加到application.xml中。我想自动化它。
编辑:小澄清 - WAR 项目正在使用 maven,但对于 EAR,我只有二进制文件,仅此而已。
I have EAR with an application and I need to extend this app with my own code that is packaged as a WAR. Is there a maven plugin that can help me with putting the WAR inside the EAR?
The manual procedure is to put WAR inside EAR and add module to application.xml. I would like to automate that.
EDIT: small clarification - the WAR project is using maven but for EAR I have only the binary file nothing more.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将创建一个具有
ear
的新模块。在此ear模块的依赖项中,包含您的
war
模块:现在在此ear模块的构建插件中,包含maven-ear-plugin,例如:
您可以更改根据需要
webModule
。现在创建一个父模块(使用
pom
)并向其添加 war 模块和ear 模块。确保正确设置 war 和 Ear 模块的
。当您为这个新父级运行
mvn package
时,war模块将构建一个war文件,并且ear模块将构建一个ear文件(包含war)。I'd create a new module that has
<packaging>ear</packaging>
.In the dependencies for this ear module, include your
war
module:Now in the build plugins for this ear module, include the maven-ear-plugin like, e.g.:
You can change the specific configuration values for the
webModule
as required.Now create a parent module (with
<packaging>pom</packaging>
) and add the war module and the ear module to it. Make sure you set the<parent>
of the war and ear modules corrently.When you run
mvn package
for this new parent, a war file will be built by the war module and an ear file (containing the war) will be built by the ear module.添加 WAR 作为依赖项并使用 maven Ear 插件。然后使用 ear:generate-application-xml 目标,最后是 ear:ear 目标。
Add WAR as dependency and use maven ear plugin. Then use ear:generate-application-xml goal and finally ear:ear goal.