You can add in your aggregator/parent project (so that it will be applied to all the declared modules) the following:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<excludes>
<exclude>**/test-*.properties</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/conf</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>test-*.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
In details:
- The Maven Jar Plugin is excluding properties files from the packaged jar and it is also configuring the
target
directory as lib (as you described in your question)
- The Maven Resources Plugin is copying to the
target/conf
directory (again, as you described above) any properties file starting by test- and provided by the src/main/resources
folder.
I tested in a sample project and it worked fine.
Also note: your IDE may then show the conf directory as part of your project (seeing it as new directory resources, it happened to me for Eclipse): that's not a new folder created, but just the same folder shown in a different view. If you really don't want to have this side effect, then consider using the maven-antrun-plugin instead of the Resources plugin.