Maven项目无法产生Maven Dependencies且无法update project报cannot nest错误
2015-10-13 09:14
519 查看
这两天要导入公司的项目,熟悉框架,结果导了很多遍,都出现这个问题,上网找了很多,
有说这个解决方法的:
solution:
这往往是由于 web project的Maven选项 未启动(disable) 造成的;
我们只需要重启 Maven Dependency就行,
操作方式: 右击 web project --> Properties --> Macven --> Enable Dependency
Management
不知道是不是因为我的Maven版本是3,所以我压根不会出现Enable Dependency Management这个选项
最后我对比了一个没有出错的项目的.classpath文件,ctrl+f找maven,把对的那个项目的.classpath文件中有maven的全都粘到出错的项目中,然后refresh项目,发现出现了Maven Dependencies这个库!
后来再上网搜索,找到了解决办法:
找自己出错项目的.classpath文件,打开,ctrl+f,找是否有以下文件,如果没有在末尾加进去,再refresh项目即可:
添加后我的.classpath文件是这样的:
项目没有问题啦!开心!
项目加载是要读取.classpath文件的,加载不到且Maven不能update project说cannot nest错误。
有说这个解决方法的:
solution:
这往往是由于 web project的Maven选项 未启动(disable) 造成的;
我们只需要重启 Maven Dependency就行,
操作方式: 右击 web project --> Properties --> Macven --> Enable Dependency
Management
不知道是不是因为我的Maven版本是3,所以我压根不会出现Enable Dependency Management这个选项
最后我对比了一个没有出错的项目的.classpath文件,ctrl+f找maven,把对的那个项目的.classpath文件中有maven的全都粘到出错的项目中,然后refresh项目,发现出现了Maven Dependencies这个库!
后来再上网搜索,找到了解决办法:
找自己出错项目的.classpath文件,打开,ctrl+f,找是否有以下文件,如果没有在末尾加进去,再refresh项目即可:
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <attributes> <attribute name="maven.pomderived" value="true"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry>
添加后我的.classpath文件是这样的:
<classpath>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources/base">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/java/base"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources/ff.zqgame.com">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <attributes> <attribute name="maven.pomderived" value="true"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
项目没有问题啦!开心!
项目加载是要读取.classpath文件的,加载不到且Maven不能update project说cannot nest错误。
相关文章推荐
- 免费好软件推荐之Binary Viewer
- C++实现Matlab的fft2函数
- maven打包异常!COMPILATION ERROR
- 关于 JDBC 自动提交
- 裸机系列-UART串口
- GDI+编程小结
- Java: Array, Collection和Map的区别
- sublime text 快捷键注释、批量注释失效
- java中static的用法
- 程序设计基石与实践系列之C语言未定义行为一览
- NGINX Plus 现在完全支持 HTTP/2
- mysql启动失败!!
- 学习笔记(七):MFC中按钮的抬起和按下
- Maven工程红色叹号消除
- NGINX Plus 现在完全支持 HTTP/2
- Linux 查看网卡流量iptraf
- android 获取天气信息,解决了乱码的问题
- git Tips:一些有用的git命令
- NGINX Plus 现在完全支持 HTTP/2
- 真理