Gradle, are you using it? It's also great for Java development. However, I have had one complaint from before. That is, compilation is executed every time Javadoc is created or Jar is created.
It doesn't take long because I already have a cache, but I wanted to control it a little smarter.
When I looked it up when I had time, the key was in the figure below.
https://docs.gradle.org/current/userguide/java_plugin.htmlから拝借
From this figure, you can see that when you run gradle build, assemble, check and related tasks are executed one after another, and you should run classes to compile ...
Also, if you want to execute a test-type task, you can execute test, and it seems that classes will be executed when you execute this.
As a result, we found the following. If you want to compile only, execute the following command
gradle classes
If you want to run only the test, execute the following command (compilation must already be completed)
gradle test -x classes
//-x excludes the task
By keeping this figure in mind, it seems that you will not have to spend time on unnecessary tasks.
Recommended Posts