maven使用總結

maven的默認目錄設置

<build>
        <!--默認源代碼目錄-->
        <sourceDirectory>src/main/java </sourceDirectory>
        <!--默認測試源代碼目錄-->
        <testSourceDirectory>src/test/java</testSourceDirectory>
        <!--默認資源目錄-->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <!--默認測試資源目錄-->
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
</build>

 

Java web項目中使用maven jetty插件

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.4.6.v20170531</version>
    <configuration>
        <httpConnector>
            <port>9090</port>
        </httpConnector>
    </configuration>
</plugin>

 

指定JDK版本

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
    </plugins>
</build>

 

依賴管理相關命令

mvn dependency:list
​
mvn dependency:tree
​
mvn dependency:analyze

 

maven學習資源:

http://juvenshun.iteye.com

https://segmentfault.com/a/1190000005044702

maven modules:http://juvenshun.iteye.com/blog/305865

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章