5

I am a newbie w.r.t. jetty and RESTful API's. I want to create REST services using Jetty and wants to use embedded jetty with eclipse. Can anyone suggest me any HowTo for installing Jetty/ Jetty plugins with Eclipse in Mac OS.

Regards,

Will Hartung
  • 115,893
  • 19
  • 128
  • 203
rinku
  • 415
  • 2
  • 19
  • 29

1 Answers1

6

If you're looking for an Eclipse plugin that will allow you to start your web app in Jetty via the Debug/Run menus, you may want to take a look at the run-jetty-run plugin.

If you happen to be using Maven, there's a Maven plugin you can use to start your app in Jetty as well. This can be configured to run via a launcher in Eclipse or can be launched via the command line.

Edit - Added more info about the jetty-maven-plugin:

If you're just talking about local development, then you don't have to download Jetty separately for use with the Maven plugin. The Maven plugin handles the download of the dependencies that you need by simply running mvn jetty:run. This will start your web app in Jetty (by default) at http://localhost:8080. If you use this, then there's really no need for the Eclipse plugin, either. As far as versions go, these are the available versions. I'd recommend sticking with a fairly recent version unless you have a need to use an older version of Jetty (it looks like the most recent version is a release candidate--8.0.0.RC0).

There's also an example of usage in a project on Github that I just found, but you may want to update the plugin version used.

Paul Dunnavant
  • 616
  • 4
  • 8
  • So if I plan to use Maven plugin, I need to install the jetty separately? and download jetty maven plugings in eclipse and then start the coding? can you suggest me the correct supported version/link for both? – rinku Aug 25 '11 at 05:59
  • thanks for the info. So If I am doing in using Maven.. wont I get any errors in code saying cant import org.eclipse.jetty... and so on? sorry as I am new to Maven as well.. thanks for the help – rinku Aug 26 '11 at 09:32
  • Sorry for the delay... I missed the fact that you had replied to this prior to the weekend. Regarding your question, I'm not sure I understand. Are you 1) building a WAR that can be deployed into any application server (and you're just choosing to run your app in Jetty for development purposes), or 2) trying to create a project that actually embeds Jetty so that the app can run as a standalone server? My comments above were all assuming option 1... I just want to make sure that I'm helping you out correctly. – Paul Dunnavant Aug 30 '11 at 00:05
  • I am in a similar situation: I was given a project that is readily configured to be used with the "mvn" command, i.e. it conists of the "pom.xml", java and xml files. I simply cd into the dir and run "mvn jetty:run". But now I want to use Eclipse to edit the source and then re-run the jetty server. Instead of having to kill (ctrl-C) the "mvn jetty:run" command each time and restart it from Terminal, I'd rather just hit "Run" in Eclipse. Even greater would be if I could use the debugger as well. But I don't understand how to configure Eclipse for these tasks. Could you elaborate or point? – Thomas Tempelmann Mar 13 '13 at 12:14