如何在 Maven 中复制 webResources
How to copy webResources in Maven
我正在使用 maven 作为构建工具。我有一个网络应用程序。我想创建另一个 Web 应用程序,第一个 Web 应用程序中的所有 xhtml 页面都应该复制到新的 application.But 有一些 exceptions.If 一个名称为 login.xhtml 的文件存在于旧的和新应用程序然后新应用程序中的那个应该 prevail.In Maven war 插件使用一些排除规则我可以让它工作(它实际上处于那种状态),但我正在寻找一个更干净的解决方案以便每次在两个应用程序中引入同名的新文件时,我不必在 POM.I 中硬编码排除规则也尝试使用依赖项 - 即新应用程序依赖于 war旧的,但时间戳是赢家。
您可以使用 Maven 覆盖来完成您的工作
http://maven.apache.org/plugins/maven-war-plugin/overlays.html
An overlay of a WAR file, is simply a Maven project that uses another
project's WAR output as a dependency, rather than a project's JAR.
When the overlay project is built, the underlying project's WAR file
is exploded and files in the overlay project added to it. If an
overlay project has a file with the same path and name as a file in
the underlying WAR it will replace it.
你也可以关注这个step-by-step guide。
我正在使用 maven 作为构建工具。我有一个网络应用程序。我想创建另一个 Web 应用程序,第一个 Web 应用程序中的所有 xhtml 页面都应该复制到新的 application.But 有一些 exceptions.If 一个名称为 login.xhtml 的文件存在于旧的和新应用程序然后新应用程序中的那个应该 prevail.In Maven war 插件使用一些排除规则我可以让它工作(它实际上处于那种状态),但我正在寻找一个更干净的解决方案以便每次在两个应用程序中引入同名的新文件时,我不必在 POM.I 中硬编码排除规则也尝试使用依赖项 - 即新应用程序依赖于 war旧的,但时间戳是赢家。
您可以使用 Maven 覆盖来完成您的工作
http://maven.apache.org/plugins/maven-war-plugin/overlays.html
An overlay of a WAR file, is simply a Maven project that uses another project's WAR output as a dependency, rather than a project's JAR. When the overlay project is built, the underlying project's WAR file is exploded and files in the overlay project added to it. If an overlay project has a file with the same path and name as a file in the underlying WAR it will replace it.
你也可以关注这个step-by-step guide。