如何使用 Maven 构建工件的多个配置(例如 WAR 等)?
由于我们当前一些应用程序的模块化性质,我们需要了解如何设置 Maven 来生成同一工件(在我们的例子中是 WAR 文件)的多个配置,以及两个部署级别(dev、测试、生产)和本地化(GB、FR、ES 等)? 我们正在寻找类似的内容:
artifact-gb-dev.war
OR
artifact-fr-test.war (etc., etc.)
我们已经意识到 Maven '构建配置文件',这似乎以满足部署环境标准,以及“maven-assemble-plugin”,这可能会解决国家/国际化问题,但是是否可以将两者结合起来(即集成法语资源)文件到生产级构建)?
我们当前目录结构的一个示例可能是:
..\gb
\dev
\test
\production
..\fr
\dev
\test
\production
..\es
\dev
\test
\production
构建可能需要(一个)法语开发版本(fr/dev)或所有生产版本(gb-fr-es) -etc/prod),例如。
我们是 Maven 的新手,由于预配置的 Maven 原型及其依赖管理提供了快速的提升,因此我们决定尝试一下。到目前为止,我们已经使用 Ant 进行构建。
谢谢
理查德
due to the modular nature of some of our current applications, we have a need to understand how to setup Maven to produces mutliple configurations of the same artifact (in our case a WAR file), combinations of BOTH deployment level (dev, test, production) AND localised (gb, fr, es etc.)? We're looking for something like:
artifact-gb-dev.war
OR
artifact-fr-test.war (etc., etc.)
We've been made aware of Maven 'build profiles', which seem to fit the deployment environment criteria, and the 'maven-assembly-plugin', which might address the country/internationalisation issues BUT is it possible to combine the two (i.e. integrate French-language resources files into a production-level build)?
An example of our current directory structure might be:
..\gb
\dev
\test
\production
..\fr
\dev
\test
\production
..\es
\dev
\test
\production
where a build might require a (one) French development release (fr/dev) OR all production releases (gb-fr-es-etc/prod), for example.
We're new to Maven and have decided to try it due to the quick ramp-up offered by pre-configured Maven archetypes and its dependency management. Until now we've used Ant for our builds.
Thanks
Richard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下 Maven War Overlay 机制。它基本上允许你拥有一个通用的 pom 并在其上放置覆盖层(例如每个国家)以构建任意数量的战争。
我过去曾使用它为多个国家/地区创建一个网站(平台),每个国家/地区差异很小。
请参阅: http://maven.apache.org/插件/maven-war-plugin/examples/war-overlay.html
Have a look at the maven war overlay mechanism. It basically allows you to have a generic pom and put overlays (for each country for example) on top of it to build any number of wars.
I've used this in the past to create a website (platform) for multiple countries with small differences per country.
See: http://maven.apache.org/plugins/maven-war-plugin/examples/war-overlay.html