I'd like to use Eclipse as a central place to directly build and deploy applications while developing. I use Maven as a build and software project management tool and Glassfish v3 as the application server for deploying applications on. What I want is that, e.g. if I change a JSP or Servlet the change is automatically deployed on Glassfish. All I need is to press F5 in the browser to see the modifications.
I got everything to work so far in Eclipse, but not optimally. The problem is that my Maven project can't really cooperate with the Glassfish server adapter in Eclipse. I needed to add the project facet "Dynamic Web Module" to my Maven project to be able to connect the Maven project to the Glassfish server in Eclipse. However, the glassfish server expects a folder "WebContent" which is automatically created after adding the project facet. The web application structure should be located in this folder. Maven however doesn't know anything about "WebContent".
Is there a way to get Maven to work with a "WebContent" folder or the Eclipse Glassfish server adapter to work with the Maven project structure? If there is no way, how do you work while developing in Eclipse?
I haven't got much practice in Glassfish, but if you're asking what I think you're asking, the WebContent folder may not be essential. In Tomcat, at least, you can define a webapp context that's based on any folder or WAR file that tomcat has read access to.
An IDE is no substitute for an Intelligent Developer.
Joined: Jul 17, 2009
first of all, thanks for moving this issue to the right place. I'm pretty new to the JavaRanch and don't know all the forums fully yet.
The issue is resolved. In case someone has the same problem, here is the solution:
In order to make the Eclipse glassfish server adapter take the source files from your Maven project structure instead of the folder "WebContent", adapt the file "org.eclipse.wst.common.component" under <your_maven_project>/.settings. There is a line <wb-resource deploy-path="/" source-path="/WebContent"/>. Change it to <wb-resource deploy-path="/" source-path="/src/main/webapp"/>. Restart Eclipse and now you can work with your Maven project and directly change source files. The changes will immediately take effect if you set up your glassfish server adapter to automatically publish after 0 seconds.