Transferred from: https://www.cnblogs.com/scevecn/p/6043284.html
- The spring source version of this example is 4.3.0,
- So the JDK needs to be prepared for 1.8 (different versions of the source code require the same JDK)
- 1.8 Version Myeclipse10 No compilation environment, only the operating environment, a point of issue, download the latest version of the Eclipse Jee Neon
- GitHub
Spring's source code has been migrated from SVN to GitHub. It is also changed to build a project based on Gradle. It replaces the previous Ant+ivy system, so to build the Spring source environment first installs GitHub and Gradle.
- Download
The GitHub version for Windows systems is: https://desktop.github.com/. :
- Installation
- Click Install Package
- Start installation
- Download the installation file
- Automatically open the login screen after the installation is complete (no, no need)
- Login to GitHub (no, no need)
- Results
Download, install, Start menu on GitHub menu,
- do not rely on other modules : This attachment configuration will be used in the form of a third-party plug-in package, which should be relied upon as the underlying dependency, and not dependent on other business modules. (except DNA core)
- Flexible Expansion : Provides a unified framework to meet individual project configuration requirements for the individual attachments.
- Gradle
Gradle is a groovy-based build tool that uses groovy to write build scripts that support dependency management and multi-project creation, like Maven, but it's easier and lighter than it is.
Gradle provides Ivy with a layer that provides build-by-convention integration, and he also gives you a lot of features like Maven.
- Download
Gradle is: Http://www.gradle.org/downloads as a beginner to recommend the selection of documents and samples of the source of compressed files better, the download file decompression. If you are downloading the full package of gradle-xx-all.zip, it will have the following contents: User manual for binary files (including PDF and HTML two versions), DSL reference guide, API manuals (including Javadoc and Groovydoc), sample source code, for informational use only.
- Configuring Environment variables
GRADLE configuration in Windows: In the Environment Variables dialog box, define the environment variable gradle_home to your GRADLE root directory, and then modify the environment variable Path, that is, append%gradle_home%\bin; (Linux or Mac is $ Gradle_home/bin).
- Check
After the configuration is complete, when the configuration of the system variable is completed, open the Command window to enter the command "Gradle-version", if a gradle corresponding version information appears, the installation is successful.
- Spring Source Download
- Directly under the website (this can, choose the version of the source code, three selected one)
: https://github.com/SpringSource/spring-framework/tags/
Select the desired version to download the zip.
- SVN (the address is all the same, the three choose one)
: https://github.com/SpringSource/spring-framework/tags/
Research on Window-->open Perspective-->SVN Resource Database Use SVN checkout to local Disk
- Download spring using GitHub (not recommended this way, only the latest source code, please skip)
Click the Git Shell option on the shortcut menu, and after you open GitHub, you can convert the current operation directory to the directory where we want to store the source code via the CD command.
For example: E:\test, execute command CD e:\test
Enter the following command:
git clone git://github.com/springsource/spring-framework.git
Among them, Git://github.com/springsource/spring-framework.git is the source address of Spring. Executes the command and then enters the source download status.
After a period of waiting after the source download end, window state such as
At this point, the corresponding folder already exists the corresponding source information, as shown in.
- Spring Source Construction
Building a project using Gradle
The current source code cannot be imported directly into eclipse, and we also need to convert the source code into a form that eclipse can read.
- Single Project construction (option one, not recommended)
The Eclipse project can only be converted to the project of interest, for example, we want to view the source code of the Spring transaction section, Open the Command window, switch the current directory to the directory where the source code is located, here is the Spring-tx folder, execute the command gradle Cleanidea Eclipse. When the window appears the following status indicates that the conversion process has started, such as:
After a period of time the conversion succeeds, as shown in,
At this point, we look at the corresponding folder and see that there has been a need for the Eclipse project. Project and. classpath files, as shown in
Not compiled.
After compiling the
Open Eclipse, import the project, import the directory structure as
You will find an exclamation mark in front of the project name, which indicates that there is an error in the project. Looking at dependencies and engineering, you see problems with the packages on which the current project depends. Such as
However, when you view the dependent Projects, you find
Depending on the project problem, just need to compile the several projects needed to import it.
The dependent package has a problem and is resolved behind it.
- Batch build (option one, recommended although the time is long, but reduce the work of cleaning up the jar package after importing)
All projects can be compiled and imported at once. But this is not recommended, which can take a lot of time, and you have to recompile when there are compile errors.
- Gradlew.bat (pre-built)
Pring-framework directory There is a gradlew.bat batch file, double-click Appear console interface, two times in a row to enter the key, download a variety of dependent jar package and Dom files, the company outside the network is not good, with a few hours, did not down, this is embarrassing.
- Import-into-eclipse.bat (build)
Spring-framework directory There is a import-into-eclipse.bat batch file, double-click on the console interface, two times a row enter, you can start to build automatically, the construction process takes a long time (if there is no advance execution gradlew.bat, here will download the Dependent jar packages and Dom files).
In the middle also often appear to stop the situation, press CTRL + C to terminate the run, and then double-click the Import-into-eclipse.bat file to repeat the above process (will continue to build the location of the last build), after the completion of the build console will automatically shut down.
Finally, delete the setting folder and project file under Spring-framework, otherwise eclipse can only import the whole and cannot import each project.
- Problems with Spring Build
- Problems with dependent packages (this error is not reported when a batch build is found to be successful)
Temporarily encountered: Missing Spring-cglib-repack-3.2.4.jar and Spring-objenesis-repack-2.4.jar.
Although it may be downloaded from the Internet to this 2 package, however, due to the version issue, still can not be used. The best solution is to extract the required packages from the source.
- Download the corresponding version of the Dist.zip file
Download the corresponding version of the Dist.zip file to extract the required jar package (distribution, release version) Access address: http://repo.springsource.org/libs-release-local/org/ springframework/spring/(may be very slow)
- Extraction
Unzip the Spring-core-4.3.0.release.jar file in the Spring-framework-4.3.0.release-dist\spring-framework-4.3.0.release\libs directory
Under the CMD Command window, switch to the previous step in the directory,
Use the jar command to generate the required jar file:
Spring-cglib-repack-3.2.4.jar
Command: Jar CVF Spring-cglib-repack-3.2.4.jar Org\springframework\cglib
Spring-objenesis-repack-2.4.jar
Command: Jar CVF Spring-objenesis-repack-2.4.jar Org\springframework\cglib
- Check whether the build
View current directory E:\spring\code\spring-framework-4.3.0.RELEASE-dist\spring-framework-4.3.0.RELEASE\libs\ The required jar files are actually generated under Spring-core-4.3.0.release
Verify that the directory structure of the generated jar package is correct (because the first operation is not noticed, although the package is finished, but the directory structure is incorrect, and ultimately cannot be used)
- Groovybeandefinitionreader.java will make an error.
If eclipse does not have the groovy plugin installed, the Groovybeandefinitionreader.java in the Spring-beans-groovy package will error because eclipse cannot compile the groovy script.
Error message:
Description Resource Path Location Type
Groovydynamicelementreader cannot is resolved to a type
Groovybeandefinitionreader.java/spring-beans-groovy/src/main/java/org/springframework/beans/factory/groovy Line 391 Java Problem
Groovy:http://groovy-lang.org/download.html
- Install Groovy plug-in (online)
Step 1: Check your Eclipse version: view in Help->about Eclipse:
Step 2: Enter Https://github.com/groovy/groovy-eclipse/wiki to find and own eclipse corresponding version of Groovy:
Step 3: Copy http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/
Step 4: Open Eclipse, in Eclipse, choose Help--Install New software ... :
Step 5: Select Add, the name of the dialog box to write, the address of the above copy of the address pasted in:
Step 6: Wait for a small meeting, the following options will appear, after the full selection of the next:
- Restart
Restart Eclipse, then clean the project and it's done.
- Problems with Spring Build
In the Eclipse menu File->import select exsiting Projects into workspace
- Reference
Spring Environment Building--spring Source Depth Analysis:
Http://www.cnblogs.com/chuzh/p/4996976.html
Several ways to download dist.zip on the spring website:
Http://www.cnblogs.com/yjmyzz/p/3847364.html
Spring source is built with missing Spring-cglib-repack-3.2.4.jar and Spring-objenesis-repack-2.4.jar:
Http://www.itdadao.com/articles/c15a711547p0.html
Spring source Gradle get Eclipse Project, Spring-beans-groovy project Groovydynamicelementreader Error Resolution
http://blog.csdn.net/smithdoudou88/article/details/46356305
Spring source download and transfer to eclipse