Home Navigation

Wednesday 29 November 2017

How to add multiple source file for a maven project

You might sometimes encounter a problem working with multiple source directory for a maven project. we are used to work with single source directory eg: src. what if you have src1, src2. src3 ..

Tor resolve this issue you can use maven helper build plugin.

<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</phase>
   <goals>
<goal>add-source</goal>
   </goals>
   <configuration>
   <sources>
   <source>
${basedir}/src1
   </source>
   <source>
${basedir}/src2
   </source>
   </sources>
   </configuration>
   </execution>
   </executions>
</plugin>

No comments:

Post a Comment