File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I get Eclipse, Maven and Glassfish work together while developing?

 
Minh Ngo
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

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?

Thanks for any advices.

Kind regards,
Minh
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Minh Ngo
Greenhorn
Posts: 3
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Cheers,
Minh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic