2017-02-20 87 views
0

我無法正確地將庫導入到正在運行的項目中。我在.pom中添加了該庫作爲依賴項,刷新了pom,運行mvn clean install,並且已經設置了auto-import以便項目得到正確更新,但項目不會作爲外部庫添加,而且我也不能在我的項目中使用它。我沒有得到任何錯誤。我究竟做錯了什麼?Maven在添加到Intellij中的.pom文件後沒有將外部庫導入到項目中

這裏是我的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

+0

沒什麼,不幸的是 – Rafa

+0

在maven central或任何其他您在settings.xml中引用的repo中存在此依賴項。 [mvnrepository.com](http://mvnrepository.com/artifact/com.atlassian.crowd/crowd-integration-springsecurity)顯示了一些瘋狂的依賴版本:-)。 –

+0

@CrazyCoder我試過'編譯'和'測試'基於你的建議,但它沒有奏效。 – Rafa

回答

2

我想你錯過依賴管理的角度;詳情請參閱official docs。這是一項功能,您可以集中共享依賴信息,然後共享這些信息作爲不同的項目。所有本身,這個定義將不是導入依賴項。

你可能想要的只是一個簡單的依賴項:刪除dependencyManagement標籤,並將你的依賴關係移動到pom中的正確塊中。

相關問題