intellij-idea - 如何将外部 JAR 从一个项目导入到另一个项目?
问题描述
我创建了一个新的 IntelliJ 项目,我希望它像在另一个项目中一样具有 JAR 依赖项。
有没有一种方法可以在不使用 POM的情况下将JAR 依赖项从一个 IntelliJ 项目导出/复制粘贴到另一个项目?
谢谢。
可选解决方案:
1. Open <old-project>/.idea/libraries folder and <new-project>/.idea/libraries folder.
2. Make sure to enable the displaying of hidden files (in Win7, go to control-panel--> Folder Options --> View, and select the 'Show hidden files...')
3. Copy all XML files exists in .idea/libraries from the old project to the new one.
4. Make sure that each xml points to the right location of Jar. (In case of relative link)
5. Open the <old-project>.iml and <new-project>.iml, and copy all <orderEntry type="library" name"..."/> elements.
6. Restart your new project.
解决方案
我不知道从 IDEA 中执行此操作的方法,但是在您的项目文件夹下,您可以找到一个名为的目录.idea/libraries
,其中包含一系列 XML 文件,每个外部依赖项都有一个。您应该能够在项目之间复制这些,从而“共享”依赖项。
推荐阅读
- javascript - 更改字体日期时间标签 Highstock
- postgresql - 当行级安全有效时,没有得到唯一约束错误的“详细信息”部分
- netlogo - Netlogo,从列表 1 创建海龟,然后将它们移动到列表 2 中的坐标
- java - 如何在 java 中解析 build.gradle 文件?
- javascript - 用节点JS替换文件中的字符
- postgresql - 生产服务器上的事务慢 20 倍
- selenium - 从渲染器接收消息超时:600.000 当我们使用 Jenkins Windows 服务模式执行 selenium 脚本时
- python - NumPy `fromstring` 函数在 Python 2.7 中运行良好,但在 Python 3.7 中返回错误
- r - purrr rbind 每组数据帧列表
- java - 如何在 Javalin 中验证列表主体