3、依赖(2)(maven笔记)

这里我们会发现聚合和继承的配置文件几乎一样,那我们可以将聚合中配置的模块


    ../user-core
    ../user-log
    ../user-dao
    ../user-service
  

直接拿到user-parent的配置文件中,而之前的聚合工程就不需要了,一个工程就完成了继承和聚合。这里我们给出整合后的所有模块的配置信息,同时对于没有整合之前的配置文件,我们都起名为pom_back.xml

user-parent/pom.xml


    4.0.0

    
        ../user-core
        ../user-log
        ../user-dao
        ../user-service
    

    org.konghao.user
    user-parent
    0.0.1-SNAPSHOT
    pom

    http://maven.apache.org

    
        UTF-8
    

    
        
            central
            Central Repository
            https://repo.maven.apache.org/maven2
            default
            
                false
            
        
    

    
        
            
            
                junit
                junit
                4.10
            
            
                log4j
                log4j
                1.2.17
            

            
            
                org.hibernate
                hibernate-core
                5.1.0.Final
            
            
                mysql
                mysql-connector-java
                5.1.38
            

            
            
                org.konghao.user
                user-core
                0.0.1-SNAPSHOT
            
            
                org.konghao.user
                user-log
                0.0.1-SNAPSHOT
            
            
            
            
                commons-logging
                commons-logging
                1.2
            
            
            
            
                org.konghao.user
                user-dao
                0.0.1-SNAPSHOT
                jar
            
            
                org.konghao.user
                user-log
                0.0.1-SNAPSHOT
                jar
            
        
    


user-core/pom.xml


    4.0.0

    
        org.konghao.user
        user-parent
        0.0.1-SNAPSHOT
        ../user-parent/pom.xml
    

    user-core
    jar
    user-core

    
        
            org.hibernate
            hibernate-core
        

        
            junit
            junit
            test
        
        
            log4j
            log4j
        
        
            mysql
            mysql-connector-java
        
    

user-log/pom.xml


    4.0.0
    
        org.konghao.user
        user-parent
        0.0.1-SNAPSHOT
        ../user-parent/pom.xml
    
    
    user-log
    jar
    user-log

    
        
            junit
            junit
            test
        
        
            log4j
            log4j
        
        
            commons-logging
            commons-logging
        
    

user-dao/pom.xml


    4.0.0

    
        org.konghao.user
        user-parent
        0.0.1-SNAPSHOT
        ../user-parent/pom.xml
    

    user-dao
    jar
    user-dao

    
        
            org.konghao.user
            user-core
        
        
            org.konghao.user
            user-log
        
        
            junit
            junit
            test
        
    

user-service/pom.xml


    4.0.0
    
        org.konghao.user
        user-parent
        0.0.1-SNAPSHOT
        ../user-parent/pom.xml
    

    user-service
    jar
    user-service

    
        
            org.konghao.user
            user-dao
            jar
        
        
            org.konghao.user
            user-log
            jar
        
        
            junit
            junit
            test
        
    

这就是我们一般的配置方式,这里只是做一个演示。

  • 版本
    版本号一般由单个数字组成,第一个数字是总版本号,第二个数字是分支版本号,最后一个是小版本号。中划线后面叫里程碑版本。总版本号的变动一般表示整体框架的变动。分支版本号的变动表示增加了一些功能。小版本号表示在分支版本上进行的bug的修复。里程碑一般开始的开发版本使用SNAPSHOT表示,而开发版本后面有可能是alpha版本,表示内部测试版本,之后还有beta版本,表示外部公测版本,之后是release版本,即是发布版本,如果此版本很稳定,那么就会变成GA版本,即稳定版本。
    注意:总版本号和分支版本号是必须的,后面两个不是必须的。一般由快照版本到release版本之后就会进入到下一个大版本的开发了。详细内容可以参考《版本控制之道:使用subversion》

你可能感兴趣的:(3、依赖(2)(maven笔记))