2012-10-23 73 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中添加。