0

The following is an example of how to use the Maven Overlay plugin to overlay a Java web app project with a web app project hosted in Maven Central:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-war-plugin</artifactId>
     <version>2.3</version>
     <configuration>
         <warName>cas</warName>
         <overlays>
             <overlay>
                <groupId>org.jasig.cas</groupId>
                <artifactId>cas-server-webapp</artifactId>
                <excludes>
                    <exclude>WEB-INF/cas.properties</exclude>
                    <exclude>WEB-INF/classes/log4j.xml</exclude>
                </excludes>
             </overlay>
        </overlays>
    </configuration>
<plugin>

As you can see, the example configures Maven to overlay the project with the cas-server-webapp WAR stored on Maven Central. But what if I have my own cas-server-webapp project stored locally in my m2 Maven cache? What if I want to use that (local) WAR instead of the ones hosted on Maven Central? I've read the Maven Overlay docs twice now, and don't see how I can configure this.

How do I configure the Maven Overlay plugin to pull the overlay WAR from my local Maven cache (m2) rather than Maven Central?

smeeb
  • 27,777
  • 57
  • 250
  • 447

1 Answers1

0

try something like this: create folder called lib in your project and copay your file there and add this to Maven

        <dependency>
        <groupId>testID</groupId>
        <artifactId>myArtifactID</artifactId>
        <version>3.6</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/your_library_file.jar
        </systemPath>
        <optional>false</optional>
    </dependency>
Irakli
  • 973
  • 3
  • 19
  • 45
  • Thanks @Irakli Charkhalashvili (+1) - however I think this is still missing something. Here's what I did. I cloned [this CAS example project](https://github.com/UniconLabs/simple-cas4-overlay-template), and then replaced the `` element in its `pom.xml` with the one you provided above. I then modified the `systemPath` to point to where I have the CAS project cloned locally. I then added a file called `wyatt.derp` to CAS' `cas-server-webapp\src\main\webapp\WEB-INF` directory. Then I built the `simple-cas4-overlay-template` project using `mvn package`... – smeeb Jan 11 '15 at 01:12
  • This produced a `cas.war`, but `wyatt.derp` is still missing from it, which means Maven i still pulling CAS from Maven Central. Any ideas? Thanks again! – smeeb Jan 11 '15 at 01:12