Main Tutorials

How to change Maven resources folder location?

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 :

File : 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 this case, you added a new resource folder, at “src/main/config“.

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments