My issue has no answer on questions How can I get Gradle ant logging to work? and Gradle: Get Ant Task Output.
My ant script build.xml
<project>
<target name="build">
<mkdir dir="dest"/>
<javac srcdir="src" destdir="dest" includeAntRuntime="false"/>
<copy todir="dest" >
<fileset dir="src" casesensitive="no">
<include name="**/*.properties"/>
</fileset>
</copy>
<jar destfile="MyJar.jar">
<fileset dir="dest"/>
</jar>
</target>
</project>
The output of command ant build
has some nice details
Buildfile: /some/path/build.xml
build:
[mkdir] Created dir: /some/path/dest
[javac] Compiling 25 source files to /some/path/dest
[copy] Copying 3 files to /some/path/dest
[jar] Building jar: /some/path/MyJar.jar
BUILD SUCCESSFUL
Total time: 0 seconds
Simple script build.gradle
ant.importBuild 'build.xml'
The output of command gradle build
is missing some details
:build
BUILD SUCCESSFUL
Total time: 1.638 secs
We can notice the missing lines about the commands mkdir
, javac
, copy
and jar
.
Option --info
is too much verbose
> gradle --info build
Starting Build
Settings evaluated using settings file '/master/settings.gradle'.
Projects loaded. Root project using build file '/some/path/build.gradle'.
Included projects: [root project 'o']
Evaluating root project 'o' using build file '/some/path/build.gradle'.
Compiling build file '/some/path/build.gradle' using SubsetScriptTransformer.
Compiling build file '/some/path/build.gradle' using BuildScriptTransformer.
All projects evaluated.
Selected primary task 'build' from project :
Tasks to be executed: [task ':build']
:build (Thread[main,5,main]) started.
:build
Executing task ':build' (up-to-date check took 0.001 secs) due to:
Task has not declared any outputs.
[ant:mkdir] Created dir: /some/path/dest
[ant:javac] Compiling 25 source files to /some/path/dest
[ant:copy] Copying 3 files to /some/path/dest
[ant:jar] Building jar: /some/path/MyJar.jar
:build (Thread[main,5,main]) completed. Took 0.646 secs.
BUILD SUCCESSFUL
Total time: 1.947 secs
I share here my solution if this can help someone else.
It depends on the version of Gradle!
Using Gradle 2.13
Elevate the log level of the task build (Ant target) in the script
build.gradle
:Output of
gradle build
is now similar toant build
Using Gradle 3.2
Add
ant.lifecycleLogLevel = "INFO"
in the scriptbuild.gradle
:Output of command
gradle build