Deepak Mittal
Deepak Mittal

Reputation: 39

Including multiple src folders in pom

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.

Upvotes: 1

Views: 1996

Answers (1)

Shishir Kumar
Shishir Kumar

Reputation: 8201

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.

Upvotes: 2

Related Questions