How To Change Maven's Default Resource Folder
Sometimes it's nice to have your projects resource files alongside the java source files they're related to. By default, Maven forces you to have a separate resource tree so, for example, whenever you need to a add a String for internationalization you have to go digging through your project's folders.
The good news is, you can change change maven's default resource folder this with this little bit of XML magic in Maven pom.xml.
<build> <resources> <resource> <directory>src/main/java</directory> <excludes><exclude>**/*.java</exclude></excludes> </resource> </resources> </build>
Note this overrides the default location, so make sure src/main/resources is empty, or add to the pom.xml like this.
<build> <resources> <resource> <directory>src/main/java</directory> <excludes><exclude>**/*.java</exclude></excludes> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources> </build>
Don't forget to exclude the java files unless you want to ship your source code!How To Change Maven's Default Resource Folder
I suppose I am a problem solver. Either that, or I am an organic carbon-based life form whose function is to convert oxygen into carbon dioxide. You could go either way on that. I'm into languages and stuff. I recently published my first book. It's okay, I guess. Lots of sex and drama--plus it's a true story. Let's see... What else? I like reading, swimming, playing music, and annoying Seda. KAPOW!