Discussion:
[m2] How to include a file in a WAR file's /META-INF folder?
Mark Reynolds
2006-06-07 18:08:20 UTC
Permalink
If I include a file (not talking about MANIFEST.MF here) in
src/main/resources/META-INF, it ends up in WEB-INF/classes/META-INF in
the WAR file. What is the correct way to include a file in the WAR
file's META-INF?

-- Mark R
Thierry Barnier
2006-06-07 19:51:04 UTC
Permalink
I put my jars in WEB-INF/lib

Adding the following section to my POM file

<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

Regards

Thierry
Post by Mark Reynolds
If I include a file (not talking about MANIFEST.MF here) in
src/main/resources/META-INF, it ends up in WEB-INF/classes/META-INF in
the WAR file. What is the correct way to include a file in the WAR
file's META-INF?
-- Mark R
---------------------------------------------------------------------
Mark Reynolds
2006-06-07 20:31:04 UTC
Permalink
Thanks for the quick response, however, my question has to do with how
to add an arbitrary file to the WAR file's META-INF directory.

I am creating a properties file with some metadata about the state of
the source with respect to source control (repository revision, date,
url, etc.) that I want to include in the META-INF directory of each JAR
and WAR file artifact produced by my Maven build.

I have no problem with JAR files. The generated resource is just dropped
in the src/main/resources/META-INF directory. But if I do the same for a
WAR file it ends up in WEB-INF/classes/META-INF.
Post by Thierry Barnier
I put my jars in WEB-INF/lib
Adding the following section to my POM file
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Regards
Thierry
Post by Mark Reynolds
If I include a file (not talking about MANIFEST.MF here) in
src/main/resources/META-INF, it ends up in WEB-INF/classes/META-INF in
the WAR file. What is the correct way to include a file in the WAR
file's META-INF?
-- Mark R
---------------------------------------------------------------------
Mark Reynolds
2006-06-07 20:54:36 UTC
Permalink
NM. Doh! Just put it under src/main/webapps/META-INF.
Post by Mark Reynolds
Thanks for the quick response, however, my question has to do with how
to add an arbitrary file to the WAR file's META-INF directory.
I am creating a properties file with some metadata about the state of
the source with respect to source control (repository revision, date,
url, etc.) that I want to include in the META-INF directory of each JAR
and WAR file artifact produced by my Maven build.
I have no problem with JAR files. The generated resource is just dropped
in the src/main/resources/META-INF directory. But if I do the same for a
WAR file it ends up in WEB-INF/classes/META-INF.
Post by Thierry Barnier
I put my jars in WEB-INF/lib
Adding the following section to my POM file
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>./lib</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Regards
Thierry
Post by Mark Reynolds
If I include a file (not talking about MANIFEST.MF here) in
src/main/resources/META-INF, it ends up in WEB-INF/classes/META-INF in
the WAR file. What is the correct way to include a file in the WAR
file's META-INF?
-- Mark R
---------------------------------------------------------------------
Loading...