Maven WAR overlay

2023-05-16

Overlays are used to share common resources across multiple web applications.

 
1.自己项目结构
    |-- pom.xml

 `-- src
     `-- main
         |-- java
         |   `-- com
         |       `-- example
         |           `-- projects
         |               `-- SampleAction.java
         |-- resources
         |   |-- images
         |   |   `-- sampleimage.jpg
         |   `-- sampleresource
         `-- webapp
             |-- WEB-INF
             |   `-- web.xml
             |-- index.jsp
             `-- jsp
                 `-- websource.jsp  
2.自己项目需要依赖的项目war
   documentedprojectdependency-1.0-SNAPSHOT.war

 |-- META-INF
 |   |-- MANIFEST.MF
 |   `-- maven
 |       `-- com.example.projects
 |           `-- documentedprojectdependency
 |               |-- pom.properties
 |               `-- pom.xml
 |-- WEB-INF
 |   |-- classes
 |   |   |-- com
 |   |   |   `-- example
 |   |   |       `-- projects
 |   |   |           `-- SampleActionDependency.class
 |   |   `-- images
 |   |       `-- sampleimage-dependency.jpg
 |   `-- web.xml
 `-- index-dependency.jsp  
3.在自己项目中添加项目依赖  

<dependencies>
    <dependency>
      <groupId>com.example.projects</groupId>
      <artifactId>documentedprojectdependency</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>war</type>
      <scope>runtime</scope>
    </dependency>
    ...
  </dependencies>  

4.添加依赖后项目可能如下:  

-- META-INF
 |   |-- MANIFEST.MF
 |   `-- maven
 |       `-- com.example.projects
 |           `-- documentedproject
 |               |-- pom.properties
 |               `-- pom.xml
 |-- WEB-INF
 |   |-- classes
 |   |   |-- com
 |   |   |   `-- example
 |   |   |       `-- projects
 |   |   |           |-- SampleAction.class
 |   |   |           `-- SampleActionDependency.class
 |   |   `-- images
 |   |       |-- sampleimage-dependency.jpg
 |   |       `-- sampleimage.jpg
 |   `-- web.xml
 |-- index-dependency.jsp
 |-- index.jsp
 `-- jsp
     `-- websource.jsp  
期中web.xml 来源于自己项目
 
5.配置overlays

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <overlays>
            <overlay>
              <groupId>com.example.projects</groupId>
              <artifactId>documentedprojectdependency</artifactId>
              <excludes>
                <exclude>WEB-INF/classes/images/sampleimage-dependency.jpg</exclude>
              </excludes>
            </overlay>
          </overlays>
        </configuration>
      </plugin>
    </plugins>
  </build>  
其中:

The <overlay> element can have the following child elements:

  • id - the id of the overlay. If none is provided, the WAR Plugin will generate one.
  • groupId - the groupId of the overlay artifact you want to configure.
  • artifactId - the artifactId of the overlay artifact you want to configure.
  • type - the type of the overlay artifact you want to configure. Default value is: war.
  • classifier - the classifier of the overlay artifact you want to configure if multiple artifacts matches the groupId/artifactId.
  • includes - the files to include. By default, all files are included.
  • excludes - the files to exclude. By default, the META-INF directory is excluded.
  • targetPath - the target relative path in the webapp structure, which is only available for overlays of type war. By default, the content of the overlay is added in the root structure of the webapp.
  • skip - set to true to skip this overlay. Default value is: false.
  • filtered - whether to apply filtering to this overlay. Default value is false.
     
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

转载于:https://www.cnblogs.com/nicholaswei/p/5381258.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Maven WAR overlay 的相关文章

随机推荐

  • winform布局格式

    一 默认布局 可以加panel xff0c 也可以不加 xff1b 通过鼠标拖动控件的方式 xff0c 根据自己的想法布局 拖动控件的过程中 xff0c 会有对齐的线 xff0c 方便操作 xff1b 也可选中要布局的控件 xff0c 在工
  • 事件(信号量、邮箱、消息队列)

    对于共享数据 xff0c 单纯通过加锁来保护在代码实现上这并不是很困难的 真正困难的地方是辨认出需要共享的数据和临界区 xff01 这里有一个很好的经验 xff1a 如果有其他的执行线程可以访问这些数据 xff0c 那么就要给这些数据加锁
  • Hadoop通过API访问HDFS

    1 version 1 通过Hadoop API访问HDFS 64 throws IOException 64 Test public void readFileByAPI throws IOException 获取hadoop配置信息 C
  • 对新课程的学习与期望

    我希望这门课可以让我熟练的掌握网站开发的知识 xff0c 我希望学完这门课后我可以创建出一个我网站 xff0c 我计划每周在这门课上花费13个小时 xff0c 每个礼拜的周一到周五的晚上花两个小时学习高级网站开发 转载于 https www
  • Neutron系列 : Neutron OVS OpenFlow 流表 和 L2 Population(8)

    问题导读 xff1a 1 怎样使用arp responder xff1f 2 怎样搭建l2pop环境 xff1f 3 ARP Responder arp responder 的原理不复杂 Neutorn DB 中保存了所有的端口的 MAC
  • SDN控制器ONOS的学习过程[mininet]

    命令语法 这个符号代表现在处于 Linux 的shell 交互下 xff0c 需要使用的是 Linux 命令mininet gt 这个符号表示现在处于 Mininet 交互下 xff0c 需要使用的是 Mininet 的命令 xff03 这
  • 什么是网络操作系统?网络操作系统具有哪些基本功能?

    网络操作系统是网络上各计算机能方便而有效地共享网络资源 xff0c 为网络用户提供所需的各种服务的软件和有关规程的集合 网络操作系统与通常的操作系统有所不同 xff0c 它除了应具有通常操作系统应具有的处理机管理 存储器管理 设备管理和文件
  • [教程] 【原创】媒体扫描耗电的彻底解决办法(申精)

    http bbs gfan com android 6740350 1 1 html 原创处女贴 xff0c 呵呵 研究换4 1 2也有段时间了 xff0c 4 1 2各方面功能均让我挺满意的 xff0c 用着也蛮顺手的 偶尔上论坛 xff
  • Error Domain=PlugInKit Code=13 打开相册模拟器卡顿

    问题描述 xff1a discovery errors encountered while discovering extensions Error Domain 61 PlugInKit Code 61 13 34 query cance
  • Arch Linux中通过AUR安装Redis Desktop Manager失败

    笔者在安装Redis Desktop Manager时出现了Failed to connect to chromium googlesource com port 443 Connection timed out错误 xff0c 具体见文末
  • 远程linux桌面灰屏,解决配置Ubuntu中vnc远程显示灰屏

    解决配置Ubuntu中vnc远程显示灰屏 a 缺失图形化工具 b vnc xstartup 权限不对 1 Ubuntu 16 04 安装 VNC 及 Mate 桌面环境 https www htcp net 880 html Fluxbox
  • linux客户端连接iscsi,配置ISCSI客户端(LINUX)redhat5-iSCSI-INITIATOR

    ISCSI 4的客户端装上去后会有 etc iscsi conf 配置文件 xff0c 直接按照模板参数修改就可以了 在ISCSI6的客户端配置方式有些变化 xff0c 这让我搞了一下午 xff0c 也参考的51CTO某技术大师的博客 xf
  • 《OVN Logical Flows and ovn-trace》翻译

    在本篇文章中 xff0c 我将解释什么是Logical Flow以及如何使用ovn trace去更好地理解它们 同时 xff0c 我也会用一些例子来解释 xff0c 为什么使用Logical Flow这种抽象模型能让新特性的添加变得出乎意料
  • fluent中UDF环境变量问题的三种解决方法

    方法一 xff1a 这种方式最简便 xff0c 首选这种 xff0c 但是有时会因为不明原因而不好使 xff0c 我自己电脑刚开始用这种方式是行得通的 xff0c 但是后来中途装过很多乱七八糟的软件 xff0c 估计环境变量改乱了 xff0
  • svn status '~'

    svn status 出现 39 39 时 提交会显示错误 xx xx svn 39 containing working copy admin area is missing Item is versioned as one kind o
  • 浏览器缓存原理

    为什么要使用web缓存 xff1f Web缓存存在于服务器和客户端之间 Web缓存密切注视着服务器 客户端之间的通信 xff0c 监控请求 xff0c 并且把请求输出的内容 xff08 例如html页面 图片和文件 xff09 另存一份 x
  • 开发问题记录 - Failed to connect to raw.githubusercontent.com port 443 after 3 ms: Connection refused

    文章目录 前言开发环境问题描述问题分析解决方案总结最后 前言 这是个经常能遇到的问题 xff0c 不管是安装Homebrew还是安装RVM又或者是安装其他的 xff0c 都少不了它 开发环境 macOS 12 6 问题描述 执行命令后的报错
  • ROS CAN总线设备接入(二)can总线数据提取和以ros topic形式发布

    简介 基于前ROS CAN总线设备接入 xff08 一 xff09 xff0c 我们成功实现了对于libpcan库的使用 xff0c 本次将实现对于can总线的初始化以及对于can总线上有效数据提取 xff0c 并将其以topic形式发布到
  • Linux 开启VNCSERVER

    尽管我们可以使用 SSH连接远程通过字符界面来操作Linux xff0c 但是对于更多熟悉图形人来说是很不方便的 xff0c 因此开启Linux的远程桌面还是很有必要的 目前有两种比较流 行的方式 xff1a XDM X display m
  • Maven WAR overlay

    Overlays are used to share common resources across multiple web applications 1 自己项目结构 pom xml 96 src 96 main java 96 com