the resource is not on the build path of a php project

感谢作者,原文地址:http://blog.csdn.net/qinglianluan/article/details/30068491

一个工程已经存在了,例如叫myproject然后你将其导入了eclipse中, 无论你是通过import实现的还是通过new了一个相同名字的myproject并且在相同的workspace下,实现项目的导入, 你都可能遇到一个麻烦, 就是当你按住 'Ctrl'键并且点击一个集成的类或方法时 会提示the resource is not on the build path of a php project

那么怎么办呢:找到你的工程文件位置, 例如我的工程myproject下肯定有一个文件“.project” 用记事本打开它你会看到

<projectDescription>
    <name>myproject</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
    </buildSpec>
    <natures>
    </natures>
</projectDescription>

将其全部替换为:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>myproject</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>net.sourceforge.phpeclipse.parserbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.dltk.core.scriptbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.zend.php.zendserver.deployment.core.DeploymentBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.php.core.PHPNature</nature>
        <nature>org.zend.php.zendserver.deployment.core.DeploymentNature</nature>
        <nature>net.sourceforge.phpeclipse.phpnature</nature>
    </natures>
</projectDescription>

注意eclipse的本班不同这个xml文件可能会有差异,那么怎么办呢, 你只需要创建一个新的工程, 然后将其生成的“.project”文件 里的内容复制下, 然后替换你的目的工程的“.project”文件 并作小小的改动将<name>your project name<name>就可以了

猜你喜欢

转载自yeluotiying.iteye.com/blog/2296310