爲什麼.pom
文件中的某些maven依賴造成如下錯誤:Missing artifact nonfree-lingpipe:lingpipe:jar:2.3.1
?所有依賴項都列在.pom文件中。在.m2文件夾中,我有所有的依賴文件夾,但不是所有的罐子:所以對於nonfree-lingpipe:lingpipe:jar:2.3.1
- 沒有罐子,但我有一個用於4.1.0
。爲什麼maven沒有那個,但搜索2.3.1
?我沒有看到.pom
文件中的任何版本,只有名稱。爲什麼maven導致依賴性錯誤?
0
A
回答
0
Maven依賴關係必須指定一個版本號。如果你不能看到那麼一個列出您必須在POM中有dependency management元素或它的某個父:
<project>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>nonfree-lingpipe</groupId>
<artifactId>lingpipe:jar</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</dependencyManagement>
...
</project>
要進行更改到4.1.0,您必須在您的依賴顯式地指定版本聲明或尋找依賴管理部分並在那裏進行更改。
0
dependencyManagement中的定義僅定義了應該使用verison的工件,但並未真正使用此工件。此外給出的例子:
<dependencies>
<dependency>
<groupId>nonfree-lingpipe</groupId>
<artifactId>lingpipe:jar</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
是錯誤的,導致artifactId不應該包含冒號。正確的方法是:
<dependencies>
<dependency>
<groupId>nonfree-lingpipe</groupId>
<artifactId>lingpipe</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
此外,您需要在dependencyManagement塊之外定義此依賴關係以真正使用此依賴關係。
相關問題
- 1. 爲什麼Maven依賴排除不會導致編譯錯誤?
- 2. In-project Maven Repository導致依賴性錯誤
- 3. 爲什麼在AngularJS中添加依賴項會導致錯誤?
- 4. C++類相互依賴導致循環依賴性錯誤
- 5. 什麼導致這個Maven/JBehave錯誤?
- 6. 在Rails 3中導致這種依賴性錯誤的原因是什麼?
- 7. 爲什麼依賴屬性?
- 8. 是什麼導致循環依賴?
- 9. 相互依賴導致編譯錯誤
- 10. 添加Maven依賴項導致java.lang.ClassNotFoundException
- 11. 什麼是Maven依賴
- 12. Maven的依賴錯誤
- 13. gcm maven依賴項錯誤
- 14. 爲什麼「導入javax.jdo。*」導致錯誤?
- 15. NoSuchMethodError中的依賴性錯誤導致:PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode;
- 16. Firebase Admin SDK導致gradle「依賴性錯誤」
- 17. 爲什麼autowiring jdbctemplate會導致循環依賴?
- 18. Java爲什麼不依賴常量會導致重新編譯?
- 19. 什麼導致SIGABRT錯誤?
- 20. 什麼導致ENOTCONN錯誤?
- 21. 爲什麼這是')'導致錯誤?
- 22. 爲什麼printf導致分段錯誤?
- 23. 爲什麼這會導致SIGABRT錯誤?
- 24. PDO:爲什麼會導致錯誤?
- 25. 爲什麼會導致段錯誤?
- 26. 爲什麼這會導致錯誤?
- 27. 爲什麼它會導致錯誤?
- 28. 爲什麼會導致「exc_bad_access」錯誤?
- 29. pthread_join導致分段錯誤。爲什麼?
- 30. 這爲什麼會導致StackOverFlow錯誤?