Add .mf and .xml files to the META-INF directory inside Maven created by EAR

I have arbitrary .xml and .mf files that I have to add to the META-INF folder inside the ear itself. Build using maven2.2.1. Just adding these files under $ {basedir} / src / main / application / META-INF / works fine, but it doesn't fit my needs. Is there any other way to do such a thing? I tried:

<build> <resources> <resource> <directory>G:/WS/vermeg/ear2/XML's</directory> <targetPath>META-INF</targetPath> </resource> </resources> </build> 

but this does not add my xml files under the EAR itself.

I also tried:

 <configuration> <earSourceDirectory>G:\WS\vermeg\ear2\XML's\</earSourceDirectory> ... </configuration> 

these commands add my files to my ear, but NOT to META-INF inside the EAR (myEar.ear / META-INF).

Any help is appreciated and would be great. Thnx.

nacef,

+4
source share
3 answers
+2
source

I understood. Thanx Jgiff. I really used the maven-resources plugin, indicated where my xml is located, and that I wanted them to be copied to the META-INF folder of the project during the “validation” phase, which is important. Now my pom looks like this:

  <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 performing a clean installation, mvn maven first performs a “validation” phase, so a copy is performed before packing the ear. It was a success.

+1
source

I will add additional information for those who are facing this problem, using IBM Rational Application Developer (RAD) to create policies and file bindings for deployment to WebSphere Application Server (WAS).

In our case, we generated the policy binding files (policyAttachments.xml and wsPolicyServiceControl.xml) using the RAD tools for the Policy set attachments. By default, they are dumped to the META-INF folder in the root of the EAR project. If there is a convenient way to change this default behavior to always put it in the / META -INF application, I have not come across this. But the above methods work very well in RAD with m2e to run locally and create an EAR.

Here is the section of my pom that is used to copy these files:

  <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>${basedir}\src\main\application\META-INF\</outputDirectory> <resources> <resource> <directory>${basedir}\META-INF</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> 
0
source

All Articles