The strategy of this optimization is to skip tasks to save time, such as document packages and source packages, so if your goal is to get the latest jar package, then this method is suitable for you, if you want to get including documents, source code, etc Including all construction resources, then this method is not suitable;
First enumerate the hardware and software environment information:
Hardware: i5-8400, 16G (DDR4-2667MHz), SSD128G
Operating system: win10 64
JDK:1.8.0_171
Gradle:2.14.1
IntelliJ IDEA:2018.1.5
spring-framework源码:4.1.8.RELEASE
Note that for compiling spring-framwork4.1 source code under windows, please refer to "Win10 environment compiling spring-framework version 4.1.9, error" Failed to capture snapshot of input files for task 'distZip' "", otherwise it will fail to build;
After downloading and importing into IEDA, if you do not adjust the build.gradle script, it will compile directly, which takes 16 minutes and 43 seconds, as shown below:
Now let's modify the build.gradle file to remove some tasks that are not related to jar package construction;
Find configure (subprojects-project (": spring-build-src")) , at the end of this method there is the following code:
artifacts {
archives sourcesJar
archives javadocJar
}
Change to the following, that is, comment out the two lines inside the braces
artifacts {
//archives sourcesJar
//archives javadocJar
}
Find configure (rootProject) , at the end of this method there is the following code:
artifacts {
archives docsZip
archives schemaZip
archives distZip
}
Change to the following, that is, comment out all three lines in braces
artifacts {
//archives docsZip
//archives schemaZip
//archives distZip
}
After the build.gradle is modified, you can build again. Remember to use the -x test parameter to skip the test. The operation is as follows:
As shown in the figure below, it takes only 1 minute 59 seconds to complete the build. Go to the sub-project's build directory and find that the required jar package is successfully built (for example, spring-framework-4.1.8.RELEASE \ spring-context \ build \ libs)
In order to ensure accurate data, clean operation has been done before each build;
At this point, the operation of rapid compilation is completed, I hope to bring you some reference.