Frank
Frank

Reputation: 21

Disable war overlays in maven

When I have a dependency of type 'war' in a maven project, it automatically uses overlay to merge it into the project I am building.

I would like to disable overlay.

To make the development process simpler I want to rather use symlinks with maven-junction-plugin when I'm building for my local Tomcat, and overlay only when I'm building for test and prod servers.

Any other suggestions on how I can work war dependencies that I need to modify without having a long build cycle is also welcome.

Upvotes: 2

Views: 4203

Answers (4)

frankern
frankern

Reputation: 103

In my case overlay happens because we I have dependencies of type war.

I solve my problem by putting all these dependencies in a profile that is enabled by default. A hack perhaps, but it works.

<profile>
  <id>overlay-active</id>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <configuration>
          <dependentWarExcludes>WEB-INF/lib/*,META-INF/**</dependentWarExcludes>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>myGroup</groupId>
      <artifactId>myWarDepency</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>war</type>
    </dependency>

Upvotes: 0

Jotschi
Jotschi

Reputation: 3622

You can't disable the set of overlays as for maven-war-plugin:2.1.1 but you can exclude files from the overlay.

Exclude all overlay files:

<dependentWarIncludes></dependentWarIncludes> 
<dependentWarExcludes>**</dependentWarExcludes>

Exclude all files from a specific overlays:

<overlays>
  <overlay>
    <groupId>com.gentics</groupId>
    <artifactId>portalnode-webapp</artifactId>
    <excludes>
      <exclude>**/*</exclude>
    </excludes>
  </overlay>
</overlays>

Please note that this will not reduce the amount of overlays that are used.

Upvotes: 2

frankern
frankern

Reputation: 103

Configure overlay exclusion in a profile. To configure overlays see: http://maven.apache.org/plugins/maven-war-plugin/overlays.html

That link specifies how to make maven-war-plugin exclude specific files and folders.

What I want to achieve is to not have any overlay at all, but the overlay happens by default.

The only solution I have found so far is to put the war dependencies themselves in a profile, but I'm not happy with this solution, as it smells too much of a workaround.

Upvotes: 1

apetrelli
apetrelli

Reputation: 718

Configure overlay exclusion in a profile. To configure overlays see: http://maven.apache.org/plugins/maven-war-plugin/overlays.html

Upvotes: 0

Related Questions