1

I have a situation in which i have 3 src folders (src1, src2, src3) in a project. I have able to compile it by merging the folders into a single src.

When i compile it using the helper-plugin and define three src folders, I can see 78 java files being compiled but it only includes 4 class files in the final package.

"-X" is not useful.

vhu
  • 12,244
  • 11
  • 38
  • 48
  • 1
    possible duplicate of [Maven compile with multiple src directories](http://stackoverflow.com/questions/270445/maven-compile-with-multiple-src-directories) – Robert Wadowski Jul 27 '15 at 05:47
  • You can try using the resources element - see second answer here: http://stackoverflow.com/questions/270445/maven-compile-with-multiple-src-directories – Steve Atkinson Jul 27 '15 at 05:48

1 Answers1

2

Use Build Helper Maven Plugin

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals><goal>add-source</goal></goals>
            <configuration>
                <sources>
                    <source>src1</source>
                    <source>src2</source>
                    <source>src3</source>
                    ...
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

You can actually add more test source directories, more resource directories, additional artifacts or reserve a list of random and unused network ports by using this plugin.

Just browse through the usage section for this plugin.

Shishir Kumar
  • 7,981
  • 3
  • 29
  • 45