The following is located on the last line of the third paragraph in section “7.1 The Java Plugin”:
“In fact, because support for Java projects is implemented as a plugin, you don’t have to use the plugin at all to build a Java project, if you don’t want to.”
Can someone provide me an example of what this would look like? That is, take a simple HelloWorld project that uses the Java plugin, comment out the line that applies the plugin, and write a task for compiling the code.
The following is what I came up with, but there’s still something wrong with it. I’m not exactly sure what it is. It also seems a little verbose to me, but Gradle complains if you don’t specify things like source and target compatibility.
The default value used by the java-base / java plugin for that value is “${buildDir}/dependency-cache”. This dependencyCacheDir property is used when using ants “depend” task. have a look at https://ant.apache.org/manual/Tasks/depend.html for details
You can’t have tasks use the entire project directory as either input or output. It’s a bad idea as it completely defeats incremental building.
You should store your inputs (source) and outputs (class files) in separate places. If you need to ship them together then aggregate them as a later step.
But it still shows the parent directory in the list of output files for the task. When Gradle takes a snapshot of the inputs, it puts a lock on the HelloWorld.java. This in turn causes the IOException to occur when it tries to take a snapshot of the outputs.
I did some more experimenting just to see how close to my goal I could get. This is what I came up with.