【问题标题】:Getting compilation error while building spring using gradle使用gradle构建spring时出现编译错误
【发布时间】:2012-10-12 22:26:30
【问题描述】:

我正在通过使用 git 下载 spring 源来学习使用 Spring 和 gradle。我已经下载了它使用 git clone git://github.com/SpringSource/spring-framework.git 我也在本地设置了 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

【问题讨论】:

  • 你的 JDK 是否安装了 JAVA_HOME 环境变量? JDK中存在XMLEventFactory类。
  • @UmeshRajbhandari 是的,我已经安装了 jdk1.6.0 并且在 JAVA_HOME 环境变量中设置了相同的路径。
  • 我也没有在 j2se5 文档中看到 XMLEventFactory.newFactory() 方法。 docs.oracle.com/javaee/5/api/index.html?javax/xml/stream/…
  • 试试gradlew build,而不是gradle build。无需手动设置 Gradle。如果这没有帮助,请显示gradlew -v 的输出。

标签: spring build gradle


【解决方案1】:

这看起来像是版本偏差 - 我认为您需要更新 JDK。 AFAICT,在 JDK6 版本 1.6.0.18 中添加了 newFactory()。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-03
    • 1970-01-01
    • 2014-06-17
    • 2020-08-12
    相关资源
    最近更新 更多