eclipse项目没有在本地Maven存储库中导入jar包 [英] eclipse project not importing the jar packages in local Maven repository
问题描述
我在设置我的eclipse项目时遇到了问题。
问题是每当我创建一个新项目并导入code.Eclipse都没有解析存在于C文件中的jar文件中的包; /..../ user / .m2 /存储库。
I am facing a problem in setting my eclipse project. The problem is whenever I am creating a new project and import the code.Eclipse is not resolving the packages which are present in the jar files which are present in the C;/..../user/.m2/repository.
因此,在我通过转到Add External Jars在构建路径中手动添加所有必需的jar文件之前,它会产生大量的编译错误
Hence it's giving a lot of compilation errors until I add all the required jar files manually in the build-path by going to "Add External Jars"
我看到我的Eclipse类路径中存在M2_REPO。但仍然没有解析包。
请建议如何解决这个问题。
I saw that M2_REPO is present in my Eclipse classpath.But still it is not resolving the packages. Please suggest how this problem can be resolved.
Gaurav
推荐答案
我在Eclipse Kepler EE上遇到过这个问题,它预先构建了m2e,我终于通过在每个项目上执行以下操作来实现它:
I've had this issue on Eclipse Kepler EE which comes prebuilt with m2e, I finally got it working by doing the following on each project:
- 右键单击项目
- 选择属性
- 选择Maven
- 取消选中该选项说:解决Workspace项目中的依赖关系
- Right click on the Project
- Select Properties
- Select Maven
- Uncheck the option that says: Resolve Dependencies from Workspace projects
它应弹出一个显示Maven设置已更改的框。是否要更新项目配置?点击是。
It should pop up with a box that says Maven setting has changed. Do you want to update project configuration. Click Yes to this.
确认:
- 右键单击项目
- 选择属性
- 选择Java构建路径
- 检查Maven依赖项下的Libraries选项卡是否所有jar你预计现在有
。
- Right click on the project
- Select Properties
- Select Java Build Path
- Check the Libraries tab under Maven dependencies that all the jar you expected are now there.
这篇关于eclipse项目没有在本地Maven存储库中导入jar包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!