• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 28070
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic