win10 Idea builds spring 5.3 10-snapshot source code environment

Tools used

idea2020.3 gradle6.8.3 openJDK1.8.0_302 spring5.3.10-SNAPSHOT

Download path of gradle and openJDK (1 point): https://download.csdn.net/download/qq_22843051/20619765

Java installation steps

  • openJDK1.8.0_302 download address (there is a point here. It's not easy to find this version)

  • decompression

  • Configure environment variables

    • JAVA_HOME D:\javaother\openjdk-8u302-b08 (installation path of jdk)

    • CLASSPATH .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar (tool in jdk)

      • Pay attention to the small point at the front

    • Path

      • D:\javaother\openjdk-8u302-b08

      • D:\javaother\openjdk-8u302-b08\jre\bin

    • Whether the test is successful; Java version information will appear when running Java -version

    • Running Javac will lead to the command that cannot be found, which will not affect the normal writing of code.

gradle installation procedure

  • cmd executes gradle -v. if the version number appears, the installation is successful!

        

  • Then find gradle in setting in idea and configure it

Start spring

  • Download the spring source compression package (. zip) from GitHub. As of August 5, 2021, please download the latest directly without going to the branch. Then, check whether the branch has version 5.3.10-SNAPSHOT

  • Edit the build. In the spring source package gradle,gradle.properties,settings.gradle

    • build.gradle file

      • #This part is replaced in line 292 or so
        repositories {
           maven { url'https://maven.aliyun.com/nexus/content/groups/public/' }
           maven { url'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
           mavenLocal()
           maven { url "https://repo.spring.io/libs-spring-framework-build" }
        }

      •  #This part is replaced by {about line 317
         pluginManager.withPlugin("kotlin") {
            apply plugin: "org.jetbrains.dokka"
            compileKotlin {
               kotlinOptions {
                  jvmTarget = JavaVersion.VERSION_1_8.toString()
                  languageVersion = "1.3"
                  apiVersion = "1.3"
                  freeCompilerArgs = ["-Xjsr305=strict", "-Xsuppress-version-warnings", "-Xopt-in=kotlin.RequiresOptIn"]
                  allWarningsAsErrors = true
               }
            }
            compileTestKotlin {
               kotlinOptions {
                  jvmTarget = "1.8"
                  freeCompilerArgs = ["-Xjsr305=strict"]
               }
            }
         }
    • gradle.properties file

      •  #Replace everything in this file
         ​
         version=5.3.10-SNAPSHOT
         ## Setting this parameter is mainly to compile and download packages, which will occupy a lot of memory and may overflow memory
         org.gradle.jvmargs=-Xmx2048M
         ## Enable Gradle cache
         org.gradle.caching=true
         ## Enable parallel compilation
         org.gradle.parallel=true
         kotlin.stdlib.default.dependency=false
         ## Enable new incubation mode
         org.gradle.configureondemand=true
         ## Start the daemon. By starting the daemon, it will be connected to build the next build instead of fork ing a gradle build process
         org.gradle.daemon=true
    • settings.gradle file

      •  #Replace this one} on line 1
         pluginManagement {
            repositories {
               maven { url "https://maven.aliyun.com/repository/public" }
               gradlePluginPortal()
               maven { url 'https://repo.spring.io/plugins-release' }
            }
         }

  • Compile the spring source code

    • View import into idea MD file

    • Open the powerful black box of cmd universe, find the directory where the spring source code is located, and execute gradlew: spring oxm: compiletestjava. It is recommended to smoke a cigarette and play a hand tour >__<

    • Note: if an error occurs, open gradlew with text and add a pause at the end; Used to view error command details

  • Import spring into idea

    • Then select gradle to import. When importing, first pause the import and modify the gradle setting in setting to local

  • Then find a test class in the project and run it.
    • If JVM 1.6 jvm1.0 is reported 8 or something, then start the whole annoying work
      • ctrl+alt+shift+S opens the project structure pop-up window
      • Just change this thing of each module to 1.8 (stupid way, which boss knows how simple, please let me know)
    • If the corresponding jar is introduced, but the code is red and says that it cannot be found, it is the wrong version of the jar

Keywords: Java Spring source code

Added by llama on Wed, 05 Jan 2022 07:11:06 +0200