views:

140

answers:

1

Should I expect files in main/resources to be on the classpath when running the maven jetty plugin? Meaning will they be available to the app I'm running inside jetty? Will I be able to load them as classpath resources rather than via the file system?

The same question goes for running junit tests inside Eclipse, using the Eclipse Maven plugin.

If this directory is not on the classpath, can I add it?

+2  A: 

The resources from src/main/resources are copied into target/classes during the process-resources phase so, yes, they will be on the class path when running the maven jetty plugin. They will also be available when running unit tests (actually, see this previous answer). This applies inside Eclipse and on the command line.

Pascal Thivent
Great, thanks for the confirmation Pacal. You've helped me narrow down my problem. Now I see that my difficulties are caused by the fact that I have two files called config.properties, one in my main directory, one in my test directory. The test config is overwriting the main. Now off to solve that one!
morgancodes
@morgancodes: *The test config is overwriting the main.* Yes, and that's the expected behavior (you want to be able to "overwrite" a configuration during tests). BTW, [the common way of recognizing a good answer is upvoting it](http://meta.stackoverflow.com/questions/686/accepting-answer-without-upvoting) ;)
Pascal Thivent