Reputation: 54701
My issue has no answer on questions How can I get Gradle ant logging to work? and Gradle: Get Ant Task Output.
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>
ant build
has some nice detailsBuildfile: /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
build.gradle
ant.importBuild 'build.xml'
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
.
--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
Upvotes: 0
Views: 829
Reputation: 54701
I share here my solution if this can help someone else.
It depends on the version of Gradle!
Elevate the log level of the task build (Ant target) in the script build.gradle
:
ant.importBuild 'build.xml'
build.logging.level = LogLevel.INFO
gradle build
is now similar to ant build
:build
[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 SUCCESSFUL
Total time: 1.692 secs
Add ant.lifecycleLogLevel = "INFO"
in the script build.gradle
:
ant.importBuild 'build.xml'
ant.lifecycleLogLevel = "INFO"
gradle build
:build
[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 SUCCESSFUL
Total time: 0.531 secs
Upvotes: 1