2016-09-25 70 views
0

我想製作我的第一個Maven Spring應用程序。我已經開始使用spring-mvc-archetype創建一個新的Maven應用程序作爲一個新項目。Maven - 不完整的構建路徑

創建項目後,我收到錯誤:

The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.format.FormatterRegistry. Fix the build path then try building this project The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.format.FormatterRegistry. Fix the build path then try building this project 

我檢查project -> build paths -> configure build paths -> Libralies -> Maven dependencies並沒有與該名稱的類文件。

你們可以幫我修復我的構建路徑,以免接收到這個錯誤嗎?

+0

你能告訴我們生成的POM? – Seelenvirtuose

+0

將您的org.springframework.format.FormatterRegistry jar文件添加到您的構建路徑中。看到我對這個鏈接的問題的答案: http://stackoverflow.com/questions/39688536/why-some-imports-cannot-be-resolved/39688714#39688714 希望這可以解決您的問題 –

+0

@AnusKaleem這不是一個好方法。他已經在Eclipse中使用Maven。所以正確的步驟是在POM中聲明一個依賴關係,然後讓M2E插件完成它的工作。不需要手動添加任何東西到構建路徑。 – Seelenvirtuose

回答

0

這個類是spring-context

可以添加以下依賴於你的pom.xml

<dependency> 
<groupId>org.springframework</groupId> 
<artifactId>spring-context</artifactId> 
<version>your spring version</version> 
</dependency>