views:

998

answers:

2

With Struts2 we have to have struts.xml in the class path, so it no longer works to have it under WEB-INF. So the way I got my project to deploy was to stick it under WEB-INF/classes and have it include ../struts2.xml

2 Problems: 1) Eclipse cleans out the classes folder when I do a rebuild, so it deletes struts.xml 2) Eclipse doesn't show the classes folder in my project browser, so its a poor place to stick config files in the first place.

How are you Struts2 Eclipse developers doing this?

A: 

I am not using Eclipse so this answer is not specific to your requirements but, I use Maven so we have all the "resources" that are needed by the application in a seperate folder called "resources" and When the application is built these files are copied into the appropriate places automatically. In Netbeans the files in the folder are available and I know that there are persons using eclipse with a similar setup.

I should point out that our project started from appfuse so most of these configurations were pre made. You can look at how it was done there.

Vincent Ramdhanie
+1  A: 

You can either just put the struts.xml at the root of your source directory or set up an additional resources source directory and put it there. Eclipse quite happily copies it to WEB-INF/classes for you when it does a compilation.

Peter Kelley