How to add an extra source directory for maven to compile and include in the build jar?
You can use the Build Helper Plugin, e.g:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>some directory</source>
...
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
NOTE: This solution will just move the java source files to the target/classes directory and will not compile the sources.
Update the pom.xml
as -
<project>
....
<build>
<resources>
<resource>
<directory>src/main/config</directory>
</resource>
</resources>
...
</build>
...
</project>
http://maven.apache.org/guides/mini/guide-using-one-source-directory.html
<build>
<sourceDirectory>../src/main/java</sourceDirectory>
also see
Maven compile with multiple src directories