Hvordan tilføjer man en ekstra kildemappe, som Maven kan kompilere og inkludere i build-krukken?
Du kan bruge Build Helper Plugin, f.eks.:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>some directory</source>
...
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
BEMÆRK:Denne løsning flytter blot java-kildefilerne til mappen target/classes og kompilerer ikke kilderne.
Opdater pom.xml
som -
<project>
....
<build>
<resources>
<resource>
<directory>src/main/config</directory>
</resource>
</resources>
...
</build>
...
</project>
http://maven.apache.org/guides/mini/guide-using-one-source-directory.html
<build>
<sourceDirectory>../src/main/java</sourceDirectory>
se også
Maven kompilerer med flere src-mapper