Eclipse导入Maven项目解决Build Path不能配置问题

Eclipse Mars Release (4.5.0)导入Maven项目时,发现项目Build Path不能配置,如下图所示:

解决办法:

1修改Project Facets

项目右键--->Properties--->Project Facets--->Convert to faceted from..--->勾选Java

2 修改项目下.classpath文件,以我本地项目为例:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java"/>
    <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
    <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
    <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
        <attributes>
            <attribute name="owner.project.facets" value="java"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
    <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="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

3 再次查看项目,出现Build Path配置选项:

posted @ 2018-09-28 17:48  ycyzharry  阅读(14099)  评论(0编辑  收藏  举报