Pom Add multiple source code directories

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.