在 Maven 中禁用战争覆盖
当我在 Maven 项目中具有“war”类型的依赖项时,它会自动使用覆盖将其合并到我正在构建的项目中。
我想禁用覆盖。
为了使开发过程更简单,我希望在为本地 Tomcat 构建时使用带有 maven-junction-plugin 的符号链接,并且仅在为测试和生产服务器构建时才覆盖。
关于如何在没有较长构建周期的情况下修改我需要修改的战争依赖项的任何其他建议也是受欢迎的。
When I have a dependency of type 'war' in a maven project, it automatically uses overlay to merge it into the project I am building.
I would like to disable overlay.
To make the development process simpler I want to rather use symlinks with maven-junction-plugin when I'm building for my local Tomcat, and overlay only when I'm building for test and prod servers.
Any other suggestions on how I can work war dependencies that I need to modify without having a long build cycle is also welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您无法像 maven-war-plugin:2.1.1 那样禁用覆盖集,但您可以从覆盖中排除文件。
排除所有叠加文件:
从特定叠加中排除所有文件:
请注意,这不会减少所使用的叠加数量。
You can't disable the set of overlays as for maven-war-plugin:2.1.1 but you can exclude files from the overlay.
Exclude all overlay files:
Exclude all files from a specific overlays:
Please note that this will not reduce the amount of overlays that are used.
该链接指定如何使 maven-war-plugin 排除特定文件和文件夹。
我想要实现的是根本没有任何覆盖,但默认情况下会发生覆盖。
到目前为止,我找到的唯一解决方案是将战争依赖项本身放入配置文件中,但我对这个解决方案并不满意,因为它听起来像是一种解决方法。
That link specifies how to make maven-war-plugin exclude specific files and folders.
What I want to achieve is to not have any overlay at all, but the overlay happens by default.
The only solution I have found so far is to put the war dependencies themselves in a profile, but I'm not happy with this solution, as it smells too much of a workaround.
在配置文件中配置覆盖排除。要配置覆盖,请参阅:
http://maven.apache.org/plugins/maven-war-plugin /overlays.html
Configure overlay exclusion in a profile. To configure overlays see:
http://maven.apache.org/plugins/maven-war-plugin/overlays.html
就我而言,重叠发生是因为我们有战争类型的依赖关系。
我通过将所有这些依赖项放入默认启用的配置文件中来解决我的问题。也许是黑客攻击,但它确实有效。
In my case overlay happens because we I have dependencies of type war.
I solve my problem by putting all these dependencies in a profile that is enabled by default. A hack perhaps, but it works.