您的位置:首页 > 编程语言 > Java开发

eclipse 中.classpath和.project和.settings的作用

2016-05-26 10:15 309 查看
classpath作用

定义项目的结构,如src、output、con、lib等。

源文件的具体位置(kind="src")

运行的系统环境(kind="con")

工程的library的具体位置信息(kind="lib")

在每个lib的xml子节点中,有关于它的其它配置信息(例如我配置的那个"javadoc_location")

项目的输出目录(kind="output")

<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

每个新建java工程(Project)都默认存在的。

<classpathentry kind="src" ōutput="km230/apitest/classes" path="km230/apitest/src"/>

指定源文件位置, 对应工程属性Java build path中Source项中的一项, kind="src" 指明为源文件,

源文件路径path, output为这条路径中源文件编译以后class文件的输出路径。

<classpathentry kind="src" path="km230batch/src"/>

指定源文件位置, 对应工程属性Java build path中Source项中的一项, kind="src" 指明为源文件,

源文件路径path, 编译以后class文件的输出路径为默认输出路径。

<classpathentry kind="output" path="km230server/approot/WEB-INF/classes"/>

指定编译以后class文件的默认输出路径, 对应工程属性Java build path中Source项中的default output path,

kind="output"指明为默认class输出路径, path为相应输出路径。

注意: 这一条在文件中有且只能有一条(不可能同时出现两个默认吧?).

<classpathentry kind="lib" path="km230/lib/Notes.jar"/>

指定工程所用到的库文件或目录, 对应工程属性Java build path中Libraries项中的一项,

kind="lib"指明为库文件或目录, path为库文件或目录位置。

注意: 当指定库文件时(非库目录, 通常是jar包, 好像zip也可以, 不知道是否还有其它), 应当包含文件名。

<classpathentry kind="var" path="JUNIT_HOME/junit.jar" sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.0.0/src/org.junit_3.8.1/junitsrc.zip"/>

指定工程所用到的库文件或目录, 对应工程属性Java build path中Libraries项中的一项,

kind="var"指明带有全局编译路径中设置的变量(Window->Prefrences->Java->Build Path->Classpath Variables),

如上面的ECLIPSE_HOME, path为这个变量目录下的库文件(同样通常是jar包, 好像zip也可以, 也不知道是否还有其它)。

样本:

<?xml version="1.0" encoding="UTF-8"?>

<classpath>

<classpathentry kind="src" output="target/classes" path="src/main/java">

<attributes>

<attribute name="optional" value="true"/>

<attribute name="maven.pomderived" value="true"/>

</attributes>

</classpathentry>

<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">

<attributes>

<attribute name="maven.pomderived" value="true"/>

</attributes>

</classpathentry>

<classpathentry kind="src" output="target/test-classes" path="src/test/java">

<attributes>

<attribute name="optional" value="true"/>

<attribute name="maven.pomderived" value="true"/>

</attributes>

</classpathentry>

<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">

<attributes>

<attribute name="maven.pomderived" value="true"/>

</attributes>

</classpathentry>

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">

<attributes>

<attribute name="maven.pomderived" value="true"/>

</attributes>

</classpathentry>

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">

<attributes>

<attribute name="maven.pomderived" value="true"/>

</attributes>

</classpathentry>

<classpathentry kind="output" path="target/classes"/>

</classpath>

.project作

工程名<name></name>

工程注释描述<comment></comment>

运行时需要的额外Eclipse插件<natures></natures>,及其具体加载方式信息<buildSpec></buildSpec>

如果你在开发过程中向工程里面加入了很多额外的插件,则必然会导致你的Eclipse启动速度变慢。在这种情况下,你可以到这个文件里面去掉一些插件,不过这样一来你在开启那些关联文件的时候会加载那些插件

样本:

<?xml version="1.0" encoding="UTF-8"?>

<projectDescription>

<name>log4j-jmx-gui</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.m2e.core.maven2Nature</nature>

<nature>org.eclipse.jdt.core.javanature</nature>

</natures>

</projectDescription>

3. .settings文件的作用

里面存放各种插件的配置文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  eclipse