使用JDK 6编译编译成功时,更新使用最新的JDK(1.8.0.25)时会出现以下错误:
Error Log from complication with JDK 8
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=512m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 07:51:28-0600)
Maven home: /usr/local/mvn
Java version: 1.8.0, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0/jre
Default locale: en_US, platform encoding: UTF-8
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project sakai-announcement-tool: Compilation failure: Compilation failure:
[ERROR] /home/mustansar/source/sakai-10.x/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java:[276,4] error: cannot find symbol
[ERROR] symbol: method setTitle(String)
[ERROR] location: variable da of type AnnouncementEntityProviderImpl.DecoratedAnnouncement
[ERROR] /home/mustansar/source/sakai-10.x/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java:[277,4] error: cannot find symbol
[ERROR] symbol: method setBody(String)
[ERROR] location: variable da of type AnnouncementEntityProviderImpl.DecoratedAnnouncement
[ERROR] /home/mustansar/source/sakai-10.x/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java:[278,4] error: cannot find symbol
[ERROR] symbol: method setCreatedByDisplayName(String)
[ERROR] location: variable da of type AnnouncementEntityProviderImpl.DecoratedAnnouncement
[ERROR] /home/mustansar/source/sakai-10.x/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java:[279,4] error: cannot find symbol
[ERROR] symbol: method setCreatedOn(Date)
[ERROR] location: variable da of type AnnouncementEntityProviderImpl.DecoratedAnnouncement
[ERROR] /home/mustansar/source/sakai-10.x/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java:[280,4] error: cannot find symbol
[ERROR] symbol: method setSiteId(String)
[ERROR] location: variable da of type AnnouncementEntityProviderImpl.DecoratedAnnouncement
[ERROR] /home/mustansar/source/sakai-10.x/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java:[281,4] error: cannot find symbol
[ERROR] symbol: method setSiteTitle(String)
[ERROR] location: variable da of type AnnouncementEntityProviderImpl.DecoratedAnnouncement
[ERROR] /home/mustansar/source/sakai-10.x/announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/entityprovider/AnnouncementEntityProviderImpl.java:[291,4] error: cannot find symbol
无论我们将maven源版本设置为1.6还是将其保持为1.8,都会出现此错误。无法找到的类是我们自己的,而不是JDK特有的。我没有看到任何可以找到类的模式与大多数都在同一个项目中的模式,而且都在src / main / java上
编辑:
maven编译器插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>