0

I am trying to compile an old project that uses JDK 1.5.0_13 with Maven 2.2.1.

The 'jaxws-maven-plugin' fails with this message:

[INFO] Processing: com.xyzzy.sydemas.facade.SydemasFacadeImpl
[INFO] jaxws:wsgen args: [-keep, -s, C:\Development\www\workspace\sydemas_ws_sei\target\generated-sources\wsgen, -d, C:\Development\www\workspace\sydemas_ws_sei\target\classes, -verbose, -encoding, UTF-8, -extension, -wsdl, -r, C:\Development\www\workspace\sydemas_ws_sei\target\generated-sources\wsdl, com.xyzzy.sydemas.facade.SydemasFacadeImpl]
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        ...few more lines here...

All the code is built with JDK 1.5, JAVA_HOME is set to the JDK 1.5. When I use 'javap' on the listed class file to see the version, it shows 49 which is the JDK 1.5 number.

The original POM used the old jaxws (version 1.10 from org.codehaus.mojo). I also tried the new one (2.3 from org.jvnet.jax-ws-commons) and it also fails.

I have searched all over and could not find a solution.

Thanks, Amir

4

1 回答 1

0

此错误通常发生在您使用比虚拟机尝试运行它的更高版本的 java 编译的 .class 时。

可能是你的 maven 使用了另一个版本的 jdk。

Compiler Plugin 用于编译项目的源代码。从 3.0 开始,默认编译器是 javax.tools.JavaCompiler(如果您使用的是 java 1.6),用于编译 Java 源代码。如果要强制使用 javac 插件,则必须配置插件选项 forceJavacCompilerUse。

请检查此链接。

于 2014-01-06T19:30:47.290 回答