Tuesday, September 22, 2015

Maven How to add multiple source


If you have a project folder where you have multiple source directory something like

Then you need to include all the source folder into your maven's pom.xml
The easiest way to do is to include the below xml structure into your pom.xml


<project>
 <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>your source folder 1</source>
                <source>your source folder 2</source>
<source>your source folder 3</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

and then install







No comments:

Post a Comment