aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes How can I get Eclipse, Maven and Glassfish work together while developing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How can I get Eclipse, Maven and Glassfish work together while developing?" Watch "How can I get Eclipse, Maven and Glassfish work together while developing?" New topic
Author

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

Minh Ngo
Greenhorn

Joined: Jul 17, 2009
Posts: 3
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

Joined: Jun 25, 2001
Posts: 15661
    
  15

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Minh Ngo
Greenhorn

Joined: Jul 17, 2009
Posts: 3
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I get Eclipse, Maven and Glassfish work together while developing?
 
Similar Threads
Using Eclipse for Web App
Maven, Eclipse and an Application Server in debug
Why is eclipse deploying me ejb with my web project?
Eclipse WTP Directory Structure
Import Netbeans Maven Enterprise Project in Eclipse