如果执行 gradle clean build --info, 输出是:
Looking for a different daemon... Found daemon DaemonInfo{pid=19048, address=[5dc61bb0-e70a-41ff-855e-61754ab113ee port:50734, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1660637008687, context=DefaultDaemonContext[uid=bdd601a4-019a-4843-a0b7-436 e3c1a90d3,javaHome=C:\Program Files\Java\jdk-14.0.1,daemonRegistryDir=C:\Users\xd\.gradle\daemon,pid=19048,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:50728,--add-opens,java.base/java.util=ALL-UNNAMED,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desired criteria. Java home is different. Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Java\jdk1.8.0_202,daemonRegistryDir=C:\Users\xd\.gradle\daemon,pid=16004,idleTimeout=null,daemonOpts=-XX:MaxPermSize=512m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant] Actual: DefaultDaemonContext[uid=bdd601a4-019a-4843-a0b7-436e3c1a90d3,javaHome=C:\Program Files\Java\jdk-14.0.1,daemonRegistryDir=C:\Users\xd\.gradle\daemon,pid=19048,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:50728,--add-opens,java.base/java.util=ALL-UNNAMED,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant] Looking for a different daemon... The client will now receive all logging from the daemon (pid: 8876). The daemon log file: C:\Users\xd\.gradle\daemon\4.10.2\daemon-8876.out.log Starting 55th build in daemon [uptime: 3 hrs 1 mins 51.489 secs, performance: 98%, no major garbage collections] Using 8 worker leases. Starting Build Settings evaluated using settings file 'D:\d\luo\wallet-api\settings.gradle'. Projects loaded. Root project using build file 'D:\d\luo\wallet-api\build.gradle'. Included projects: [root project 'lkdemo-pay', project ':lkdemo-app', project ':lkdemo-interface'] Parallel execution with configuration on demand is an incubating feature. > Configure project : Evaluating root project 'lkdemo-pay' using build file 'D:\d\luo\wallet-api\build.gradle'. Applying dependency management to configuration 'annotationProcessor' in project 'lkdemo-app' Applying dependency management to configuration 'apiElements' in project 'lkdemo-app' Applying dependency management to configuration 'archives' in project 'lkdemo-app' Applying dependency management to configuration 'bootArchives' in project 'lkdemo-app' Applying dependency management to configuration 'compile' in project 'lkdemo-app' Applying dependency management to configuration 'compileClasspath' in project 'lkdemo-app' Applying dependency management to configuration 'compileOnly' in project 'lkdemo-app' Applying dependency management to configuration 'default' in project 'lkdemo-app' Applying dependency management to configuration 'implementation' in project 'lkdemo-app' Applying dependency management to configuration 'runtime' in project 'lkdemo-app' Applying dependency management to configuration 'runtimeClasspath' in project 'lkdemo-app' Applying dependency management to configuration 'runtimeElements' in project 'lkdemo-app' Applying dependency management to configuration 'runtimeOnly' in project 'lkdemo-app' Applying dependency management to configuration 'testAnnotationProcessor' in project 'lkdemo-app' Applying dependency management to configuration 'testCompile' in project 'lkdemo-app' Applying dependency management to configuration 'testCompileClasspath' in project 'lkdemo-app' Applying dependency management to configuration 'testCompileOnly' in project 'lkdemo-app' Applying dependency management to configuration 'testImplementation' in project 'lkdemo-app' Applying dependency management to configuration 'testRuntime' in project 'lkdemo-app' Applying dependency management to configuration 'testRuntimeClasspath' in project 'lkdemo-app' Applying dependency management to configuration 'testRuntimeOnly' in project 'lkdemo-app' Applying dependency management to configuration 'annotationProcessor' in project 'lkdemo-interface' Applying dependency management to configuration 'apiElements' in project 'lkdemo-interface' Applying dependency management to configuration 'archives' in project 'lkdemo-interface' Applying dependency management to configuration 'bootArchives' in project 'lkdemo-interface' Applying dependency management to configuration 'compile' in project 'lkdemo-interface' Applying dependency management to configuration 'compileClasspath' in project 'lkdemo-interface' Applying dependency management to configuration 'compileOnly' in project 'lkdemo-interface' Applying dependency management to configuration 'default' in project 'lkdemo-interface' Applying dependency management to configuration 'implementation' in project 'lkdemo-interface' Applying dependency management to configuration 'runtime' in project 'lkdemo-interface' Applying dependency management to configuration 'runtimeClasspath' in project 'lkdemo-interface' Applying dependency management to configuration 'runtimeElements' in project 'lkdemo-interface' Applying dependency management to configuration 'runtimeOnly' in project 'lkdemo-interface' Applying dependency management to configuration 'testAnnotationProcessor' in project 'lkdemo-interface' Applying dependency management to configuration 'testCompile' in project 'lkdemo-interface' Applying dependency management to configuration 'testCompileClasspath' in project 'lkdemo-interface' Applying dependency management to configuration 'testCompileOnly' in project 'lkdemo-interface' Applying dependency management to configuration 'testImplementation' in project 'lkdemo-interface' Applying dependency management to configuration 'testRuntime' in project 'lkdemo-interface' Applying dependency management to configuration 'testRuntimeClasspath' in project 'lkdemo-interface' Applying dependency management to configuration 'testRuntimeOnly' in project 'lkdemo-interface' > Configure project :lkdemo-app Evaluating project ':lkdemo-app' using build file 'D:\d\luo\wallet-api\lkdemo-app\build.gradle'. Selected primary task 'clean' from project :lkdemo-app Selected primary task 'build' from project :lkdemo-app > Configure project :lkdemo-interface Evaluating project ':lkdemo-interface' using build file 'D:\d\luo\wallet-api\lkdemo-interface\build.gradle'. All projects evaluated. Tasks to be executed: [task ':lkdemo-app:clean', task ':lkdemo-interface:compileJava', task ':lkdemo-interface:processResources', task ':lkdemo-interface:classes', task ':lkdemo-interface:jar', task ':lkdemo-app:compileJava', task ':lkdemo-app:processResources', task ':lkdemo-app:classes', task ':lkdemo-app:bootJar', task ':lkdemo-app:bootStartScripts', task ':lkdemo-app:bootDistTar', task ':lkdemo-ap p:bootDistZip', task ':lkdemo-app:jar', task ':lkdemo-app:startScripts', task ':lkdemo-app:distTar', task ':lkdemo-app:distZip', task ':lkdemo-app:sourcesJar', task ':lkdemo-app:assemble', task ':lkdemo-app:compileTestJava', task ':lkdemo-app:processTestResources', task ':lkdemo-app:testClasses', task ':lkdemo-app:test', task ':lkdemo-app:check', task ':lkdemo-app:build'] :lkdemo-app:clean (Thread[Task worker for ':',5,main]) started. :lkdemo-interface:compileJava (Thread[Task worker for ':' Thread 7,5,main]) started. > Task :lkdemo-app:clean Task ':lkdemo-app:clean' is not up-to-date because: Task has not declared any outputs despite executing actions. :lkdemo-app:clean (Thread[Task worker for ':',5,main]) completed. Took 0.007 secs. :lkdemo-app:processResources (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:processResources Task ':lkdemo-app:processResources' is not up-to-date because: Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\resources\main has been removed. Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\resources\main\config has been removed. Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\resources\main\config\application-ci.yml has been removed. :lkdemo-app:processResources (Thread[Task worker for ':',5,main]) completed. Took 0.063 secs. :lkdemo-app:bootStartScripts (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:bootStartScripts Task ':lkdemo-app:bootStartScripts' is not up-to-date because: Output property 'outputDir' file D:\d\luo\wallet-api\lkdemo-app\build\bootScripts has been removed. Output property 'outputDir' file D:\d\luo\wallet-api\lkdemo-app\build\bootScripts\lkdemo-app has been removed. Output property 'outputDir' file D:\d\luo\wallet-api\lkdemo-app\build\bootScripts\lkdemo-app.bat has been removed. :lkdemo-app:bootStartScripts (Thread[Task worker for ':',5,main]) completed. Took 0.038 secs. :lkdemo-app:startScripts (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-interface:compileJava Resolving global dependency management for project 'lkdemo-interface' Excluding [] Excluding [] Skipping task ':lkdemo-interface:compileJava' as it is up-to-date. > Task :lkdemo-interface:compileJava UP-TO-DATE :lkdemo-interface:compileJava (Thread[Task worker for ':' Thread 7,5,main]) completed. Took 4.444 secs. :lkdemo-interface:processResources (Thread[Task worker for ':' Thread 7,5,main]) started. > Task :lkdemo-interface:processResources NO-SOURCE file or directory 'D:\d\luo\wallet-api\lkdemo-interface\src\main\resources', not found Skipping task ':lkdemo-interface:processResources' as it has no source files and no previous output files. :lkdemo-interface:processResources (Thread[Task worker for ':' Thread 7,5,main]) completed. Took 0.0 secs. :lkdemo-interface:classes (Thread[Task worker for ':' Thread 7,5,main]) started. > Task :lkdemo-interface:classes UP-TO-DATE Skipping task ':lkdemo-interface:classes' as it has no actions. :lkdemo-interface:classes (Thread[Task worker for ':' Thread 7,5,main]) completed. Took 0.0 secs. :lkdemo-interface:jar (Thread[Task worker for ':' Thread 7,5,main]) started. > Task :lkdemo-interface:jar UP-TO-DATE Skipping task ':lkdemo-interface:jar' as it is up-to-date. :lkdemo-interface:jar (Thread[Task worker for ':' Thread 7,5,main]) completed. Took 0.01 secs. > Task :lkdemo-app:startScripts Resolving global dependency management for project 'lkdemo-app' Excluding [org.apache.tomcat:tomcat-annotations-api, ognl:ognl] Task ':lkdemo-app:startScripts' is not up-to-date because: Output property 'outputDir' file D:\d\luo\wallet-api\lkdemo-app\build\scripts has been removed. Output property 'outputDir' file D:\d\luo\wallet-api\lkdemo-app\build\scripts\lkdemo-app has been removed. Output property 'outputDir' file D:\d\luo\wallet-api\lkdemo-app\build\scripts\lkdemo-app.bat has been removed. :lkdemo-app:startScripts (Thread[Task worker for ':',5,main]) completed. Took 6.898 secs. :lkdemo-app:compileJava (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:compileJava Excluding [] Excluding [] Task ':lkdemo-app:compileJava' is not up-to-date because: Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\classes\java\main has been removed. Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\classes\java\main\com has been removed. Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\classes\java\main\com\luo has been removed. All input files are considered out-of-date for incremental task ':lkdemo-app:compileJava'. Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments. Compiling with JDK Java compiler API. 注: D:\d\luo\wallet-api\lkdemo-app\src\main\java\com\luo\kont\wallet\common\mq\ProofreadBillConsumer.java使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 注: 某些输入文件使用了未经检查或不安全的操作。 注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。 Created classpath snapshot for incremental compilation in 0.04 secs. 1705 duplicate classes found in classpath (see all with --debug). :lkdemo-app:compileJava (Thread[Task worker for ':',5,main]) completed. Took 9.908 secs. :lkdemo-app:classes (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:classes Skipping task ':lkdemo-app:classes' as it has no actions. :lkdemo-app:classes (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs. :lkdemo-app:bootJar (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:bootJar Task ':lkdemo-app:bootJar' is not up-to-date because: Output property 'archivePath' file D:\d\luo\wallet-api\lkdemo-app\build\libs\lkdemo-app-1.0.0-SNAPSHOT.jar has been removed. :lkdemo-app:bootJar (Thread[Task worker for ':',5,main]) completed. Took 3.374 secs. :lkdemo-app:bootDistTar (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:bootDistTar Task ':lkdemo-app:bootDistTar' is not up-to-date because: Output property 'archivePath' file D:\d\luo\wallet-api\lkdemo-app\build\distributions\lkdemo-app-boot-1.0.0-SNAPSHOT.tar has been removed. :lkdemo-app:bootDistTar (Thread[Task worker for ':',5,main]) completed. Took 0.693 secs. :lkdemo-app:bootDistZip (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:bootDistZip Task ':lkdemo-app:bootDistZip' is not up-to-date because: Output property 'archivePath' file D:\d\luo\wallet-api\lkdemo-app\build\distributions\lkdemo-app-boot-1.0.0-SNAPSHOT.zip has been removed. :lkdemo-app:bootDistZip (Thread[Task worker for ':',5,main]) completed. Took 7.009 secs. :lkdemo-app:jar (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:jar SKIPPED Skipping task ':lkdemo-app:jar' as task onlyIf is false. :lkdemo-app:jar (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs. :lkdemo-app:distTar (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:distTar Task ':lkdemo-app:distTar' is not up-to-date because: Output property 'archivePath' file D:\d\luo\wallet-api\lkdemo-app\build\distributions\lkdemo-app-1.0.0-SNAPSHOT.tar has been removed. :lkdemo-app:distTar (Thread[Task worker for ':',5,main]) completed. Took 2.836 secs. :lkdemo-app:distZip (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:distZip Task ':lkdemo-app:distZip' is not up-to-date because: Output property 'archivePath' file D:\d\luo\wallet-api\lkdemo-app\build\distributions\lkdemo-app-1.0.0-SNAPSHOT.zip has been removed. :lkdemo-app:distZip (Thread[Task worker for ':',5,main]) completed. Took 15.88 secs. :lkdemo-app:sourcesJar (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:sourcesJar Task ':lkdemo-app:sourcesJar' is not up-to-date because: Output property 'archivePath' file D:\d\luo\wallet-api\lkdemo-app\build\libs\lkdemo-app-1.0.0-SNAPSHOT-sources.jar has been removed. :lkdemo-app:sourcesJar (Thread[Task worker for ':',5,main]) completed. Took 0.184 secs. :lkdemo-app:assemble (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:assemble Skipping task ':lkdemo-app:assemble' as it has no actions. :lkdemo-app:assemble (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs. :lkdemo-app:compileTestJava (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:compileTestJava Excluding [] Excluding [] Task ':lkdemo-app:compileTestJava' is not up-to-date because: Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\classes\java\test has been removed. Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\classes\java\test\com has been removed. Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\classes\java\test\com\luo has been removed. All input files are considered out-of-date for incremental task ':lkdemo-app:compileTestJava'. Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments. Compiling with JDK Java compiler API. 注: 某些输入文件使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 注: D:\d\luo\wallet-api\lkdemo-app\src\test\java\com\luo\kont\wallet\JschUtil.java使用了未经检查或不安全的操作。 注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。 Created classpath snapshot for incremental compilation in 0.053 secs. 1706 duplicate classes found in classpath (see all with --debug). :lkdemo-app:compileTestJava (Thread[Task worker for ':',5,main]) completed. Took 12.696 secs. :lkdemo-app:processTestResources (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:processTestResources Task ':lkdemo-app:processTestResources' is not up-to-date because: Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\resources\test has been removed. Output property 'destinationDir' file D:\d\luo\wallet-api\lkdemo-app\build\resources\test\conf.properties has been removed. :lkdemo-app:processTestResources (Thread[Task worker for ':',5,main]) completed. Took 0.007 secs. :lkdemo-app:testClasses (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:testClasses Skipping task ':lkdemo-app:testClasses' as it has no actions. :lkdemo-app:testClasses (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs. :lkdemo-app:test (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:test Excluding [] Task ':lkdemo-app:test' is not up-to-date because: Output property 'binResultsDir' file D:\d\luo\wallet-api\lkdemo-app\build\test-results\test\binary has been removed. Output property 'binResultsDir' file D:\d\luo\wallet-api\lkdemo-app\build\test-results\test\binary\output.bin has been removed. Output property 'binResultsDir' file D:\d\luo\wallet-api\lkdemo-app\build\test-results\test\binary\output.bin.idx has been removed. Finished generating test XML results (0.0 secs) into: D:\d\luo\wallet-api\lkdemo-app\build\test-results\test Generating HTML test report... Finished generating test html results (0.006 secs) into: D:\d\luo\wallet-api\lkdemo-app\build\reports\tests\test :lkdemo-app:test (Thread[Task worker for ':',5,main]) completed. Took 0.881 secs. :lkdemo-app:check (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:check Skipping task ':lkdemo-app:check' as it has no actions. :lkdemo-app:check (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs. :lkdemo-app:build (Thread[Task worker for ':',5,main]) started. > Task :lkdemo-app:build Skipping task ':lkdemo-app:build' as it has no actions. :lkdemo-app:build (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs. Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warningsView Code
耗时是 1min 4s, 真是太长了
此时执行是任务即task是:
Tasks to be executed: [task ':lkdemo-app:clean', task ':lkdemo-interface:compileJava', task ':lkdemo-interface:processResources', task ':lkdemo-interface:classes', task ':lkdemo-interface:jar', task ':lkdemo-app:compileJava', task ':lkdemo-app:processResources', task ':lkdemo-app:classes', task ':lkdemo-app:bootJar', task ':lkdemo-app:bootStartScripts', task ':lkdemo-app:bootDistTar', task ':lkdemo-ap
p:bootDistZip', task ':lkdemo-app:jar', task ':lkdemo-app:startScripts', task ':lkdemo-app:distTar', task ':lkdemo-app:distZip', task ':lkdemo-app:sourcesJar', task ':lkdemo-app:assemble', task ':lkdemo-app:compileTestJava', task ':lkdemo-app:processTestResources', task ':lkdemo-app:testClasses', task ':lkdemo-app:test', task ':lkdemo-app:check', task ':lkdemo-app:build']
可以看到 有不少的 task,
其中
distZip distTar bootJar bootDistZip
最长的是 : distZip 竟然花了近 16s.. bootDistZip 花了 7s
另外, compileTestJava也花了近10s, 当然这个时间是不能少的..
而 compileTestJava 花了近13s , test 源目录没有几个类, 为什么它这么多? 难道是 Created classpath snapshot for incremental compilation in 0.053 secs. 1706 duplicate classes found in classpath ?
distZip 生成的 lkdemo-app-1.0.0-SNAPSHOT.zip 到底有什么内容? 为什么会有这么一个 zip ?
发现 其实不用 执行 build 任务, 如果仅仅是 发布的话, 执行 bootjar 就足够.
此时的执行的任务是:
Tasks to be executed:[task ':lkdemo-interface:compileJava', task ':lkdemo-interface:processResources', task ':lkdemo-interface:classes', task ':lkdemo-interface:jar', task ':lkdemo-app:compileJava', task ':lkdemo-app:processResources', task ':lkdemo-app:classes', task ':lkdemo-app:bootJar']
此时的输出是:
Tasks to be executed: [task ':lkdemo-interface:compileJava', task ':lkdemo-interface:processResources', task ':lkdemo-interface:classes', task ':lkdemo-interface:jar', task ':lkdemo-app:compileJava', task ':lkdemo-app:processResources', task ':lkdemo-app:classes', task ':lkdemo-app:bootJar']
:lkdemo-interface:compileJava (Thread[Task worker for ':',5,main]) started.
:lkdemo-app:processResources (Thread[Task worker for ':' Thread 7,5,main]) started.
> Task :lkdemo-app:processResources UP-TO-DATE
Skipping task ':lkdemo-app:processResources' as it is up-to-date.
:lkdemo-app:processResources (Thread[Task worker for ':' Thread 7,5,main]) completed. Took 0.01 secs.
> Task :lkdemo-interface:compileJava
Resolving global dependency management for project 'lkdemo-interface'
Excluding []
Excluding []
Skipping task ':lkdemo-interface:compileJava' as it is up-to-date.
> Task :lkdemo-interface:compileJava UP-TO-DATE
:lkdemo-interface:compileJava (Thread[Task worker for ':',5,main]) completed. Took 3.77 secs.
:lkdemo-interface:processResources (Thread[Task worker for ':',5,main]) started.
> Task :lkdemo-interface:processResources NO-SOURCE
file or directory 'D:\d\kl\wallet-api\lkdemo-interface\src\main\resources', not found
Skipping task ':lkdemo-interface:processResources' as it has no source files and no previous output files.
:lkdemo-interface:processResources (Thread[Task worker for ':',5,main]) completed. Took 0.001 secs.
:lkdemo-interface:classes (Thread[Task worker for ':',5,main]) started.
> Task :lkdemo-interface:classes UP-TO-DATE
Skipping task ':lkdemo-interface:classes' as it has no actions.
:lkdemo-interface:classes (Thread[Task worker for ':',5,main]) completed. Took 0.0 secs.
:lkdemo-interface:jar (Thread[Task worker for ':',5,main]) started.
> Task :lkdemo-interface:jar UP-TO-DATE
Skipping task ':lkdemo-interface:jar' as it is up-to-date.
:lkdemo-interface:jar (Thread[Task worker for ':',5,main]) completed. Took 0.007 secs.
:lkdemo-app:compileJava (Thread[Task worker for ':',5,main]) started.
> Task :lkdemo-app:compileJava
Resolving global dependency management for project 'lkdemo-app'
BUILD SUCCESSFUL in 17s
5 actionable tasks: 1 executed, 4 up-to-date
可以看到, 17s 就足够, 快了n倍 !!
当然, 执行 jar 任务是不够的, 因为 对于 spring boot 项目, jar 不会执行, 从日志可以看到:
> Task :lkdemo-app:jar SKIPPED
Skipping task ':lkdemo-app:jar' as task onlyIf is false.
如果 jar 不会执行, 那么jar 前面的会执行吗? 测试发现也不会...
View Code
Tasks to be executed: [task ':kl-wallet-app:clean', task ':kl-wallet-interface:compileJava', task ':kl-wallet-interface:processResources', task ':kl-wallet-interface:classes', task ':kl-wallet-interface:jar', task ':kl-wallet-app:compileJava', task ':kl-wallet-app:processResources', task ':kl-wallet-app:classes', task ':kl-wallet-app:jar']
可以对比发现, 唯一的区别是 最后一个task..
当然, 如果是普通的项目, 非spring boot 项目, jar 是会正常执行的 !!
另外发现, 即使 java 文件没有任何变化, 还是会去扫描, 然后 也要花费 4 - 5 s 的时间..
> Task :lkdemo-interface:compileJava UP-TO-DATE
:lkdemo-interface:compileJava (Thread[Task worker for ':',5,main]) completed. Took 4.104 secs.
:lkdemo-interface:processResources (Thread[Task worker for ':',5,main]) started.
...
:lkdemo-app:compileJava (Thread[Task worker for ':' Thread 7,5,main]) completed. Took 5.598 secs.
-x test 排查 test task,
Tasks to be executed: [task ':kl-wallet-interface:compileJava', task ':kl-wallet-interface:processResources', task ':kl-wallet-interface:classes', task ':kl-wallet-interface:jar', task ':kl-wallet-app:compileJava', task ':kl-wallet-app:processResources', task ':kl-wallet-app:classes', task ':kl-wallet-app:bootJar']
可见, 确实没了 test / testResource 相关的task 了, 更快了!!
Jenkins会 每次开辟一个 tmp 临时构建目录吗? 是的.
标签:Task,Thread,app,lkdemo,gradle,task,interface,加速,打包 From: https://www.cnblogs.com/FlyAway2013/p/16735619.html