2016-09-25 150 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>