问题
Working on a DropWizard project for the first time which uses the docker-config.yml
file to run the server using the jar file.
The command I run on the terminal to run the server is something like this:
java -jar target/foo-0.0.1.jar server conf/docker-conf.yml
Do I have to run mvn package
every single time I make a change? (for eg: even a small change like adding a System.out.println()
statement to debug something)
回答1:
mvn package
is used to create a JAR - a deployable artifact of the application. So if you really want to create the JAR every time, yes you need to package everything.
However, usually if you’re talking about small changes like adding System.out.println
I assume that you have some “work-in-progress”. In this case you can configure your IDE to run the class with main method (the Application class in in terms of dropwizard framework). It won’t create a fat jar but for debugging you also don’t really need it.
This is what I (and I believe many of our colleagues) do when working with applications powered by dropwizard, spring-boot (which is similar in this aspect), etc.
来源:https://stackoverflow.com/questions/58717271/run-mvn-package-every-time-i-make-changes