Vaadin 7/maven - project setup question

I’ve not used maven to create a project before. Just created a vaadin 7 project. I can compile the default project and run it by dropping it into my tomcat container - so the basic layout is ok.

I want to open a property file. I used to put that in a directory under src/resources/ and open /resources/ In the current setup, I see the code in src/main/java/com… I put my config file in src/main/resources/ - but my program doesn’t seem to locate the file - what is the correct path I need to use to open that config file?



Hi, src/main/resources is the correct place to put your configuration file.
If you put the file in in src/main/resources/ it will be packaged in the root of the jar file, so you can load for example as getClass().getResourceAsStream(“/”)


Thanks - I’ll try that…


The same applies if the

file happens to be a
resource bundle
loaded with:

ResourceBundle.getBundle( "", ... )

where it has to be located in



Or to be precise: according to how


is declared last in your top-down POM hierarchy.

I can read my file now. Thanks very much. A related question…

I used to include a ‘persistence.xml’ file in the META_INF directory which contained info about my databases. I don’t see a persistence.xml file being packaged now. I am trying to read from a couple of databases on different machines, each of which should have a persistence.xml file in its jar file. Can someone tell me how to configure my pom.xml (or something else) to include the correct persistence information for my database access?

I suggest to create another thread for this new question. Otherwise nobody will recognize it since there’s no according topic title in the forum’s topic list.