Appasamy T
Appasamy T

Reputation: 259

Maven WAR <overlays> - Include a file from WEB-INF/classes

I would like to pick a class file(StartEngine.class) from my WEB-INF/classes and put in the root directory of my WAR file to get below structure

process-engine.war
|
|-WEB-INF
|-js
|-StartEngine.class
|

I used of maven war but its not copying it. Please help me if anyone has any solution for the same.

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>

        <configuration>
          <overlays>
           <overlay>
             <artifactId>process-engine</artifactId>
              <excludes>
               <includes>
                <include>/WEB-INF/classes/StartEngine.class</include>
              </includes>
              <type>jar</type>
          </overlay>
            ...
       </plugins>

Upvotes: 2

Views: 4227

Answers (1)

Noremac
Noremac

Reputation: 3547

It looks like your configuration needs to be reworked. First of all, I suggest reading this page for a better understanding of overlays. There are a couple of possible situation which aren't clear to me from your question:

  1. An overlay is supposed to come from a separate artifact. If you are indeed trying to pull in the StartEngine.class file from a separate artifact, then you'll need to add the groupId as well as the artifactId. Also since the class file is in a WEB-INF directory, then I'd suspect that this artifact would be of type 'war' (not jar).

  2. If you are trying to move a file that is already in the project, then an overlay is not what you should use. Moving a class file to the base of the war file isn't a standard layout and if you must do this, then I suggest looking at the maven resources plugin's copy resources goal

Upvotes: 2

Related Questions