Add .mf & .xml files in META-INF directory inside a Maven built EAR
Solution 1
Try using the resources plugin as described here: http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
Solution 2
I got it. Thanx Jgiff. I used indeed the maven-resources-plugin, specified where my xml's are located and that i wanted them to be copied in the META-INF folder of the project during the "validate" phase, that's important. My pom looks somehow like this now:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>G:\WS\vermeg\ear2\src\main\application\META-INF\</outputDirectory>
<resources>
<resource>
<directory>G:\WS\vermeg\ear2\XML's</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
When executing an mvn clean install, maven executes the "validate" phase first so the copy is done before packaging the ear. That was successful.
b-lieve
Updated on June 28, 2022Comments
-
b-lieve almost 2 years
I have arbitrary .xml & .mf files that i have to add in the META-INF folder inside the ear itself. Build is done using maven2.2.1. Simply adding those files under ${basedir}/src/main/application/META-INF/ works fine, but it doesn't fit my needs. Is there another way to do such thing? I tried:
<build> <resources> <resource> <directory>G:/WS/vermeg/ear2/XML's</directory> <targetPath>META-INF</targetPath> </resource> </resources> </build>
but this doesn't add my xml files under the EAR itself.
I also tried:
<configuration> <earSourceDirectory>G:\WS\vermeg\ear2\XML's\</earSourceDirectory> ... </configuration>
this commands add my files inside the ear, but NOT in the META-INF inside the EAR (myEar.ear/META-INF).
Any help is welcome, and would be great. Thnx.
nacef,