Maven項目的pom.xml配置文件格式初識


Maven項目

有pom.xml文件的項目就已經是一個maven項目了,但是還沒有被maven托管,我們需要將該項目添加為maven項目

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                             http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!-- 公司或者組織的唯一標志,並且配置時生成的路徑也是由此生成, 如com.winner.trade,maven會將該項目打成的jar包放本地路徑:/com/winner/trade -->
    <groupId>com.funtl</groupId>
    <!-- 本項目的唯一ID,一個groupId下面可能多個項目,就是靠artifactId來區分的 -->
    <artifactId>hello-spring</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <!-- 打包的機制,如pom,jar, maven-plugin, ejb, war, ear, rar, par,默認為jar -->
    <packaging>jar</packaging>

    <dependencies>
        <!--Spring依賴-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.3.17.RELEASE</version>
        </dependency>
        <!--單元測試-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <!--日志輸出-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.25</version>
        </dependency>
    </dependencies>

</project>


免責聲明!

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



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