Hot Deploying My Wicket Application in Eclipse with Jetty

I had just created my first wicket project [update link] and I wanted to make sure I could run jetty in eclipse and hot deploy my war file exploded.

To do this I just needed to use the m2eclipse eclipse extensions to integrate with WTP:

Here’s what I did:

Install the m2eclipse WTP extensions:

  • I already had wtp installed in eclipse so no biggie there.
  • Go to eclipse -> Help -> Install new software…
    • Enter the m2eclipse extensions url in the Work with text field
    • When the list of plugins updates from the url select the following:
      • Maven Integration for WTP
      • Project configurators for commonly used maven plugins

    • Click NEXT and finish installing the m2eclipse – WTP integration plugins.

Update the m2eclipse configuration of any existing maven eclipse projects you want wtp in:

  • Right click on your project -> m2 MAVEN -> Update Project Configuration:

  • This will bring in the two new plugins you just installed
  • I’m no expert but if you look closely you’ll see some new files in your eclipse Navigator -> Project -> .settings folder:
    • The file org.eclipse.wst.common.component looks like it compiles your classes into srcmainwebappWEB-INF
      • Basically this creates an exploded ear that eclipse will hot deploy to…Yippee my goal

Get jetty running in eclipse:

The wicket maven archetype automatically setups jetty for you when the project is created so you’re almost there. All you need to do is:

  • Open the jetty class in ProjectName -> src -> test -> java -> my package -> ProjectName ->
  • I updated the context path to include my project name
  • Create a java application launch target:
    • With the file highlighted goto: Run -> Run Configurations -> Java Applications -> Create New

    • Launch.
  • Test it:
    • Go to http://localhost:8080/MyFirstWicketProjectand you should still see this:
      Wicket Quickstart Archetype Homepage
      If you see this message wicket is properly configured and running
    • Open the file HomePage.htmland change something noticeable.  Save and then refresh the page…I did this:
      Wicket Quickstart Archetype Homepage
      If you see this message wicket is properly configured and running

Hot deploy should now work.

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply