Recommended Maven Archetype for starting with Jersey

Viewed 117

I'm getting started with using Jersey and I've been playing around with the examples. The getting starting page mentions 3 different Maven archetypes to start from - one using Grizzly, one for making a JavaEE Web Application, and a similar one but for deploying on Heroku.

I've played around with the Grizzly one and it seems easy enough, but I don't feel like I understand the differences between these. If I understand correctly, the one for making a JavaEE Web Application requires packaging as a WAR and using a servlet container, such as Jetty or Tomcat.

Using Grizzly seems much nicer since it doesn't have to be packaged every time, but I assume there are advantages to making a JavaEE Web Application that I'm missing. The Grizzly example didn't have a web.xml file but the other ones do. Is this a limitation of using Grizzly or is it just not necessary? If I later wanted to deploy my server using Heroku or AWS can I only do that if I make it a JavaEE Web Application? This seemed to be implied by the Heroku archetype being so similar to the JavaEE one. Is it possible to mix and match, such as using Grizzly for faster development and then making it a JavaEE Web Application to actually deploy it?

I apologize if what I'm asking is unclear, I'm just a little overwhelmed with having these choices seemingly upfront and not understanding the differences and implications of each. Thanks in advance for any help you can provide!

1 Answers

I started today and had the same question.

If you use Grizzly you don't need an app server or a servlet container. The Grizzly framework uses the Java NIO to support HTTP and expose your REST services. Hence no web.xml. You should be able to deploy an application on either AWS or Heroku. This is what I am trying actually. REST API using Jersey and Grizzly for HTTP support to be deployed on an Amazon AWS EC2 instance

I believe the Heroku archetype must be embedding a server in the app (guessing) and making the deployment package to conform to Heroku requirements

web app version of thee archetype is obvious, I guess. You need an app server to deploy and run your application

Related