Add Java Libraries to a Netbeans Grails Project

主宰稳场 提交于 2020-01-02 02:53:05

问题


I am just getting started with Grails. How do I add Java libraries to my Grails project? 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. I am using the Netbeans IDE. Any help would be appreciated..

Buzzy


回答1:


This is a know bug in 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.




回答2:


Here is what I did to solve the problem when running SpringSource Toolsuite:

  1. Configure the build path by adding external jars (e.g. javax.mail, adwords-api, etc.)

  2. Imported the same jars in to the lib folder (where mysql connector jar is located).

This should fix the compile time errors you would receive from missing imports in your java files.

Hope this helps




回答3:


As stated above, this is a bug in the IDE, not Grails. Those libraries are available in your code, but the IDE won't do any code completion, etc.

Note, NetBeans 6.5 is supposed to have much better Grails integration. Or, you could use IntelliJ, which already has it.

G2One's acquisition by Spring Source makes the roadmap for Eclipse integration for Grails look much rosier, too. It's not there yet, but it's coming, and now maybe faster than we thought.




回答4:


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.

I have not tried NetBeans 6.7.




回答5:


I'm using 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!




回答6:


i m also using netbean 6.7 and it's automagically working when i passed the jar under Libraries folder



来源:https://stackoverflow.com/questions/294279/add-java-libraries-to-a-netbeans-grails-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!