Jruby" InvokerGenerator:不受支持的major.minor版本"在编译期间使用netbeans-8

时间:2014-12-22 05:25:09

标签: java maven netbeans jruby

我从github克隆JRuby源代码,并首先在控制台中使用mvn编译源代码(使用JDK7)。编译成功。

然后我将整个项目加载到netbeans(8.0)中,并尝试编译,但它会抛出错误 “exec-maven-plugin:1.2.1:exec(invoker-generator)@jruby-core”

cd /opt/pro/jrubysrc/jruby/core; JAVA_HOME=/opt/pro/JDK/jdk1.7.0_40 /opt/pro/netbeans-8.0.2/java/maven/bin/mvn -Dfile.encoding=utf-8 clean install
Scanning for projects...

...       

--- exec-maven-plugin:1.2.1:exec (invoker-generator) @ jruby-core ---
Exception in thread "main" java.lang.UnsupportedClassVersionError: **org/jruby/anno/InvokerGenerator : Unsupported major.minor version 51.0**
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: org.jruby.anno.InvokerGenerator. Program will exit.
------------------------------------------------------------------------
Reactor Summary:

JRuby ............................................. SUCCESS [0.948s]
JRuby Core ........................................ FAILURE [1:31.125s]
JRuby Lib Setup ................................... SKIPPED
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1:32.562s
Finished at: Mon Dec 22 01:08:01 AST 2014
Final Memory: 17M/254M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (invoker-generator) on project jruby-core: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

After correcting the problems, you can resume the build with the command
  mvn <goals> -rf :jruby-core

JDK仍为1.7。似乎一些InvokerGenerator是由其他非1.7 javac编译的。然后我清理ruby-core项目甚至手动删除目标目录(选择项目,右键单击=&gt;选择clean&amp; build)。错误是一样的。

1 个答案:

答案 0 :(得分:0)

我修好了。

似乎为代码执行的Java版本区分了我为netbeans配置的java版本。在netbean&gt;工具&gt; Java平台中。只配置了一个Java(Java 7)。我仔细检查这也是JRuby核心项目。但是,当我右键单击项目并构建时,它使用open-jdk-6来执行invoke-generator,这是我的Ubuntu系统中的默认JDK。

我认为netbeans应该为项目使用已配置的JDK(编译和执行),它可能是netbeans的bug。

解决方法是在启动netbeans之前将JAVA_HOME设置为正确的JDK主目录。