简体   繁体   English

将Java库添加到Netbeans Grails项目中

[英]Add Java Libraries to a Netbeans Grails Project

I am just getting started with Grails. 我刚刚开始使用Grails。 How do I add Java libraries to my Grails project? 如何将Java库添加到Grails项目中? I added the Smack library jar to the lib folder of my Grails project, but I still cannot import any of its packages into my Java or Groovy classes. 我将Smack库jar添加到我的Grails项目的lib文件夹中,但我仍然无法将其任何包导入我的Java或Groovy类。 I am using the Netbeans IDE. 我正在使用Netbeans IDE。 Any help would be appreciated.. 任何帮助,将不胜感激..

Buzzy 嗡嗡

This is a know bug in NetBeans: http://www.netbeans.org/issues/show_bug.cgi?id=144243 这是NetBeans中的一个已知错误: http//www.netbeans.org/issues/show_bug.cgi?id = 144243

Maybe you can help the devolpers to fix it by adding a comment to this issue in the NetBeans bug tracker. 也许你可以通过在NetBeans错误跟踪器中为这个问题添加注释来帮助devolpers修复它。

Here is what I did to solve the problem when running SpringSource Toolsuite: 以下是我在运行SpringSource Toolsuite时解决问题的方法:

  1. Configure the build path by adding external jars (eg javax.mail, adwords-api, etc.) 通过添加外部jar(例如javax.mail,adwords-api等)来配置构建路径

  2. Imported the same jars in to the lib folder (where mysql connector jar is located). 将相同的jar导入lib文件夹(mysql连接器jar所在的位置)。

This should fix the compile time errors you would receive from missing imports in your java files. 这应该可以解决您在java文件中从丢失的导入中收到的编译时错误。

Hope this helps 希望这可以帮助

As stated above, this is a bug in the IDE, not Grails. 如上所述,这是IDE中的错误,而不是Grails。 Those libraries are available in your code, but the IDE won't do any code completion, etc. 这些库在您的代码中可用,但IDE不会执行任何代码完成等。

Note, NetBeans 6.5 is supposed to have much better Grails integration. 请注意,NetBeans 6.5应该具有更好的Grails集成。 Or, you could use IntelliJ, which already has it. 或者,您可以使用已经拥有它的IntelliJ。

G2One's acquisition by Spring Source makes the roadmap for Eclipse integration for Grails look much rosier, too. G2One被Spring Source收购,使得Grails的Eclipse集成路线图看起来也更加乐观。 It's not there yet, but it's coming, and now maybe faster than we thought. 它还没有,但它即将到来,现在可能比我们想象的要快。

I'm using Netbeans 6.7. 我正在使用Netbeans 6.7。 I just pasted the library in the project's 'lib' folder and when I went back to Netbeans the library was under the 'Libraries' folder automagically! 我只是将库粘贴到项目的'lib'文件夹中,当我回到Netbeans时,库自动地位于'Libraries'文件夹下!

即时通讯也使用netbean 6.7,当我在Libraries文件夹下传递jar时,它会自动运行

The issue still remains in NetBeans 6.5 (Build 200811100001), so the IDE will not do any code completion and formats the code that is referencing classes in the JAR as erroneous. 该问题仍然存在于NetBeans 6.5(Build 200811100001)中,因此IDE不会执行任何代码完成,并将引用JAR中的类的代码格式化为错误。

I have not tried NetBeans 6.7. 我没有尝试过NetBeans 6.7。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM