Skip to content

Instantly share code, notes, and snippets.

@icereval
Last active November 29, 2017 23:49
Show Gist options
  • Save icereval/7ec882f00e0887b060938282829af534 to your computer and use it in GitHub Desktop.
Save icereval/7ec882f00e0887b060938282829af534 to your computer and use it in GitHub Desktop.
# Hack to extract module jar files into WEB-INF/classes (preferred).
Credit: https://stackoverflow.com/a/6676098
```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warName>cas</warName>
<packagingExcludes>WEB-INF/lib/io.cos.cas-cas-server-support-oauth-4.1.5.jar,WEB-INF/lib/cas-server-support-osf-4.1.5.jar</packagingExcludes>
<overlays>
<overlay>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-webapp</artifactId>
<excludes>
<exclude>WEB-INF/cas.properties</exclude>
<exclude>WEB-INF/classes/log4j2.xml</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>cas-server-support-oauth</artifactId>
<version>${project.version}</version>
<type>jar</type>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>cas-server-support-osf</artifactId>
<version>${project.version}</version>
<type>jar</type>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
<finalName>cas</finalName>
</build>
```
# Hack to rename module jar file in WEB-INF/lib, sometimes makes the load order work, not guranteed!!!
```xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}/groupId>
<artifactId>cas-server-support-oauth</artifactId>
<version>${project.version}</version>
<type>jar</type>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory>
<destFileName>__.io.cos.cas-cas-server-support-oauth-4.1.5.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warName>cas</warName>
<packagingExcludes>WEB-INF/lib/io.cos.cas-cas-server-support-oauth-4.1.5.jar</packagingExcludes>
<overlays>
<overlay>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-webapp</artifactId>
<excludes>
<exclude>WEB-INF/cas.properties</exclude>
<exclude>WEB-INF/classes/log4j2.xml</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
...
</plugins>
<finalName>cas</finalName>
</build>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment