【问题标题】:Maven update jar before packaging in WAR在WAR中打包之前的Maven更新jar
【发布时间】:2014-03-06 10:39:13
【问题描述】:

我有一个项目,我正在使用简单的 maven-war-plugin 打包 WAR。与所有其他依赖项一起,其中一个依赖项说“abc.jar”正在被打包在战争中,它包含一个默认的弹簧配置,我想在打包之前用自定义的配置进行更新。如果应用以下构建命令,我已配置激活 Maven 配置文件;

mvn clean install -DframeworkPacakging=XYZ

我正在尝试使用 'truezip-maven-plugin' 覆盖我在 'target/aretfacts-id/WEB-INF/lib' 中的 'abc.jar' 中的自定义弹簧配置,但是当 maven-war-plugin完成我放弃了我的更改,因为战争插件从依赖定义中获取文件。我该如何解决这个问题?我有哪些选择?

附:不希望分发配置,因为此设置将用于在 Eclipse 中运行的 Embedded Jetty Server

【问题讨论】:

    标签: maven-war-plugin truezip


    【解决方案1】:
    1. 为了防止包含原始 jar 文件,我会使用 go for 建议的方法:https://www.mail-archive.com/users@maven.apache.org/msg38537.html

      对这个依赖使用<scope>provided</scope> lib目录。

    2. 包含重新包装的,我会遵循以下建议:How to make Maven copy resource file into WEB-INF/lib directory?

      尝试更改 maven war 插件的配置以包含 webResource:

      <configuration>
        <webResources>
          <resource>
            <directory>pathtorepackagedjar</directory>
            <includes>
              <include>**/abc.jar</include>
            <includes>        
           <targetPath>WEB-INF/lib</targetPath>
          </resource>
        </webResources>
      </configuration>
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-27
      • 2011-10-17
      • 2014-02-05
      • 1970-01-01
      • 2017-07-17
      相关资源
      最近更新 更多