user2617187 user2617187 - 7 months ago 92
Java Question

How to place folder/jar in Maven META-INF root

I am working on a implementation that requires UnlimitedJCEPolicyJDK8 for SAP hana cloud platform. The documentation tells me that i need to place it under the following structure:

WAR file:
META-inf
- ext_security
- jre8

The problem is when i include the jars it goes to WEB-INF/classes and thats not where the server is looking. As seen in the picture.

Root META-INF

Technical details:

tomcat 8: v3.2 runtime
JRE 1.8
Maven build: using webapp archatype
With facades to support servlets.
IDE: eclipse

Tried the following:


  1. add files using eclipse web deployment assembly (for what ever the reason it does not seems to work with maven and yes i use .m2 and WTP plugin)

  2. Adding files trough maven dependency and tried copy to output folder.

  3. i open WAR file moved files manually to correct folder and re-zipped and verified that if its in correct folder the update to server is working fine.



i really hope you can help me.

kind regards,

UPDATE: as requested by khmarbaise the pom file. And i created web-inf folder by myself in the hope it would be placed in root.



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hcp</groupId>
<artifactId>edi.web</artifactId>
<packaging>war</packaging>
<version>0.0.2-SNAPSHOT</version>
<name>edi.web Maven Webapp</name>
<url>http://maven.apache.org</url>



<dependencies>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

<!-- tried classpath but it did not seem to do annything
Below dependency is from local .m2 repository-->
<dependency>
<groupId>hcp</groupId>
<artifactId>jre8security</artifactId>
<version>1.0.0</version>
<optional>true</optional>
<!-- goes in manifest classpath, but not included in WEB-INF/lib -->
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>

</plugins>
</pluginManagement>

</build>
</project>





Solution provided by pace:

create a source folder under the following name: src/main/webapp/META-INF

Answer

The maven-war-plugin's war goal has a configuration option webappDirectory. It defaults to src/main/webapp. Anything in there will be placed in the root of the war. So you could create a directory:

src/main/webapp/META-INF

and drop in whatever files you want there. I don't much about the web tools plugin so not sure what approach would work there.