Adding folder to classpath - tomcat

I feel like a bit of an idiot here but am am frustrated with my attempts to add a folder to the classpath. I am running tomcat from within IJ and i have my properties file in a folder that is not part of source. (src/test/resources)
What i did was to rigt click that folder and mark it as a source folder (which made it turn blue). However when tomcat starts up it does not see the file. I tried making both test and test/resourfces as a source folder but with no success.

however if i keep that properties files under src/main/resources all is well.

thx in advance
-anish

2 comments

Hello,

Your workflow is not clear for me, please provide more details:

How do you deploy the properties file to Tomcat? - is it part of a WAR being deployed to Tomcat?
Do you build your WAR as the IDEA artifact (Project structure->Artifacts) or do you build it externally with maven?

0

Ah sorry - let me try again.
I have a bunch of maven projects in the normal maven folder structure. i.e src files and resources are under src/main/java src/main/resources. My test classes and resources are under src/test/java and src/test/resources. The war file that i create (defined in the POM) only includes classes and resources under src/main/java and src/main/resources.
Now i have a properties file in src/test/resources that needs to be part of the classpath when i launch tomcat - and i dont want to add that properties file to src/main/resources. I dont want to change catalina.properties either - all i need is that when IJ launches tomcat either 1) the folder src/test/resources is added to the classpath OR the files under /src/test/resources are copied by IJ to the output directory.

I tried following the instruction from http://stackoverflow.com/questions/3765998/add-a-properties-file-to-intellijs-classpath - but that does not work for me.
I am using IJ 12.1.4


thx
-anish

0

Please sign in to leave a comment.