如何使 Netbeans 6.5 可共享库正常工作
我在 Netbeans 6.5 中创建了一个 Web 应用程序。 现在我想使用 Joda Time 库。 我想通过 subversion 共享这个库,因为我不希望我的队友依赖某些 Netbeans 配置。
为了让项目正常运行,我首先将该库添加到 Netbeans 库(工具 -> 库)。 这工作正常。 JAR 已添加到类路径中,并且也已部署。
但是,当我创建共享库时(通过“项目属性”->“库”->“浏览/新库文件夹”),JAR 不在类路径中。 我在代码 import org.joda.time.*
上收到错误消息 package org.joda.time does not exit
。
有任何想法吗?
I created a Web application in Netbeans 6.5. Now I want to use the Joda Time library. I want to share this library via subversion, because I don't want my team mates to be dependend on some Netbeans configuration.
Just to get the project working, I first added the library to the Netbeans library (Tools->Library). This worked OK. The JAR is added to the classpath, and is also deployed.
But when I create a shared library (via Project Properties->Libraries->Browse/New Libraries Folder), the JAR is not in the classpath. I get the error message package org.joda.time does not exist
on the code import org.joda.time.*
.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这个图书馆的范围是什么? 这个库仅用于这个特定的 Web 应用程序吗?
如果是这样,我们可以将库放在 WEB-INF/lib 目录中并将其也检查到 subversion 中吗?
WEB-INF/lib 目录中的库应自动添加到项目的类路径中。
What is the scope of this library? Is this library used for just this particular web-application?
If so, can we put the library in the WEB-INF/lib directory and check that into subversion as well?
Libraries in the WEB-INF/lib directory should be automatically added to the classpath of the project.
这是我所做的:
工具 -> 图书馆-> 新图书馆...
Project -> 属性-> 图书馆
(编辑,我想我现在看到了这个问题 - 但也许没有)。
您需要将该库添加到编译库并将其添加到分发库。 或者我误解了这个问题?
Here is what I did:
Tools -> Library -> New Library...
Project -> Properties -> Libraries
(Edit, think I see the issue now - but perhaps not).
You need to add the library to the compile libraries AND add it to the distribution libraries. Or am I misunderstanding the question?
创建“新项目”时,有一个选项可以启用“库的专用文件夹”。 这样,这些库也将提交到存储库,并且您的同行开发人员可以使用您的项目所依赖的所有库来检出您的项目,从而消除 netbeans 配置绑定。
when creating a 'new project', there is an option to enable 'dedicated folder for libraries'. That way, the libraries will also be committed to the repository and your peer developer can checkout your project with all the libraries, your project has dependencies upon, thereby eliminating netbeans configuration bound.
在项目依赖于可以针对不同用户放置在不同位置的 JAR 的情况下,可以使用命名的 IDE 变量。
http://wiki.netbeans.org/NewAndNoteWorthyNB65#section-NewAndNoteWorthyNB65-VariableBasedPathsInJ2SEJ2EEProjects
另一种选择是使用 Maven 插件,该插件在 NetBeans 6.5 中已经运行良好。 Artifact Jar 文件的 Intranet 存储库可以放置在文件服务器上,或者通过 Nexus 等 Maven 代理进行管理。
In scenario where a project depends on JARs which can be placed in different locations for different users, a named IDE variable can be used.
http://wiki.netbeans.org/NewAndNoteWorthyNB65#section-NewAndNoteWorthyNB65-VariableBasedPathsInJ2SEJ2EEProjects
Another option would be to use the Maven plugin which already works quite well in NetBeans 6.5. A Intranet repository for the Artifact Jar files could be placed on a file server, or managed through a Maven Proxy like Nexus.
此博客文章描述了在 NetBeans 5 中有效的 hack。我不知道它是否在 NetBeans 6.5 中有效。 我也不知道如果您每晚在服务器上构建文件,这是否会起作用。
http://blogs.oracle.com/gjmurphy/entry/using_netbeans_free-form_projects_as
我记得 8 年前在 JBuilder 中设置过这样的共享库。 我希望 Netbeans 现在就拥有它。
This blog entry describes a hack that worked in NetBeans 5. I don't know if it will work in NetBeans 6.5. I also don't know if this will work if you are building files nightly on a server.
http://blogs.oracle.com/gjmurphy/entry/using_netbeans_free-form_projects_as
I remember setting up shared libraries like this 8 years ago in JBuilder. I wish Netbeans had it by now.