Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to tell maven war plugin to use folder other than target/classes

Tags:

maven-2

war

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.

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).

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

like image 206
David Avatar asked Aug 26 '10 18:08

David


1 Answers

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>
like image 62
Starkey Avatar answered Nov 16 '22 00:11

Starkey