我应该在哪里存储第三方库以包含在 IntelliJ IDEA 项目中?
这不是关于如何将库添加到我的项目或模块依赖项;它是关于存储项目/模块设置引用的 .jar 文件的位置。
我是否应该在每个项目中都有一个 lib
文件夹,其中包含第三方库?或者我应该将它们存储在硬盘驱动器的其他位置?什么方案对你有用?
This is not about how to add libraries to my project or module dependencies; it's about where to store the .jar files that are referenced by the project/module settings.
Should I have a lib
folder in each project, containing the third-party libraries; or should I store them elsewhere on my hard drive? What scheme has worked for you?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的项目下总是有 lib-folder,我将库按照您的描述放置在其中。在库文件名中包含完整的版本号也很好。通常我也会将来源和文档放在那里:
这对我来说效果很好。
I always have lib-folder under the project, where I put the libraries as you described. It's also good to have the full version number in the library file names. Usually I place the sources and documentation there as well:
This has worked well for me.
我建议您看一下 Maven,它是一个构建工具,除其他外还可以为您管理依赖项,并与包括 IntelliJ 在内的各种 IDE 紧密集成。您的 PC 上有一个本地存储库,Maven 从中央存储库将库/源/javadoc 的副本下载到其中。 此处有一个入门教程。
我推荐这样做的原因是,您无需担心内容存储在哪里,所有内容都会自动加载到您的 IDE 中,但实际存储效率很高,因为您在磁盘上只拥有特定库的一份副本。
I would recommend you take a look at Maven, its a build tool which among other things manages your dependencies for you, and has tight integration with various IDE's including IntelliJ. You have a local repository on your PC into which Maven downloads copies of libraries/source/javadoc from a central repository. There is a getting started tutorial here.
The reason I'm recommending this is that you don't need to worry where things are stored, and everything is loaded into your IDE automatically, but the actual storage is efficient because you only ever have one copy of a particular library on disk.