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

来源:互联网 发布:手机网游 知乎 编辑:程序博客网 时间:2024/06/05 16:55

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

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

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

<?xml version="1.0" encoding="UTF-8"?><classpath><classpathentry kind="src" output="target/classes" path="src/main/java"><attributes><attribute name="optional" value="true"/><attribute name="maven.pomderived" value="true"/></attributes></classpathentry><classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"><attributes><attribute name="maven.pomderived" value="true"/></attributes></classpathentry><classpathentry kind="src" output="target/test-classes" path="src/test/java"><attributes><attribute name="optional" value="true"/><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"/></attributes></classpathentry><classpathentry kind="output" path="target/classes"/></classpath>