自动使用maven定制战争文件 [英] Automate custom war files using maven

查看:130
本文介绍了自动使用maven定制战争文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Maven的战争叠加,但他们认为原来的战争文件是Maven项目。

I know about maven war overlays, but they assume that the original war file is a maven project.

如果我只能访问打包war文件,我需要通过增加新资源或文件中使用Maven和推新夸大打包war文件在服务器上的Tomcat的属性进行更新几个值进行修改?

What if I only have access to the packaged war file and I need to modify it by adding new resources or updating few values in properties file using maven and push the new overplayed packaged war file to tomcat on a server?

是不是太复杂,为此在行家?

Is it too complex to do this in maven?

如果我在安装我的仓库战争文件执行Maven构建过程中会自动使用它?

If I install the war file in my repository does the maven build process automatically use it?

推荐答案

它并不认为这场战争是一个Maven项目,这意味着什么,只是这场战争是一个Maven神器。您可以安装任何战争作为一个神器,不要紧它是如何构建的。如果再声明依赖于这件神器,你就可以覆盖它。虽然很容易的添加和替换文件(只创建一个包含新的文件和WAR插件将完成剩下的一个正常的Web项目结构),这是不容易进行修改。如果你真的想要的,你必须运行类似的替代插件后,原来的WAR被提取,但项目的包装阶段之前。也可以下载一个(WAR)文件,而不是通过使用一些异乎寻常的插件得到它从回购,但这可能不是你应该做的,因为它吹的Maven之外一半的好处。

It doesn't assume that the WAR is a Maven project, whatever that means, just that the WAR is a Maven artifact. You can install any WAR as an artifact, it does not matter how it was built. If you then declare a dependency to this artifact, you'll be able to overlay it. While it is easy to add and replace files (just create a normal web project structure containing the new files and the WAR plugin will do the rest), it is not easy to modify them. If you really wanted that, you'd have to run something like the replacer plugin after the original WAR is extracted but before the package phase of your project. It is also possible to download a (WAR) file instead of getting it from a repo by using some exotic plugins, but this is probably not something you should be doing as it blows away half the benefits of Maven.

对于部署新建应用到远程Tomcat的,而的可行使用Tomcat插件,这是不是我就从Maven的做的事情。它通常是一个构建服务器,例如像工作詹金斯,而Tomcat插件更是为当地的开发和测试。

As for deploying the newly-built application to a remote Tomcat, while doable using the Tomcat plugin, it is not something I would be doing from Maven. It is usually a job for a build server, like e.g. Jenkins, while the Tomcat plugin is more for local development and testing.

这篇关于自动使用maven定制战争文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆