Dropwizard hot deployment
Asked Answered
T

3

9

I'm looking for a simple to use system in Java which creates a REST service for me. So I found dropwizard but as far as I can use google it turns out it lacks hot deployment although jetty is able to do so. When using the maven-shade-plugin it takes at least 10 seconds to build the thing. Also my IDE reports that it cannot use compile on save feature (aka hot deployment) when the shade-plugin is involved.

Can I use hotdeployment somehow? Or what can I use instead?

Update: If nothing will fix this I'll probably use a combination of jersey&guice etc which is explained in this post

Tiddlywinks answered 18/4, 2013 at 20:0 Comment(2)
Would using a servlet 3.0 container be an option? I believe it can do what you need just from annotations in your code.Confess
@ThorbjørnRavnAndersen do you have a simple example where I can see this?Tiddlywinks
G
2

You don't have to use the shade plugin to run your service. You could just compile as a regular jar file and I think that would let you use your IDEs hot deployment features.

Guerin answered 4/12, 2013 at 21:53 Comment(1)
the shaded jar is mostly useful for deploymentGuerin
S
1

Have you ever tried JRebel ? They have JAX-RS support as well...

Swaziland answered 19/4, 2013 at 15:0 Comment(0)
I
-1

Not an answer, but I wrote up an article detailing how to use git to push a Dropwizard project to your server and for it to initiate a hot replacement. It relies on git hooks and running Maven via a script on the server.

You can find the details about it here: http://gary-rowe.com/agilestack/2013/02/14/how-to-deploy-dynamic-sites-with-git/

Ine answered 19/4, 2013 at 8:41 Comment(4)
this is not hot deployment. hot deployment is when you can edit your java files, hit save, your IDE compiles and jetty restarts within 1 second with the updated class fileTiddlywinks
That's why I wrote replacement - not deployment. Apologies for the confusion. Edited the answer to make this clearer.Ine
Hmmh ... also this script is suboptimal (I've a better one ;)) as it stops the site and starts compiling afterwards!? It should compile first and only if test passes restart the server!Tiddlywinks
The article does state that it is for development purposes and that a production version would be coded differently. If you'd like to post your improved version then I can add it to the article as a suggested approach with full credit to you.Ine

© 2022 - 2024 — McMap. All rights reserved.