Including and excluding source files and folders
As per Maven conventions, all project sources should be in the src
folder. However, there may be legacy projects that are organized differently and may have more than one source folder. Also, in some projects, we might generate sources dynamically from tools such as wsdl2java
. In such cases, Maven needs to be told about these additional source folders. Note that such projects may not work well in IDEs.
How to do it...
Use the following steps to include and exclude source files and folders in your Maven project:
Open the Maven project named
project-with-additional-source
.Add the following section in the
pom
file:<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.9.1</version> <executions> <execution> <id>add-source</id> <phase>generate-sources<...