本文介绍了有什么办法告诉Maven War插件使用目标/类以外的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,当我使用Maven War插件时,此插件会将所有类文件(* .class)从目标/类复制到{warfile}/web-inf/classes.

when i use maven war plugin, by default, this plug-in will copy all class files(*.class) from target/classes to {warfile}/web-inf/classes.

问题是如果我已经编译了保留在另一个文件夹中的类(* .class):basedir/other-classes(它们是* .class文件而不是* .java文件,我知道,这很奇怪.但是这些类由第三方生成).

The problem is if i have compiled classes (*.class) that stay in another folder : basedir/other-classes (they are *.class file not *.java file, i know, it is weird. But those classes is generated from 3rd party).

有什么方法可以告诉Maven War插件将(basedir/other-classes)和(target/classes)中的所有类复制到{warfile}/web-inf/classes

Is there any way to tell maven war plugin to copy all classes in (basedir/other-classes) and (target/classes) into {warfile}/web-inf/classes

推荐答案

这可能对您有用.确保directorytargetPath正是您所需要的.

This might work for you. Make sure the directory and targetPath are what you need.

<build>
 <plugins>
       <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <webResources>
            <resource>
              <directory>${project.build.directory}/other-classes</directory>
              <targetPath>WEB-INF/classes</targetPath>
            </resource>
          </webResources>
        </configuration>
      </plugin>
 </plugins>
</build>

这篇关于有什么办法告诉Maven War插件使用目标/类以外的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 11:17