想知道如何在Netbeans 8中使用Groovy 2.3? [英] Wondering how to use Groovy 2.3 with Netbeans 8?

查看:100
本文介绍了想知道如何在Netbeans 8中使用Groovy 2.3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我安装Groovy 2.3时,我感到很失望。我发现我不能在Netbeans 8中使用它。为什么?因为Netbeans Groovy支持固定在内置的Groovy 2.1上。这与Netbeans支持Ruby,JRuby,Java的方式不同......在哪里可以添加不同的平台。



- [ update 2016-10-14] -



我经历了Netbeans 8.2的这个练习。结果混淆至少说。我认为Netbeans可以通过使用像 Java平台选项这样的工具菜单项来管理不同的Groovy平台。或者使用GROOVY_HOME



在这台PC上安装的Groovy是:


  • Groovy 2.4 .7


    • 一个groovy Jar - groovy-all-2.4.7.jar


  • Java 8 u102



这很奇怪。 Netbeans Libraries中的Groovy库为:


  • Groovy 2.1.7


    • groovy-all




并将其替换为 groovy-all 2.4.7



我将此行添加到Groovy主类...

  printlnGroovy版本:+ GroovySystem.version; 
printlnJava version:+ System.getProperty(java.version);

输出:

  Groovy版本:2.1.3 
Java版本:1.8.0_102

我一直在寻找更多。 Netbeans日志让我看到加载的Groovy模块是:

  Groovy 2.1.7
jar:nbinst://org.netbeans.modules.libs.groovy/modules/ext/groovy-all.jar!/

我检查了这个文件,这个JAR文件报告了它的版本:

  java -jar /opt/dev/netbeans/home/groovy/modules/ext/groovy-all.jar -version 
Groovy版本:2.4.5 JVM:1.8.0_102供应商:Oracle Corporation操作系统:Linux



标签:2.1.7已过期。



Groovy 2.1.3 来自当我运行我的Groovy时Netbeans?



- [ end update ] -



从早期Netbeans版本的Stackoverflow问题涉及到这一点。我收集的一致意见是,您可以对捆绑的Groovy版本的安装方式进行破解,它应该可以工作。一个Groovy版本不仅仅是一个JAR文件,所以对我来说看起来并不像足够。因此,在更新的Groovy版本中应该有更多的事情要做。另外,这个过程意味着不能在Netbeans中使用两个不同的Groovy配置文件。



不能说Netbeans无法支持Groovy的多个版本适用于Ruby和Java - IntelliJ IDEA的功能与Eclipse相同。



我希望有人提出一个完整的插件替换Groovy 2.1的建议。



或者,任何人都看过类似于Ruby平台和Java平台的语言支持插件来获得语言支持,或者更普遍的方式将脚本作为外部工具,Gradle或Maven运行?我绝对认为,支持脚本语言只能依靠捆绑的单一版本是一种有限的方式。这意味着一个项目只会因为缺乏IDE的灵活性而陷入旧语言错误和其他问题之中。 解决方案

p>要在我的项目中使用Groovy 2.4.3,我遵循了 Groovy 标签中 Tools> Options> Miscellaneous 中的说明:


  1. groovy-lang.org

  2. Tools> Libraries中创建新的 Groovy 2.4.3 类库
  3. 设置库的Classpath jar to groovy-2.4.3 / embeddable / groovy-all-2.4.3.jar


I am disappointed when I installed Groovy 2.3 I discover that I can't use it with Netbeans 8. Why? Because the Netbeans Groovy support is fixed on the build-in Groovy 2.1. This is in contrast with the way Netbeans supports Ruby, JRuby, Java... Where you can add a different platforms.

--[ update 2016-10-14 ]--

I went through this exercise for Netbeans 8.2. The results are confused to say the least. I think Netbeans would benefit by having a Tools menu item like the Java platform option to manage different Groovy platform(s). Or use GROOVY_HOME

On this PC the installed Groovy is:

  • Groovy 2.4.7
    • one groovy Jar - groovy-all-2.4.7.jar
  • Java 8 u102

This is quite strange. The Groovy library in the Netbeans Libraries list was:

  • Groovy 2.1.7
    • groovy-all

I actually removed this from the Library list and replaced it with the groovy-all 2.4.7.

I added this line to a Groovy main class ...

  println  "Groovy version: "+ GroovySystem.version;
  println  "Java version:   "+ System.getProperty("java.version");

The output:

 Groovy version: 2.1.3
 Java version:   1.8.0_102

I have been looking further. The Netbeans log show me that the Groovy module loaded was:

  "Groovy 2.1.7"
  jar:nbinst://org.netbeans.modules.libs.groovy/modules/ext/groovy-all.jar!/

I checked that file, this JAR file reports its version:

 java -jar /opt/dev/netbeans/home/groovy/modules/ext/groovy-all.jar  -version
  Groovy Version: 2.4.5 JVM: 1.8.0_102 Vendor: Oracle Corporation OS: Linux

Ergo the label: "2.1.7" was out of date.

The thing to wonder about is WHERE does the groovy 2.1.3 come from when I run my Groovy from Netbeans?

--[ end update ]--

I scanned other Stackoverflow questions touching on this from earlier Netbeans versions. The consensus I gathered was that you can "hack" at the way the bundled Groovy version is installed and it should work. A Groovy release is more than just one JAR file so that doesn't seem like enough to me. There ought therefore be more things to do for swapping-in a newer version of Groovy. In addition, this procedure means that one cannot use two different Groovy profiles with Netbeans.

It can't be said that Netbeans could not support multiple versions of Groovy as it does for Ruby and for Java -- The IntelliJ IDEA does as does Eclipse.

I'm hoping someone comes with a suggestion for a complete swap-in to replace Groovy 2.1 with Groovy 2.3.

Alternatively has anyone seen a "language support" plugin similar to the Ruby platforms and Java platforms for language support, or a more general way to run scripts as external tools, Gradle or via Maven? I definitely think it is a limited way to support scripting languages to just rely on a bundled-in single version. It means a project will be stuck with 'old' language bugs and other issues just because of a lack of flexibility in an IDE.

解决方案

To use Groovy 2.4.3 in my projects, I followed the instructions in the Groovy tab at Tools > Options > Miscellaneous:

  1. Download Groovy 2.4.3 binary distro from groovy-lang.org
  2. Create new Groovy 2.4.3 class library in Tools > Libraries
  3. Set library's Classpath jar to groovy-2.4.3/embeddable/groovy-all-2.4.3.jar

这篇关于想知道如何在Netbeans 8中使用Groovy 2.3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆