Maven: Include resources into JAR

The source directories for the resources are not defined correctly in the copy-resources goal configuration. Also, the outputDirectory element puts the resources in the target dir, when target/classes is what gets packaged by default. Try this config:

<configuration>
    <outputDirectory>${basedir}/target/classes</outputDirectory>
    <includeEmptyDirs>true</includeEmptyDirs>
    <resources>
        <resource>
            <directory>${basedir}/src/main/java/com/test/customize</directory>
            <filtering>false</filtering>
        </resource>
        <resource>
            <directory>${basedir}/src/main/java/com/test/resources</directory>
            <filtering>false</filtering>
        </resource>
        <resource>
            <directory>${basedir}/src/main/java/com/test/xml</directory>
            <filtering>false</filtering>
        </resource>
    </resources>
</configuration>

That said, you might consider putting the resources in ${basedir}/src/main/resources, like so:

src
   main
      resources
         customize
         resources
         xml

Then, you could remove the extra maven-resources-plugin config entirely, the default lifecycle will process the resources correctly.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)