如何解决 netbeans 中的库引用问题?爪哇
我创建了一个 Web 应用程序,它曾经使用过多个库。所以我添加了它们,但后来我找到了替代方法,而且实际上是更好的方法来做同样的事情。因此,我从项目中删除了对这些 jar 和库的引用。一切工作正常,但是当我将同一个项目移动到我朋友的笔记本电脑时,Netbeans 6.8 根本不允许我部署该项目,并给出了我以前使用过的库的全部错误,但我不再使用它了。
我从 build.impl 文件中删除了所有引用,然后当我部署它时,它工作正常。但是,当我进行清理和构建并尝试部署它时,build.impl 会再次自动添加包含对库的引用的 xml 行,并再次给出一长串错误。我该如何摆脱这个?我真的厌倦了这些愚蠢的错误。
提前致谢 :)
I created a web application and it used several libraries once upon a time. So i added them but later on i found alternative and actually better way to do the same things. So I removed references from my project for those jars and libraries. Everything works fine but when I move the same project to my friend's laptop Netbeans 6.8 simply doesn't let me deploy the project and gives the whole bundle of errors of libraries that I used previously but I don't use it anymore.
I removed all references from build.impl file and then when I deploy it, it works fine. But when I do a clean and build and try to deploy it, build.impl automatically again adds those lines of xml which contains references to libraries and again gives me a whole long list of errors. How do I get rid of this? I am really tired of these silly errors.
Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会考虑切换到执行依赖项管理的构建系统。 Maven 本身受 Netbeans 支持,可以有效地解决这些问题(您会遇到一些新问题,但那是另一回事了)。
还有其他的,Ivy,Gradle,...但没有集成到 Netbeans 中。
在 pom.xml 中,您有一个依赖项列表,其中包含它们的依赖项。 Maven 将遍历依赖关系树并从公共存储库获取 jar,并将它们存储在本地存储库中。非公开可用的第 3 方 jar 也可以存储在那里,但您的朋友也必须将它们添加到他的存储库中。根项目文件夹中的一个小脚本可以在这里创造奇迹(或者您自己的共享存储库,但这是更重量级的)
几乎所有库都可以从 lib 文件夹中删除,这减少了版本控制下的大小,加快了速度。
Netbeans、Idea、Eclipse+m2eclipse 将它们的文件同步到 POM 上。
现在,maven 确实有它的缺点,当你尝试用它做一些稍微偏离它认为你应该做的事情时。
You might think about switching to a build system which does dependency management. Maven is natively supported by Netbeans and solves these problems effectively (you get some new problems in place but thatis another story).
There are others, Ivy, Gradle, ... but are not as integrated in Netbeans.
In the pom.xml you have a listing of dependencies which have their dependencies. Maven will walk the dependency tree and get the jar's from a public repository and stores them in your local repository. 3rd party jars which are not publically available can be stored there too, but your friend will have to add them to his repo too. A little script in the root project folder can do wonders here (or your own shared repo, but that is more heavyweight)
Almost all libs can be removed from the lib folder which reduces the size under version control, speeding it up.
Netbeans, Idea, Eclipse+m2eclipse the synch their files on the POM.
Now maven does have its warts, when you try to do things with it slightly left of what it thinks you should do.
我要做的就是删除所有 netbeans 特定文件,并使用您朋友笔记本电脑上的现有源从头开始重新创建一个项目。
What I would do, is to remove all netbeans specific files and re-create a project from scratch using existing sources on your friends' laptop.