maven项目主体结构:
另外,Eclipse新建项目时会生成.project、.classpath及.settings目录下的文件,这些文件用于描述一个Eclipse项目,
接下来做一个简要的解析:
.project
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<!-- 项目名称 -->
<name>aaa</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>
.classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<!-- kind="src"表明这是针对源文件的处理,即src/main/java下的源文件编译到target/classes目录下 -->
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<!-- pom derived(衍生)表明项目由pom衍生而来,受maven管理 -->
<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>
<!-- kind="con"表明这是配置,此项目使用得JDK为J2SE-1.5 -->
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<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>
<!-- kind="output"表明这是输出,此项目一般输出到target/classes下 -->
<classpathentry kind="output" path="target/classes"/>
</classpath>
.settings
.prefs属性文件
org.eclipse.jdt.core.prefs (java development tools)关于java编译的配置
org.eclipse.m2e.core.prefs 关于maven的配置