Hi All,
I am trying to execute a simple gradle task on my linux mint. The task takes 5 seconds to execute which is very huge time for a simple hello world task
This is my build.gradle file
task hello {
group ‘Hello’
description ‘This is a hello world example of the task’
doLast {
println ‘I am the hello task’
}
}
This is my task output
gradle hello
Task :hello
I am the hello task
BUILD SUCCESSFUL in 5s
1 actionable task: 1 executed
Please note: I ran the task several times but still the same 5s run time for this simple task
This is my gradle --status output
gradle --status
PID STATUS INFO
25910 IDLE 4.4.1
20367 STOPPED (by user or operating system)
Only Daemons for the current Gradle version are displayed. See The Gradle Daemon - Gradle User Guide Version 4.4.1
This is my gradle version
gradle --version
Gradle 4.4.1
Build time: 2017-12-20 15:45:23 UTC
Revision: 10ed9dc355dc39f6307cc98fbd8cea314bdd381c
Groovy: 2.4.12
Ant: Apache Ant™ version 1.9.9 compiled on February 2 2017
JVM: 9-internal (Oracle Corporation 9-internal+0-2016-04-14-195246.buildd.src)
OS: Linux 4.10.0-42-generic amd64
This my system spec
Intel core i7-7700HQ CPU
16 GB RAM
Regards
Ramesh
Chris_Dore
(Chris Doré)
December 28, 2017, 9:02am
2
Hi Chris,
Thanks a lot responding to my question.
Thats quite brilliant the profiling tool
I could see that the startup is taking huge time
Description
Duration
Total Build Time
5.474s
Startup
5.443s
Settings and BuildSrc
0.001s
Loading Projects
0.003s
Configuring Projects
0.003s
Task Execution
0.007s
And when I run with the debug option enabled I could see the following piece of code takes the time to execute
11:43:54.241 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Executing build 7743e413-e601-4fbe-8bde-2753b885be13.1 in daemon client {pid=14460}
11:43:54.246 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface docker0
11:43:54.247 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
11:43:54.247 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /172.17.0.1
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote multicast interface docker0
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface br-65a48bffcff1
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /172.18.0.1
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote multicast interface br-65a48bffcff1
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface wlp2s0
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
11:43:54.249 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /fe80:0:0:0:1a70:6d11:29e5:abcc%wlp2s0
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /10.52.128.106
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote multicast interface wlp2s0
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface enx0050b674be66
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? false
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? true
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /fe80:0:0:0:fb29:f37d:b6eb:ee4e%enx0050b674be66
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote address /192.168.10.22
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding remote multicast interface enx0050b674be66
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding IP addresses for network interface lo
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a loopback interface? true
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Is this a multicast interface? false
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /0:0:0:0:0:0:0:1%lo
11:43:54.250 [DEBUG] [org.gradle.internal.remote.internal.inet.InetAddresses] Adding loopback address /127.0.0.1
11:43:54.254 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
11:43:54.256 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
11:43:54.258 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
11:43:54.261 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Attempting to connect to [8f45566d-03b7-43d2-a0a5-d1db2f32bfe8 port:35081, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]].
11:43:54.261 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Trying to connect to address /0:0:0:0:0:0:0:1.
11:43:54.263 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpOutgoingConnector] Connected to address /0:0:0:0:0:0:0:1:35081.
11:43:54.279 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Connected to daemon DaemonInfo{pid=13036, address=[8f45566d-03b7-43d2-a0a5-d1db2f32bfe8 port:35081, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1514461415031, context=DefaultDaemonContext[uid=ef55418c-6e1f-4402-adeb-970943dfe59d,javaHome=/usr/lib/jvm/java-9-openjdk-amd64,daemonRegistryDir=/home/ramesh/.gradle/daemon,pid=13036,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=IE,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=7743e413-e601-4fbe-8bde-2753b885be13.1, currentDir=/opt/dem}.
I have docker installed by the way in my machine
Regards
Ramesh
I think I found the cause.
This is because of the openjdk
when I change the Java in my machine to oracle Java
Everything worked fine and gradle seems to be fast