Monday, June 05, 2006

Maven 1.0.2: Adding a resource to a jar

Want to add a resource such as an xml config file to your generated jar in Maven 1.0.2?
  1. Create a directory called ./resources in the base directory fo your project and place what you want to include in it (if you want to place it in a specific directory in the jar, such as META-INF, echo the dir strcuture you want in the jar)
  2. Add the following to your POM:
<include>**/[file to include.xml]</include>

Create your jar, and et voila!

No comments: