我在Maven 3.2.5上运行JDK-8,我的代码构建成功了
启动应用后,出现以下错误:
Caused by: java.lang.UnsupportedClassVersionError: com/daimler/duke/common/faults/CommonServiceFacadeFault has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_162]
我也对此进行了探索,一些博客显示该应用程序正在用Java 9进行编译,并尝试在Java 8中运行。
我的pom.xml文件是:
<project>
.............
.............
<properties>
<tycho.version>1.2.0</tycho.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
...........
</repositories>
<pluginRepositories>
...........
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.core.runtime</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui.ide</id>
<versionRange>0.0.0</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<configuration>
<compilerArgument>-warn:none</compilerArgument>
<compilerArgument>-err:none</compilerArgument>
<useProjectSettings>false</useProjectSettings>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
有人对此有想法吗?
注意:由于应用程序依赖性,我不能在这里使用Java 9。
答案 0 :(得分:0)
修复JDK版本问题后,需要运行clean
任务以重新编译所有类:
mvn clean package
如果您不添加clean
,则某些类将无法编译,并且错误仍然存在。