When I surfed over to DropWizard, its landing page suggested the preferred build system for using it is Maven. But can't I simply grab the DropWizard JAR (assuming there is one) and plop it into my IntelliJ?
As for Dropwizard, no. A "hello world" program using DropWizard require 86(!!) separate jars to run.
Welcome to Maven.
I can't speak to IntelliJ, I've never used it. But you really should look in to Maven.
Consider, to get started with Jersey, the JAX-RS reference implementation (just Jersey, DropWizard is more than just Jersey), using Maven, you need to declare two dependencies:
Code:
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
Ostensibly, each dependency represents a single jar. But more than that, each dependency represents not just the jar itself, but the other jars it depends on. That chain is walked until the entire required list of jars is obtained that are necessary to run the application.
DropWizard ostensibly has a single dependency. But pulling on that string, and you download half the internet.
Based on the two dependencies represented above, the actual list of jars required when the application is run is:
Code:
jersey-container-grizzly2-http-2.17.jar
javax.inject-2.4.0-b10.jar
grizzly-http-server-2.3.16.jar
grizzly-http-2.3.16.jar
grizzly-framework-2.3.16.jar
jersey-common-2.17.jar
javax.annotation-api-1.2.jar
jersey-guava-2.17.jar
hk2-api-2.4.0-b10.jar
hk2-utils-2.4.0-b10.jar
aopalliance-repackaged-2.4.0-b10.jar
hk2-locator-2.4.0-b10.jar
javassist-3.18.1-GA.jar
osgi-resource-locator-1.0.1.jar
jersey-server-2.17.jar
jersey-client-2.17.jar
jersey-media-jaxb-2.17.jar
validation-api-1.1.0.Final.jar
javax.ws.rs-api-2.0.1.jar
jersey-media-moxy-2.17.jar
jersey-entity-filtering-2.17.jar
org.eclipse.persistence.moxy-2.5.0.jar
org.eclipse.persistence.core-2.5.0.jar
org.eclipse.persistence.asm-2.5.0.jar
org.eclipse.persistence.antlr-2.5.0.jar
hamcrest-core-1.1.jar
Maven not only manages that list for you, it will also download the jars during the build and store them locally. In the old days, you would need to hunt down and download the jars and add them to your project yourself, but with Maven, you don't. There's an entire infrastructure out there to help manage this for you (for good and ill).
Maven projects have become the ubiquitous project format for Java today. It ubiquitous because all of the IDEs have reasonable support for it. Netbeans works with it natively, Eclipse can import Maven projects, I don't know what IntelliJ can do (I don't know if the free version has any support at all). We have people using all of these IDEs here at work on our shared Java code.
So, if you want to share your code in the Java world, the friendly way to do it is to publish a Maven project -- that way everyone can use their IDEs easily. If you want your libraries used in the Java world, it's even more friendly to publish the binary jars to the Maven central repository. Then when someone wants to use your library, they simply add it as a dependency, and like a thread on a sweater, they get not just your code, but anything you rely on as well to support it (like, say, a logging framework, or Json processing).
There are also other tools out there that leverage the Maven infrastructure. Gradle is a new(er) Groovy based build tool that takes advantage of the Maven central repository. Ivy adds Maven dependency support to Ant.
I get it, I'm not a huge fan of Maven and its declarative style. I also wish it were faster. It's more of a "here's what I want" and figures out what to do than a "go and do this" style of system, and it can have a big learning curve. However, there's "cut and paste" friendly stuff all over the interwebs that let you treat is as a mostly black box for simple projects, and it makes working with Java on the Internet MUCH, MUCH easier.
I don't understand it, I live with it and we get along reasonably well.
If you get maven installed, and then type:
Code:
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false -DgroupId=com.example.rest -DartifactId=jersey-service -Dpackage=com.example.rest -DarchetypeVersion=2.17
It will create a Maven project with a "hello world" JAX-RS example that runs from the command line. This reaches out to the central repository, pulls down an Archetype (identified by the Artifact ID and Group Id above), and the archetype is a project template.
You then can type:
Code:
mvn clean compile exec:java
That cleans, downloads (and caches) all of the dependencies, builds, and executes the server process. (Those are three separate command for maven.)
The nice thing about the exec:java command is that it builds a class path up based on your local repository. You can also build a "fat jar" that bundles everything in to one, large jar that you can run with "java -jar HelloWorld.jar". But that takes more time. Better to compile you 500 lines of code and be done with it than build up a 10M jar every time.
You should be able to import that project in to your IDE somehow, and then add source code, rinse and repeat.
To be honest, though, I don't do much with maven beyond building projects. All my server stuff is deployed to Glassfish or Tomcat. But I've made fat jars, etc.
JAX-RS is really nice. It's spec is less than 80 pages. And it's very good at making and writing HTTP based services. It handles routing, payload marshaling, and content negotiation.
But as you can see, it's not a small piece of software.