为什么我不能构建Spring Data Commons?

时间:2016-03-04 16:29:47

标签: java spring spring-data-commons

我正在尝试在我的机器上构建spring-data-commons:

我做了以下事情:

$ git clone --depth 1 https://github.com/spring-projects/spring-data-commons.git
$ cd spring-data-commons
$ mvn clean install

我得到了:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[99,96] cannot find symbol
  symbol:   method toInstant()
  location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[119,102] cannot find symbol
  symbol:   method toInstant()
  location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[139,120] cannot find symbol
  symbol:   method toInstant()
  location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[159,96] cannot find symbol
  symbol:   method toInstant()
  location: class java.time.ZonedDateTime

我目前的设置:

mhewedy: $ uname -a 
Darwin Muhammads-MacBook-Pro.local 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
mhewedy: $ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
mhewedy: $ javac -version
javac 1.8.0_11
mhewedy: $ mvn --version
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T23:58:10+03:00)
Maven home: /Users/mhewedy/Work/Programs/apache-maven-3.2.3
Java version: 1.8.0_11, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.4", arch: "x86_64", family: "mac"

此外,我可以在我的jdk中找到方法java.util.Date.toInstant

更新

这是mvn clean install -X输出的一部分:

这是否与下面的代码段中的-target 1.6 -source 1.6有关?

[DEBUG] Command line options:
[DEBUG] -d /Users/mhewedy/Work/Code/contrib/spring-data-commons/target/classes -classpath /Users/mhewedy/Work/Code/contrib/spring-data-commons/target/classes:/Users/mhewedy/.m2/repository/org/springframework/spring-core/4.2.5.RELEASE/spring-core-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/org/springframework/spring-beans/4.2.5.RELEASE/spring-beans-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/org/springframework/spring-context/4.2.5.RELEASE/spring-context-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/org/springframework/spring-aop/4.2.5.RELEASE/spring-aop-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/mhewedy/.m2/repository/org/springframework/spring-expression/4.2.5.RELEASE/spring-expression-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/org/springframework/spring-tx/4.2.5.RELEASE/spring-tx-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/org/springframework/spring-oxm/4.2.5.RELEASE/spring-oxm-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.6.5/jackson-databind-2.6.5.jar:/Users/mhewedy/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.6.0/jackson-annotations-2.6.0.jar:/Users/mhewedy/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.6.5/jackson-core-2.6.5.jar:/Users/mhewedy/.m2/repository/org/springframework/spring-web/4.2.5.RELEASE/spring-web-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/javax/servlet/javax.servlet-api/3.0.1/javax.servlet-api-3.0.1.jar:/Users/mhewedy/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar:/Users/mhewedy/.m2/repository/joda-time/joda-time/2.9.2/joda-time-2.9.2.jar:/Users/mhewedy/.m2/repository/org/threeten/threetenbp/1.3.1/threetenbp-1.3.1.jar:/Users/mhewedy/.m2/repository/com/querydsl/querydsl-core/4.0.9/querydsl-core-4.0.9.jar:/Users/mhewedy/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/Users/mhewedy/.m2/repository/com/mysema/commons/mysema-commons-lang/0.2.4/mysema-commons-lang-0.2.4.jar:/Users/mhewedy/.m2/repository/com/infradna/tool/bridge-method-annotation/1.13/bridge-method-annotation-1.13.jar:/Users/mhewedy/.m2/repository/com/querydsl/querydsl-apt/4.0.9/querydsl-apt-4.0.9.jar:/Users/mhewedy/.m2/repository/com/querydsl/querydsl-codegen/4.0.9/querydsl-codegen-4.0.9.jar:/Users/mhewedy/.m2/repository/com/mysema/codegen/codegen/0.6.8/codegen-0.6.8.jar:/Users/mhewedy/.m2/repository/org/eclipse/jdt/core/compiler/ecj/4.3.1/ecj-4.3.1.jar:/Users/mhewedy/.m2/repository/org/reflections/reflections/0.9.9/reflections-0.9.9.jar:/Users/mhewedy/.m2/repository/org/javassist/javassist/3.18.2-GA/javassist-3.18.2-GA.jar:/Users/mhewedy/.m2/repository/com/google/code/findbugs/annotations/2.0.1/annotations-2.0.1.jar:/Users/mhewedy/.m2/repository/com/querydsl/querydsl-collections/4.0.9/querydsl-collections-4.0.9.jar:/Users/mhewedy/.m2/repository/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar:/Users/mhewedy/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar:/Users/mhewedy/.m2/repository/org/jboss/interceptor/jboss-interceptor-api/1.1/jboss-interceptor-api-1.1.jar:/Users/mhewedy/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/Users/mhewedy/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar:/Users/mhewedy/.m2/repository/org/springframework/hateoas/spring-hateoas/0.19.0.RELEASE/spring-hateoas-0.19.0.RELEASE.jar:/Users/mhewedy/.m2/repository/org/springframework/spring-webmvc/4.2.5.RELEASE/spring-webmvc-4.2.5.RELEASE.jar:/Users/mhewedy/.m2/repository/org/scala-lang/scala-library/2.11.7/scala-library-2.11.7.jar:/Users/mhewedy/.m2/repository/org/slf4j/slf4j-api/1.7.15/slf4j-api-1.7.15.jar:/Users/mhewedy/.m2/repository/org/projectlombok/lombok/1.16.6/lombok-1.16.6.jar: -sourcepath /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java:/Users/mhewedy/Work/Code/contrib/spring-data-commons/target/generated-sources/annotations: -s /Users/mhewedy/Work/Code/contrib/spring-data-commons/target/generated-sources/annotations -g -nowarn -target 1.6 -source 1.6 -encoding UTF-8
[DEBUG] incrementalBuildHelper#beforeRebuildExecution
[INFO] Compiling 352 source files to /Users/mhewedy/Work/Code/contrib/spring-data-commons/target/classes
[DEBUG] incrementalBuildHelper#afterRebuildExecution
[INFO] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/JodaTimeConverters.java: Some input files use or override a deprecated API.
[INFO] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/JodaTimeConverters.java: Recompile with -Xlint:deprecation for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[99,96] cannot find symbol
  symbol:   method toInstant()
  location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[119,102] cannot find symbol
  symbol:   method toInstant()
  location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[139,120] cannot find symbol
  symbol:   method toInstant()
  location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[159,96] cannot find symbol
  symbol:   method toInstant()
  location: class java.time.ZonedDateTime
[INFO] 4 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.132 s
[INFO] Finished at: 2016-03-04T21:07:54+03:00
[INFO] Final Memory: 22M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project spring-data-commons: Compilation failure: Compilation failure:
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[99,96] cannot find symbol
[ERROR] symbol:   method toInstant()
[ERROR] location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[119,102] cannot find symbol
[ERROR] symbol:   method toInstant()
[ERROR] location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[139,120] cannot find symbol
[ERROR] symbol:   method toInstant()
[ERROR] location: class java.time.ZonedDateTime
[ERROR] /Users/mhewedy/Work/Code/contrib/spring-data-commons/src/main/java/org/springframework/data/convert/Jsr310Converters.java:[159,96] cannot find symbol
[ERROR] symbol:   method toInstant()
[ERROR] location: class java.time.ZonedDateTime

1 个答案:

答案 0 :(得分:1)

您正在遇到this bug in early JDK8s。升级到最新版本(更新11已过时,版本74是最新版本),您将看到此工作。