Notes on the process of Eclipse importing the spring source code downloaded by Gradle

Recently, I was researching Spring and wanted to look at the source code of the old version 3.xx. I found that Gradle was used, and the import process had some twists and turns. Now I write down the key steps:

Sping version DOC, source code download, this station cannot be imported into eclipse, because There is no third-party library
http://repo.spring.io/libs-release/org/springframework/spring/

Download the required version from the following github URL:
https://github.com/spring-projects/spring-framework/releases

Download grandle and decompress it, put the grandle\bin directory in the path

Spring4.xx or above requires JAVA8 to support
Spring 3.xx version, replace https in build.gradle and gradle\wrapper\gradle-wrapper.properties with http, otherwise download not come down.

I use 3.2.16:
Execution failed for task ':spring-core:compileJava' appears. The compilation error is that the jdk1.6 version is too low. Upgrade to version 1.7 to solve the problem. After the

download is complete, the third-party library is stored by Gradle in Gradle's local lib In the library,

upgrade Eclipse to Version: Mars.1 Release (4.5.1) Build id: 20150924-1200 JDK1.7 in the .gradle directory of the user directory .

Finally, select general exsiting pojects into workspace for import in Eclipse, and do not check Copy to the working directory. Finally, the import is successful, and it is compiled and passed in Eclipse.

There are a total of more than 20 projects, and there is a mutual reference relationship between the projects. After looking at the three core classes of spring-aop, spring-beans and spring-core, there are a total of 1464 java classes. After removing the test class and the package class, there are still 732 java classes. The source code is combined to 3.6M. It seems that spring Really need to lose weight.


For other steps, please refer to the following articles:
http://www.cnblogs.com/javaminer/p/3378081.html
  I recently wanted to study the source code of spring, but when I wanted to import the spring sub project into Eclipse, I encountered a problem. Less trouble (in fact, it's all my fault for taking it for granted).

  Find the gitHub homepage of spring-framework (http://springsource.org/spring-framework), and directly copy the source code download address of the project without reading the instructions in the README section https://github.com/spring-projects/spring -framework.git go to SVN to download, and then want to directly import the spring-core sub project under the v3.2.4.RELEASE directory under tags into a project in Eclipse by checking out. After checking out, I found that the directory structure inside was in the maven style, so I directly converted it into a maven project. After the conversion was successful, I found that there were many errors, and the dependent jar packages were not imported. At first, I wanted to import them one by one directly through maven. However, it was later found that this process could not be carried out, and there were too many dependent jars to continue. One sub-project was fine, and there were more than a dozen sub-projects in the spring source code. After being busy for a long time, the rogue had to give up and continue to look for other solutions. As a result, I saw the documentation for building the source code on the gitHub homepage of spring-framework, and found that the spring framework uses Gradle to automatically build it. After my own exploration, I finally completed the import of all sub-projects at one time.

The specific steps are as follows:

1. Select a version to study from svn (I chose tags/v3.2.4.RELEASE here) and export it to a directory (eg: D:/opensource/spring-framework).

2. Install the Gradle software. The installation process is very simple. See the official document http://www.gradle.org/docs/current/userguide/userguide_single.html#installation for detailed steps.

3. Enter the D:/opensource/spring-framework directory and there is an import-into-eclipse.bat batch file. As the name suggests, double-click to display the console interface, and press the Enter key twice in a row to start the automatic build. The build process It takes a long time (downloading various dependent jar packages and dom files), maybe my home network speed is not good, it took a few hours. In the middle, it often stops and does not move, press Ctrl+c to terminate the operation, double-click the import-into-eclipse.bat file again to repeat the above process (it will continue to build from the location of the last build), and control after the build is completed. The station will automatically turn off.

4. In the Eclipse menu File--->import, select Exsiting projects into workspace under General, so the import is completed. Somehow there will be errors in several source files, such as @Override a method that does not exist ( The solution is to remove the @Override annotation), note that some sub projects require jre1.7 or above (the new api in 1.7 is referenced in it).

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327096995&siteId=291194637