I wonder is some of this can be cleared up by simply giving the java plugin
a default task (likely "assemble") and making the error message more verbose
in the case of either no build.gradle, or a build.gradle without a src
directory. In some sense a new user types "gradle" and expects either
something useful to happen, or at least a Usage that will point them in the
correct direction. Currently you get a message about "No tasks", telling you
to run gradle -t, which then says "No Tasks". Not terribly helpful someone
new to gradle.
Perhaps in the case of no build.gradle you should get:
FAILURE: Unable to find 'build.gradle' in current directory.
* What went wrong:
There is not a build.gradle file in the current directory and one was not
specified on the command line.
* Try:
Create a build.gradle file in the current directory. The simplest instance,
for a java project is:
apply plugin: 'java'
See http://www.gradle.org/bla/bla/bla for more information on getting
started with gradle.
And in the case of a build.gradle with apply plugin: 'java', but without a
source directory, you currently get a successful build, with an empty jar
file. Seems like the java plugin should make sure there is at least one
source file, or maybe just a src/main/java before proceeding to the jar
task. Maybe an error message like:
FAILURE: Could not find a source directory.
* What went wrong:
No source directory, usually src/main/java, exists.
* Try:
Create the src/main/java directory and place your java source files in it.
Even if there is a "make my directories" task, I think these changes would
be helpful.
Just my $0.02
Philip