问题
Dropwizard recommends using Maven for new services, and supposedly Netbeans 7.4 has great Maven support.
So, I created a new Netbeans project: "New Project..." > "POM Project", and then added the Dropwizard dependency:
<dependencies>
<dependency>
<groupId>com.yammer.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.6.2</version>
</dependency>
</dependencies>
to pom.xml, and then what? Netbeans says the project is broken, because the dependencies don't exist. But that is because Netbeans hasn't downloaded them. But it isn't that supposed to be automatic?
How do you create a new Dropwizard project in Netbeans 7.4?
回答1:
Tom
a lot has changed since you asked your question. There is a Maven archetype that is a part of the project, which could be used to create a Dropwizard in Netbeans.
To create a project from Maven archetype in NetBeans one should choose File>New Project (or press Ctrl+Shift+N) and then in Categories select "Maven" and in Projects select "project from Archetype" as shown below.
Then press next. After that in the screen that appears one should key in Dropwizard in the Search input line. The java-simple is a part of Dropwizard.
After pressing Next button one can select project name, version, artefactId, etc.
At the time of writing it was necessary that one should enter the name attribute, which is the contents of Maven name element and this name can be displayed in an IDE. But for this particular archetype name should not contain spaces as the names of the two generated classes are based on this attribute. Otherwise you'll get an error.
Press Finish and you are ready to launch your Dropwizard project in NetBeans. Just don't forget to instruct NetBeans in Properties of your project to pass it a "server" argument as shown below.
Update: Added a youtube video.
回答2:
it's not automatic.
You can either do a build or trigger the "Download dependencies" action from Dependencies node popup and the dependencies will be resolved from your set of repositories.
来源:https://stackoverflow.com/questions/19483883/how-to-use-dropwizard-in-netbeans-project