Building spring 3 (Spring 3 source code import eclipse points)

Source: Internet
Author: User
Note: This article is from the blog "afei". If you want to repost this article, please contact the author! And indicate the source: Http://blog.csdn.net/faye0412/article/details/6609521

Today, I tried to import the source code downloaded from spring SVN to eclipse and compile it (the zip package under spring was directly imported to the project, but the compilation failed ). Today, I Googled and found that some of my predecessors have already done similar things. Here I also record the following. This article mainly refers to the blog post: official spring team: Ghost:I. Prerequisites(From the blog by iteye)● JDK To use spring 3, at least Java 5 is required; to compile spring 3, at least Java 6 is required. If your machine has multiple JDK versions installed, make sure that the JDK version in the environment variable is no less than 6.0. ● Ant Ant 1.7 or later. ● Set java_opts and ant_opts Set environment variables, depending on the configuration of your machine. Provide enough JVM memory; otherwise, memory overflow may occur during compilation. The reference settings are as follows:Config codeJava_opts =-xms512m-xmx1024m-XX: maxnewsize = 512 M-XX: maxpermsize = 1024 mAnt_opts =-xms256m-xmx768m-XX: maxnewsize = 256 m-XX: maxpermsize = 512 m When the above three points are ensured, you can continue the following operations. Basically, compilation will not cause any problems.2. Download spring 3 source codeSVN address: https://src.springframework.org/svn/spring-framework/trunk/
3. Use ant to compile springUse ant to build. It uses Ivy to download the third-party jar package on which spring 3 depends. This period of time will last for a long time. You can play a game or sleep for a while. I am using the aipu broadband. Although it is 2 m, it is finally basic after countless times (why, as mentioned later.In this process, I made a mistake many times and re-compiled it every time. A lot of jar files are not downloaded...
The expected result is as follows: command code

---> Cd $ {src_home}/build-spring-framework ---> Ant     Hava a rest ......     [...] Build successful

But every time I build a failed... so I tried again n multiple times. Finally, when I finally arrived at JUnit test, there was a failed, as shown below:
[JUnit] testcase: getsystemenvironment_withandwithoutsecurityma Nager (Org. SPRIngframework. Core. Env. environmenttests): Failed

According to the reply from the author of the spring team blog to @ reddog, I tried it and the result was success!
@ Reddog: if you wish to run all the tests, but simply ignore this one, add JUnit's @ ignore annotation to the test method that's failing. if you simply wish to build the spring jars locally and skip running all tests, simply run 'Ant jar '. it will compile and package the jars, but will not run any tests. keep in mind that if you're Trying To populate a local Maven repository, you can run 'Ant instal L-Maven '. This will compile the code, package the jars and copy them into the correct locations within your local ~ /. M2/Repository cache.
After compilation, I will not perform JUnit test. Execute ant jar and the result is successful! Hehao, the next thing to do is to import the compiled spring source code to eclipse: 1. create an ivy_cache environment variable (I didn't know where this variable was set before, so I thought it would be the default, so there were countless Red XX in the Project) The entire project of spring 3 depends on the environment variable ivy_cache. It is actually the ivy-cache directory created during ant build, which is a third-party jar package on which spring 3 depends.   In eclipse, choose Window> preferences> JAVA> build path> classpath variables> New: Path code
Name = ivy_cache Path =$ {src_home}/Ivy-Cache/Repository
2. Make sure that the installed JRE in eclipse is 6.0 +: window-> preferences-> JAVA-> installed jres, And that Java 6 is selected.
3. Import all spring projects to eclipse: file-> Import-> existing projects into workspace, and select $ {spring_src_home} as the root directory }.
Here, you can basically see all the spring projects imported to eclipse, but there may still be! Error message of "#". This may not be downloaded from the subcontracting in the central part of "Ivy". This is also true for me. Finally, I manually copy all the missing jar files one by one to another.
The missing jar package can be directly found and downloaded in spring) This article Sina Blog address: http://blog.sina.com.cn/s/blog_49fd52cf0100r2rn.html
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.