简体   繁体   English

将Maven依赖项导入intellij的类路径中

[英]importing maven dependencies into intellij's classpath

I am using Buildr with a java/scala project. 我在Java / scala项目中使用Buildr。 Dependencies are descried in the buildfile. 依赖关系在构建文件中描述。 An as you may know, Buildr downloads dependencies into ~.m2 folder (as maven2 does). 您可能知道,Buildr将依赖项下载到〜.m2文件夹中(就像maven2一样)。

I am wondering how can I import dependencies (from ~.m2 folder or buildfile) into my Intellij project to enjoy the code completion and error detection among other features offered by Intellij. 我想知道如何将依赖项(从〜.m2文件夹或buildfile)导入到Intellij项目中,以享受代码完成和错误检测以及Intellij提供的其他功能。

Thanks, -A 谢谢

buildr has a plugin to generate IntelliJ IDEA projects. buildr有一个生成IntelliJ IDEA项目的插件。 It's described here : 在这里描述:

If you use IntelliJ IDEA, you can generate project files by issuing: 如果使用IntelliJ IDEA,则可以通过发出以下命令来生成项目文件:

$ buildr idea $建设者的想法

It will generate a .iml file for every project (or subproject) and a .ipr that you can directly open for the root project. 它将为每个项目(或子项目)生成一个.iml文件,以及一个可以直接为根项目打开的.ipr文件。 To allow IntelliJ Idea to resolve external dependencies properly, you will need to add a M2_REPO variable pointing to your Maven2 repository directory (Settings / Path Variables). 为了使IntelliJ Idea能够正确解析外部依赖关系,您将需要添加一个M2_REPO变量,该变量指向您的Maven2存储库目录(设置/路径变量)。

If you're using IDEA 7 or later, use the buildr idea7x task instead. 如果您使用的是IDEA 7或更高版本,请改用buildr idea7x任务。 This task creates the proper .ipr and .iml files for IDEA version 7. It includes the -7x suffix in the generated files, so you can use the idea and idea7x tasks side by side on the same project. 该任务将为IDEA版本7创建正确的.ipr和.iml文件。它在生成的文件中包含-7x后缀,因此您可以在同一项目中并行使用idea和idea7x任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM