1. In the POM, the default source code directory is:
Sourcedirectory to configure, you can configure only one source code directory,
For the resource directory, you can configure more than one of the following ways.
1 <Resources>2 <Resource>3 <Directory>Src/main/java</Directory>4 <includes>5 <include>**/*.properties</include>6 <include>**/*.xml</include>7 <include>**/*.tld</include>8 <include>**/*.txt</include>9 </includes>Ten <filtering>False</filtering> One </Resource> A - <Resource> - <Directory>Src/main/resource</Directory> the </Resource> - </Resources>
The above configuration is actually some of the configuration files in the source code directory, such as *.properties, *.xml. *.txt, etc., are added to the compiled directory. Otherwise, the runtime will error.
2. Sourcedirectory can only configure one, so the use of plug-ins to complete the additional source directory configuration.
1 <plugin>2 <groupId>Org.codehaus.mojo</groupId>3 <Artifactid>Build-helper-maven-plugin</Artifactid>4 <version>1.10</version>5 <executions>6 <Execution>7 <ID>Add-source</ID>8 <Phase>Generate-sources</Phase>9 <Goals>Ten <goal>Add-source</goal> One </Goals> A <Configuration> - <sources> - <Source>${project.basedir}/src/jave/othersource</Source> the </sources> - </Configuration> - </Execution> - </executions> + </plugin>
Pom Add multiple source code directories