Maven項目結構


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的配置

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM