eclipse 不能自动提示

错误信息:

This compilation unit is not on the build path of a Java project 

解决办法,修改项目下的.project 文件:

增加 jdt 支持:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
        <name>canal.example</name>
        <comment></comment>
        <projects>
        </projects>
        <buildSpec>
                <buildCommand>
                        <name>org.eclipse.jdt.core.javabuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
                        <name>org.eclipse.m2e.core.maven2Builder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
        </buildSpec>
        <natures>
                <nature>org.eclipse.jdt.core.javanature</nature>
                <nature>org.eclipse.m2e.core.maven2Nature</nature>
        </natures>
</projectDescription>


你可能感兴趣的:(eclipse)