Eclipse 工程目录下的.classpath、.project文件和.settings文件作用

2018-03-0210:57:37来源:Kevin00 评论 2,003 views

1、.classpath 定义了你这个项目在编译时所使用的$CLASSPATH (注: 每次在更新jar的版本或者增加jar之后,请在SVN提交.classpath文件,否则工程的build path的jar中显示的一个已经不存在的jar)

1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="resource"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xmlbeans-2.6.0.jar"/>
    <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/XmlSchema-1.4.7.jar"/>
    <classpathentry kind="output" path="build/classes"/>
</classpath>

eclipse中的配置决定.classpath文件内容

2、.project文件记录工程信息

复制代码
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>bonc_ioc_omp</name>   <!-- 工程名称 -->
    <comment></comment>   <!-- 工程描述 -->
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>   <!-- build项目时校验选项 -->
            <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.common.project.facet.core.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>  <!-- 加载eclipse自带插件  -->
        <nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
        <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
        <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    </natures>
</projectDescription>
复制代码
buildCommand选项的设置由下图的设置处决定

 

3、settings文件夹记录工程的基本设置,如编码、使用的jdk版本、文件编译的jdk版本等信息