eclipse导入maven项目,把src/main, src/test直接解析成包名的错误

把资源文件src/main等都解析成java package名mian.xx.xx 导致整个工程都报错,解决方法是:

1. 点击工程右键--> maven -->update project

2. 如果第一步不行的话,则要修改.classpath文件,修改后文件为:

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <classpath>  
  3. <classpathentry kind="src" output="target/classes" path="src/main/java">  
  4. <attributes>  
  5. <attribute name="optional" value="true"/>  
  6. <attribute name="maven.pomderived" value="true"/>  
  7. </attributes>  
  8. </classpathentry>  
  9. <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">  
  10. <attributes>  
  11. <attribute name="maven.pomderived" value="true"/>  
  12. </attributes>  
  13. </classpathentry>  
  14. <classpathentry kind="src" output="target/test-classes" path="src/test/java">  
  15. <attributes>  
  16. <attribute name="optional" value="true"/>  
  17. <attribute name="maven.pomderived" value="true"/>  
  18. </attributes>  
  19. </classpathentry>  
  20. <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">  
  21. <attributes>  
  22. <attribute name="maven.pomderived" value="true"/>  
  23. </attributes>  
  24. </classpathentry>  
  25. <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">  
  26. <attributes>  
  27. <attribute name="maven.pomderived" value="true"/>  
  28. </attributes>  
  29. </classpathentry>  
  30. <classpathentry kind="output" path="target/classes"/>  
  31. </classpath>  
posted @ 2015-07-02 10:17  Q_Quan  阅读(2176)  评论(0)    收藏  举报