Making maven copy additional files inside the build jar (not resources but any file inside any package)?

build, java, maven, maven-2

Solution

You can modify the resources section of the `<build>` bit of the POM:

<resources>
  <resource>
    <directory>src/main/resources</directory>
  </resource>
  <resource>
    <filtering>false</filtering>
    <directory>src/main/java</directory>
    <includes>
      <include>*.rb</include>
    </includes>
    <excludes>
      <exclude>**/*.java</exclude>
    </excludes>
  </resource>
</resources>

Or, the other answer (create the same package structure in `src/main/resources`) will also work.

Problem

I have a package `org.myapp.mypackage` with some ruby files (`*.rb`) and I need to include them in the generated build jar in the same package along with the java class files. How do I tell my friend Maven to do this? Note : No, I cannot copy to anywhere else, but thanks for suggesting. :)

Original source