I use the example provided in the manual. If you need to complete the following output, you can do this with the code provided. Let me know if you need something more specific.
Input: java -jar <your-jar> hello -u conor Output: Hello conor
I'm not sure which version of dropwizard you are using. This one is for 0.9.1
Main class
public class MyApplication extends Application<MyConfiguration> { public static void main(String[] args) throws Exception { { new MyApplication().run(args); } } @Override public void initialize(Bootstrap<DropwizardConfiguration> bootstrap) { bootstrap.addCommand(new MyCommand()); } @Override public void run(ExampleConfiguration config, Environment environment) { } }
MyCommand.java
public class MyCommand extends Command { public MyCommand() { super("hello", "Prints a greeting"); } @Override public void configure(Subparser subparser) {
Link: http://www.dropwizard.io/0.9.1/docs/manual/core.html#man-core-commands
source share