Intellij想法无法解决maven中的任何问题 [英] Intellij idea cannot resolve anything in maven

查看:351
本文介绍了Intellij想法无法解决maven中的任何问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Intellij Idea的新手,我只是用 pom.xml 导入一个项目,但是ide并没有解决maven依赖项中的任何问题。

I'm new to Intellij Idea, i just import a project with pom.xml, but the ide didn't resolve anything in maven dependencies.

在代码中导入时, pom.xml 依赖项中定义的任何内容引发错误无法解析符号xxxxx

Anything defined in pom.xml dependencies when import in code raise an error cannot resolve symbol xxxxx

但是 mvn install 会起作用,我尝试在项目设置/库在 .jar 文件中,然后它可以工作,但是ide可以解析 pom中定义的库。 XML ?我不想每次都这样做。

But mvn install will work, i try import the dependencies in Project Settings/Libraries in .jar files, then it works, but could the ide resolve libraries defined in pom.xml? i don't want to do that everytime.

附加信息:

IDEA版本:12.0.3,操作系统:Windows 7,重新导入不起作用,maven版本:3.0.4,外部库下不存在maven依赖项。

IDEA version: 12.0.3, OS : windows 7, reimport does not work, maven version : 3.0.4, maven dependencies does not exists under Exernal Libraries.

idea.log中没有例外。 ..

there is no exceptions in idea.log...

推荐答案

在IntelliJ 12.1.4中,我浏览了设置 - > Maven - >导入并确保选择以下内容:

In IntelliJ 12.1.4 I went through Settings --> Maven --> Importing and made sure the following was selected:


  1. 自动导入Maven项目

  2. 为聚合器项目创建IDEA模块

  3. 保持来源...

  4. 排除构建目录...

  5. 使用Maven输出...

  6. 生成的源文件夹:自动检测

  7. 阶段为...:process-resources

  8. 自动下载:来源& 文档

  9. 使用Maven3导入项目

    • VM选项进口商:-Xmx512m

  1. Import Maven projects automatically
  2. Create IDEA modules for aggregator projects
  3. Keep source...
  4. Exclude build dir...
  5. Use Maven output...
  6. Generated souces folders: "detect automatically"
  7. Phase to be...: "process-resources"
  8. Automatically download: "sources" & "documentation"
  9. Use Maven3 to import project
    • VM options for importer: -Xmx512m

这让我有了很多未解决的进口报表让一切都解决了。我认为这里的关键是使用Maven3导入项目......希望这会有所帮助。

This took me from having a lot of unresolved import statements to having everything resolved. I think the key here was using Maven3 to import project... Hopefully this helps.

这篇关于Intellij想法无法解决maven中的任何问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆