Including classpath resources in build that uses maven

Is there a way to include resources into the classpath using a maven project without specifying that classpath in the pom file?

For example, I have a tomcat installation on a linux server that is used for QA testing. I package my war and deploy it to this server, but in order to set environmental properties I have a resources folder in tomcat that I have placed property files, security files, etc. This resources folder is set up to be on the classpath so that any spring configuration, etc that requires it will find it there.

If I want to do the same thing on my local machine, this one is a Windows 7 box, and I want to use Intellij's Tomcat plugin to build, deploy, and start the server, how would I go about this?

This is a maven project and so it is possible that this is also why I haven't found a solution yet.

I can get this to work if I include the <resource> tag pointed to the resource folder that has my localhost property files, but this would mean that I have to either hard code an absolute path to that folder or else use a relative path. Either way could muck up other developers who have this locahost resources folder possibly in a different location. It could also muck up the default build lifecycle as that lifecycle should build the war without these properties. I could create the <resource> tag inside a profile and this is what I have done in the past, but there must be a way to do it without this.

Is there a way to do this? Am I going about this all wrong?

Please sign in to leave a comment.