解决方法 cvs或svn上下载的新项目无build path

工程名右键无build path, 右键propertise中也无。列出两个解决方法。这里是maven。先确定工程在package explorer 中的视图中。

1  .classpath 文件缺失 或者 .project 文件缺失,可以直接在其他可以build的工程中复制并且改一下 打开 .classpath 更改工程名。

新建 .project 复制黏贴一下代码

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>你的工程名</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.maven.ide.eclipse.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.maven.ide.eclipse.maven2Nature</nature>
    </natures>
</projectDescription>

新建 .classpath复制黏贴一下代码

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="JavaSource"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
</classpath>

2 .project中缺失<natures></natures>

 <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.maven.ide.eclipse.maven2Nature</nature>
  </natures>

按照1中的代码所在位置插入natures部分。

之后clean,刷新后我的工程就出现build path了。

原文地址:https://www.cnblogs.com/gujia93/p/6307713.html