Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

Table of Contents (18 chapters)
Apache Maven Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. Open the Maven project named project-with-additional-source.

  2. 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<...