如何要求Maven War插件将特定的jar文件复制到warfile/web-inf/lib中

如何要求Maven War插件将特定的jar文件复制到warfile/web-inf/lib中

问题描述:

我在c:/JAR中有一个simple.jar文件. 当我使用maven war插件创建war文件时,它将所有依赖项复制到lib文件夹中.

I have a simple.jar file that stay in c:/JAR. When i used maven war plugin to create a war file, it will copy all the dependencies into lib folder.

我如何要求Maven也将simple.jar复制到lib文件夹中.

How can i ask maven to copy simple.jar into lib folder as well.

我相信这对您有用.我不是100%肯定C:\\JAR是正确的.您可能必须弄弄这种语法.

I believe this will work for you. I'm not 100% sure the C:\\JAR is correct though. You might have to fiddle with this syntax.

<build> 
 <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-war-plugin</artifactId> 
        <version>2.0.2</version> 
        <configuration> 
          <webResources> 
            <resource> 
              <directory>C:\\JAR</directory> 
              <targetPath>WEB-INF/lib</targetPath> 
            </resource> 
          </webResources> 
        </configuration> 
      </plugin> 
 </plugins> 
</build>