Maven resources folder is used to store all your project resources files like , xml files, images, text files and etc. The default Maven resources folder is located at “yourproject/src/main/resources“.

Problem

In some projects’ structure, the default resource folder may not suit in your needs, and an additional resource folder may required.

Solution

You can add a new Maven default resources folder into your project by modifying the “pom.xml” file as following :

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mkyong.common</groupId>
  <artifactId>SpringExample</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>SpringExample</name>
  <url>http://maven.apache.org</url>
 
  <build>
	    <finalName>Spring Examples</finalName>
	    <resources>
	    	<resource>
	        	<directory>src/main/resources</directory>
	        </resource>
	        <resource>
	        	<directory>src/main/config</directory>
	        </resource>
	   	</resources>
  </build>
 
</project>

In above pom.xml file, you added a new resource folder, located at “src/main/config“.

Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world\'s largest enterprise software company.
Publisher : Oracle Corporation