java源码导入eclipse_spring framework源码下载并导入eclipse

一. 准备工作

1.下载安装sts(springsource推荐使用), 毕竟人家的框架用他自家的ide是最好的,当然sts也是基本eclipse的, 下载地址: http://www.springsource.org/downloads/sts-ggts

2.下载安装gradle, spring 源码构建加入了gradle支持. gradle下载: http://www.gradle.org/downloads ,下载后设置环境变量: GRADLE_HOME = gradle主目录 , 并在path中加入;%GRADLE_HOME%\bin;

3.下载安装github, spring源码托管到了github : http://windows.github.com/ (windows) ,当然您压需要注册github账号 , spring github托管地址: https://github.com/SpringSource/spring-framework

二.将springframework导入eclipse(sts)

1.生成eclipse配置 .

进入spring源码目录: 结构如下:

092cd62882ed0ccc9eed451066b55964.png

9f8ae7acb5b001a61305e9b17099b58f.png

可以看到spring为我们提供了导入eclipse的脚本,执行脚本即可.

不过经过我的实验spring提供的脚本执行到一半就出问题了不知道是什么原因. 我们自己用gradle命令来替代它提供给我们的脚本:

进入spring目录, 执行命令: gradle eclipse -x :eclipse

第一次执行会花比较长的时间,gradle会去下载许多依赖库, 执行报的结果如下 , 因为我之前已经执行过了花的时间不多

F:\GitHub\spring-framework>gradle eclipse -x :eclipse

:buildSrc:clean

:buildSrc:compileJava UP-TO-DATE

:buildSrc:compileGroovy

:buildSrc:processResources

:buildSrc:classes

:buildSrc:jar

:buildSrc:assemble

:buildSrc:compileTestJava UP-TO-DATE

:buildSrc:compileTestGroovy UP-TO-DATE

:buildSrc:processTestResources UP-TO-DATE

:buildSrc:testClasses UP-TO-DATE

:buildSrc:test

:buildSrc:check

:buildSrc:build

The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed

in Gradle 2.0. Please use the create() method instead.

The groovy configuration has been deprecated and is scheduled to be removed in Gradle 2.0.

Typically, usages of 'groovy' can simply be replaced with 'compile'. In some cases, it ma

y be necessary to additionally configure the 'groovyClasspath' property of GroovyCompile a

nd Groovydoc tasks.

The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradl

e 2.0. Please use the create() method instead.

:spring-aop:eclipseClasspath

:spring-aop:eclipseJdtPrepare

:spring-aop:eclipseJdt

:spring-aop:eclipseProject

:spring-aop:eclipseSettings

:spring-aop:eclipseWstComponent

:spring-aop:eclipse

:spring-aspects:eclipseClasspath

:spring-aspects:eclipseJdtPrepare

:spring-aspects:eclipseJdt

:spring-aspects:eclipseProject

:spring-aspects:eclipseSettings

:spring-aspects:eclipseWstComponent

:spring-aspects:eclipse

:spring-beans:eclipseClasspath

:spring-beans:eclipseJdtPrepare

:spring-beans:eclipseJdt

:spring-beans:eclipseProject

:spring-beans:eclipseSettings

:spring-beans:eclipseWstComponent

:spring-beans:eclipse

:spring-build-src:eclipseClasspath

:spring-build-src:eclipseJdtPrepare

:spring-build-src:eclipseJdt

:spring-build-src:eclipseProject

:spring-build-src:eclipseSettings

:spring-build-src:eclipseWstComponent

:spring-build-src:eclipse

:spring-context:eclipseClasspath

:spring-context:eclipseJdtPrepare

:spring-context:eclipseJdt

:spring-context:eclipseProject

:spring-context:eclipseSettings

:spring-context:eclipseWstComponent

:spring-context:eclipse

:spring-context-support:eclipseClasspath

Download http://repo.springsource.org/libs-release/commons-logging/commons-logging/1.1.3/c

ommons-logging-1.1.3.pom

Download http://repo.springsource.org/libs-release/commons-logging/commons-logging/1.1.3/c

ommons-logging-1.1.3.jar

:spring-context-support:eclipseJdtPrepare

:spring-context-support:eclipseJdt

:spring-context-support:eclipseProject

:spring-context-support:eclipseSettings

:spring-context-support:eclipseWstComponent

:spring-context-support:eclipse

:spring-core:eclipseClasspath

:spring-core:eclipseJdtPrepare

:spring-core:eclipseJdt

:spring-core:eclipseProject

:spring-core:eclipseSettings

:spring-core:eclipseWstComponent

:spring-core:eclipse

:spring-expression:eclipseClasspath

:spring-expression:eclipseJdtPrepare

:spring-expression:eclipseJdt

:spring-expression:eclipseProject

:spring-expression:eclipseSettings

:spring-expression:eclipseWstComponent

:spring-expression:eclipse

:spring-instrument:eclipseClasspath

:spring-instrument:eclipseJdtPrepare

:spring-instrument:eclipseJdt

:spring-instrument:eclipseProject

:spring-instrument:eclipseSettings

:spring-instrument:eclipseWstComponent

:spring-instrument:eclipse

:spring-instrument-tomcat:eclipseClasspath

:spring-instrument-tomcat:eclipseJdtPrepare

:spring-instrument-tomcat:eclipseJdt

:spring-instrument-tomcat:eclipseProject

:spring-instrument-tomcat:eclipseSettings

:spring-instrument-tomcat:eclipseWstComponent

:spring-instrument-tomcat:eclipse

:spring-jdbc:eclipseClasspath

:spring-jdbc:eclipseJdtPrepare

:spring-jdbc:eclipseJdt

:spring-jdbc:eclipseProject

:spring-jdbc:eclipseSettings

:spring-jdbc:eclipseWstComponent

:spring-jdbc:eclipse

:spring-jms:eclipseClasspath

:spring-jms:eclipseJdtPrepare

:spring-jms:eclipseJdt

:spring-jms:eclipseProject

:spring-jms:eclipseSettings

:spring-jms:eclipseWstComponent

:spring-jms:eclipse

:spring-orm:eclipseClasspath

:spring-orm:eclipseJdtPrepare

:spring-orm:eclipseJdt

:spring-orm:eclipseProject

:spring-orm:eclipseSettings

:spring-orm:eclipseWstComponent

:spring-orm:eclipse

:spring-orm-hibernate4:eclipseClasspath

:spring-orm-hibernate4:eclipseJdtPrepare

:spring-orm-hibernate4:eclipseJdt

:spring-orm-hibernate4:eclipseProject

:spring-orm-hibernate4:eclipseSettings

:spring-orm-hibernate4:eclipseWstComponent

:spring-orm-hibernate4:eclipse

:spring-oxm:eclipseClasspath

:spring-oxm:eclipseJdtPrepare

:spring-oxm:eclipseJdt

:spring-oxm:eclipseProject

:spring-oxm:eclipseSettings

:spring-oxm:eclipseWstComponent

:spring-oxm:eclipse

:spring-struts:eclipseClasspath

:spring-struts:eclipseJdtPrepare

:spring-struts:eclipseJdt

:spring-struts:eclipseProject

:spring-struts:eclipseSettings

:spring-struts:eclipseWstComponent

:spring-struts:eclipse

:spring-test:eclipseClasspath

:spring-test:eclipseJdtPrepare

:spring-test:eclipseJdt

:spring-test:eclipseProject

:spring-test:eclipseSettings

:spring-test:eclipseWstComponent

:spring-test:eclipse

:spring-test-mvc:eclipseClasspath

:spring-test-mvc:eclipseJdtPrepare

:spring-test-mvc:eclipseJdt

:spring-test-mvc:eclipseProject

:spring-test-mvc:eclipseSettings

:spring-test-mvc:eclipseWstComponent

:spring-test-mvc:eclipse

:spring-tx:eclipseClasspath

:spring-tx:eclipseJdtPrepare

:spring-tx:eclipseJdt

:spring-tx:eclipseProject

:spring-tx:eclipseSettings

:spring-tx:eclipseWstComponent

:spring-tx:eclipse

:spring-web:eclipseClasspath

:spring-web:eclipseJdtPrepare

:spring-web:eclipseJdt

:spring-web:eclipseProject

:spring-web:eclipseSettings

:spring-web:eclipseWstComponent

:spring-web:eclipse

:spring-webmvc:eclipseClasspath

:spring-webmvc:eclipseJdtPrepare

:spring-webmvc:eclipseJdt

:spring-webmvc:eclipseProject

:spring-webmvc:eclipseSettings

:spring-webmvc:eclipseWstComponent

:spring-webmvc:eclipse

:spring-webmvc-portlet:eclipseClasspath

:spring-webmvc-portlet:eclipseJdtPrepare

:spring-webmvc-portlet:eclipseJdt

:spring-webmvc-portlet:eclipseProject

:spring-webmvc-portlet:eclipseSettings

:spring-webmvc-portlet:eclipseWstComponent

:spring-webmvc-portlet:eclipse

:spring-webmvc-tiles3:eclipseClasspath

:spring-webmvc-tiles3:eclipseJdtPrepare

:spring-webmvc-tiles3:eclipseJdt

:spring-webmvc-tiles3:eclipseProject

:spring-webmvc-tiles3:eclipseSettings

:spring-webmvc-tiles3:eclipseWstComponent

:spring-webmvc-tiles3:eclipse

BUILD SUCCESSFUL

Total time: 1 mins 57.462 secs

执行完毕的进入到每个子目录下可以看到多了几个文件或目录, 就是设置eclipse项目及classpath的一配置如下:

11b7813ed2d8e8b6df0eb49e1a872c3a.png .settingsh文件夹及.classpath和.project就是刚才生成的配置

2.导入eclipse

eclipse : import - >

e71f5ba3c32dec467aa7d8dae5aa68e6.png

4ba7bdf03d4920be8b07675c5125189d.png

搞定收工

eclipse怎么导入已有源码 下面开始介绍导入源码的方法。 ◎选择菜单“文件/新建/项目”,选择“Java项目”,弹出“创建Java项目”对话框。 ◎在“创建Java项目”中输入“项目名”,项目名可以为任意名字,不必和main类的名字一样。这里假设为“Notepad”。 在“内容”中有两个单选按钮,视你的需要来使用。其中“在工作空间中创建新项目”会在你的工作空间中创建一个新目录,目录名与项目名一致;“从现有资源创建项目”可以在源码所在目录中直接编译运行,生成的class文件也会存放在源码目录中。 下面先讲“在工作空间中创建新项目”的方法。 ◎在“内容”中单选“在工作空间中创建新项目”,点击“完成”按钮。此时在e:\workspace下生成Notepad目录。 ◎下面需要导入源码到工作空间去。选择菜单“文件/导入”,选择“文件系统”。弹出“文件系统”对话框。 ◎在“从目录”中选择源码存放目录“我的文档\cai\Java\一个仿windows的记事本”,勾选上所有的.java源码,其他的垃圾不要选上。下面又有两个选择:对话框下方有两个选项,若选择“创建完整的文件夹结构”,就会按源码所存放的路径完整地在工作空间中创建目录,创建完毕会由于main方法类的路径不对而在包资源管理器内的图标上显示叉叉,无法编译成功;若选择“只创建选择的文件夹”,则会在工作空间创建的目录下导入所有的文件而不会保留原目录,此时可以编译成功。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值