在Intellij中添加.pom文件后,Maven没有将外部库导入项目

时间:2017-02-20 20:55:58

标签: maven intellij-idea

我无法正确地将库导入我正在运行的项目中。我已将库添加为.pom中的依赖项,刷新了pom,运行mvn clean install,并设置了auto-import,以便项目正确更新,但项目没有添加为外部库,我不能在我的项目中使用它。我没有错。我做错了什么?

这是我的pom的相关部分

 ..properties
 <crowd.version>2.5.0</crowd.version>
 .. end properties

<dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.atlassian.crowd</groupId>
        <artifactId>crowd-integration-springsecurity</artifactId>
        <version>${crowd.version}</version>
        <scope>runtime</scope>
      </dependency>
    </dependencies>
</dependencyManagement>

以下是调试错误的问题: Import Maven dependencies in IntelliJ IDEA

1 个答案:

答案 0 :(得分:2)

我认为你错过了依赖管理的重点;在official docs中阅读更多内容。这是一个功能,您可以集中常见的依赖关系信息,然后共享不同的项目。总而言之,这种定义将导入依赖。

您可能想要的只是一个简单的依赖:删除dependencyManagement标记,并将依赖项移动到pom中的正确块。