2012-10-23 72 views
2

我正在学习使用Spring和gradle,通过使用git下载spring源码。我已经下载它使用 git克隆git://github.com/SpringSource/spring-framework.git 另外我已经在我的本地安装gradle。使用gradle构建弹簧时发生编译错误

虽然我试图执行

gradle这个建立

我收到编译错误如下:

C:\Users\mahendran\spring-framework>gradle build 
:spring-core:asmRepackJar 
:spring-core:cglibRepackJar 
:spring-core:compileJava 
C:\Users\mahendran\spring-framework\spring-core\src\main\java\org\springframework\util\xml\StaxUtils.java:318: 
cannot find symbol symbol : method newFactory() 
location: class javax.xml.stream.XMLEventFactory 
      return new XMLEventStreamWriter(eventWriter, XMLEventFactory.newFactory()); 
                     ^
Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. 
Note: Some input files use unchecked or unsafe operations. 
Note: Recompile with -Xlint:unchecked for details. 
1 error 
:spring-core:compileJava FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':spring-core:compileJava'. 
Compilation failed; see the compiler error output for details. 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 1 mins 5.58 secs 
+0

您的JDK是否安装了JAVA_HOME环境变量? XMLEventFactory类存在于JDK中。 –

+0

@ UmeshRajbhandari是的,我已经安装了jdk1.6.0,并且在JAVA_HOME环境变量中设置了相同的路径。 – Mahendran

+0

我也没有在j2se5 doc中看到XMLEventFactory.newFactory()方法。 http://docs.oracle.com/javaee/5/api/index.html?javax/xml/stream/XMLEventFactory.html – Mahendran

回答

2

这看起来像版本歪斜 - 我认为你需要更新你的JDK。 AFAICT,newFactory()在JDK6版本1.6.0.18中添加。