Import the spring source into eclipse

Source: Internet
Author: User

Pre-conditions:

1. Install the JDK correctly and configure the Java_home, PATH. (I'm installing jdk1.8 here.)

2. Install eclipse properly. (My version of Eclipse is: Neon release (4.6.0))

Steps:

1. First download the spring source https://github.com/spring-projects/spring-framework/releases. Because my JDK version is 1.8, so the version i downloaded here is 4.3.2.

Unzip to the local directory when the download is complete.

2. The compilation of spring source code needs Gradle support, so we need to download Gradle https://gradle.org/gradle-download/gradle official website. If you can't open it, you can go to my web drive. Download: http://pan.baidu.com/s/1kVGu8yr

Once the download is complete, you will only need to unzip to the local directory, but remember to configure the environment variable gradle_home and path at this time. When configured correctly, the cmd input: Gradle-v can correctly display the Gradle version.

3. Enter the spring source root directory, open a command window, enter the Import-into-eclipse.bat run script, start compiling the spring source code and generate the. classpath,. Project files that can be imported into eclipse. At the beginning of the run there may be a download similar to: Https://services.gradle.org/distributions/gradle-1.12-bin.zip connection timed out, this is a network problem. You can try a few more times, or you can enter this path directly from the browser when you request this file at the command line.

Compilation takes a very long time. In the process of compiling is likely to appear errors, this time need to be based on specific error information Baidu to solve. Here is a need to pay attention to the place is: the source code with the path of the Build.gradle file is generally the following words:

Compilejava {
Sourcecompatibility = 1.6
Targetcompatibility = 1.6
}

Compiletestjava {
sourcecompatibility = 1.8
targetcompatibility = 1.8
Options.compilerargs + = "-parameters"
}

This is to specify that the source code is compiled using the jdk1.6, while the test is compiled using jdk1.8. This is where you should install jdk1.8.

4. All the way to the completion of the compilation can be imported in Eclipse, remember to check the eclipse in the list of all the projects below the project options, otherwise the import is a big spring project instead of separate projects.

5. After the import was completed, there was an error in the Spring-beans-groovy project because the groovy plugin was not installed in eclipse. Direct: Help--->install new software. Add the following site:

http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/after adding, select the required item to install. Different versions of the Eclipse installation Goorvy site list reference: Https://github.com/groovy/groovy-eclipse/wiki. After the installation is complete, restart Eclipse and clean the error project. If also reported is wrong, modify the level of groovy compilation to 2.3:

Two issues encountered with the second installation:

1. Unrecognized VM option ' maxmetaspacesize=1024m '

Cause: This JVM parameter is not supported in early jdk1.8

How to modify: Delete This configuration item in the source root path Build.gradle and Gradlew.bat.

2. Java.lang.reflect.Parameter cannot be found when compiling spring core, and javac-version display is old version

Cause: The jdk1.6 is installed in front of the local, and by modifying the Java_home the path is pointed to jdk1.8,java-version display 1.8. Javac-version display is still 1.6, the actual compile time run is jdk1.6, naturally cannot find the corresponding class.

Modification method: 1. Ensure that the configuration of%java_home%\bin in path is before the configuration of System32 (simply move it to the first bit) 2. Ensure that only one path variable is configured, and you need to be aware of including user variables and system variables.

Import the spring source into eclipse

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.