maven_pom文件

查考资料:

  1. 史上最全的Maven Pom文件标签详解
    https://blog.csdn.net/zcl1199/article/details/53096698
  2. Maven中pom.xml配置文件详细介绍
    https://www.jb51.net/article/129417.htm
#pom文件demo

    
        1.2.17
        2.3.1
        2.7.4
        2.11.8
        1.2.0
        5.6.2
    

    
        
            org.apache.hadoop
            hadoop-client
            ${hadoop.version}
            provided
        
        
            org.apache.hadoop
            hadoop-common
            ${hadoop.version}
            provided
        

        
            mysql
            mysql-connector-java
            5.1.25
            compile
        
        
            com.alibaba
            fastjson
            1.1.26
            provided
        
    

    
        
        myPorjectName 
        
        ${basedir}/target 
        
        ${basedir}\src\main\java

        
            
                net.alchim31.maven
                scala-maven-plugin
                3.3.2
                
                    
                        
                            compile
                            testCompile
                        
                    
                
            
            
                org.apache.maven.plugins
                maven-shade-plugin
                2.4.3
                
                    
                        package
                        
                            shade
                        
                        
                            
                                
                                    *:*
                                    
                                        META-INF/*.SF
                                        META-INF/*.DSA
                                        META-INF/*.RSA
                                    
                                
                            
                        
                    
                
            
        
    

  • setting.xml主要用于配置maven的运行环境等一系列通用的属性,是全局级别的配置文件;
  • pom.xml主要描述了项目的maven坐标,依赖关系,开发者需要遵循的规则,缺陷管理系统,组织和licenses,以及其他所有的项目相关因素,是项目级别的配置文件;
# 一个典型的pom.xml文件配置
 
  
  
  4.0.0 
  
  
  com.winner.trade 
  
  trade-core 
  
  1.0.0-SNAPSHOT 
  
  jar 
  
  
  ... 
  
  
   

    
     
       
      
      com.winner.trade 
      trade-test 
      1.0.0-SNAPSHOT 
      
      
      test 
      
      false 
      
       
         
          org.slf4j 
          slf4j-api 
         
       
     
  
   
  

  
   
    UTF-8 
    1.5 
    1.5 
   
  


  • 这里有必要对一个不太常用的属性classifier做一下解释,因为有时候引用某个jar包,classifier不写的话会报错;
    classifier元素用来帮助定义构件输出的一些附属构件。附属构件与主构件对应,比如主构件是kimi-app-2.0.0.jar,该项目可能还会通过使用一些插件生成如kimi-app-2.0.0-javadoc.jar(Java文档)、kimi-app-2.0.0-sources.jar(Java源代码)这样两个附属构件。这时候,javadoc、sources就是这两个附属构件的classifier,这样附属构件也就拥有了自己唯一的坐标。
#构建配置

 
  
  
  myPorjectName 
  
  
  ${basedir}/target 
  
  
  
  install 
  
  
  
   
    ../filter.properties 
   
  
  
   
     
  
      
      
      
      resources 
  
      
      true 
  
      
      src/main/resources 
  
      
       
        **/*.properties 
        **/*.xml 
       
  
      
       
        jdbc.properties 
       
  
     
   
  
  
   
     
       
       
       
       
       
     
   
  
  
  ${basedir}\src\main\java 
  
  
  ${basedir}\src\main\scripts 
   
  
  
  ${basedir}\src\test\java 
  
  
  ${basedir}\target\classes 
  
  
  ${basedir}\target\test-classes 
   
  
  
  
  
   
  
    
    
    
    
    
     
      org.apache.maven.wagon 
      wagon-ssh 
      2.8 
     
  
   
  
  
   
     
       
      maven-assembly-plugin 
      2.5.5 
  
      
       
         
  
          
          assembly 
  
          
          package 
  
          
           
            single 
           
  
          
          false 
  
         
       
  
      
       
        ${finalName} 
        false 
        assembly.xml 
       
  
      
      
      false 
  
      
       
        ... 
       
  
      
      true 
  
     
   
  
  
  
  
   
    ... 
   
  

#分发配置



 
  
  
   
  
    
    
    true 
  
     repo-id  
     repo-name 
    file://${basedir}/target/deploy  
     
  
   
  
  
   
     
     
     
     
     
   
  
  
   
  
    
     site-id  
  
    
     site-name 
  
    
    scp://svn.baidu.com/banseon:/var/www/localhost/banseon-web  
  
   
  
  
  
   
  
  
   
  
    
     
  
    
     
  
    
     
  
    
     
  
   
  
  
  
  
   
  

#仓库配置


 
  
  
   
  
    
     
  
      
       
  
      
      
      
       
  
      
      
       
  
     
  
    
    
    
     
       
       
       
     
  
    
     repo-id  
  
    
     repo-name 
  
    
    http://192.168.1.169:9999/repository/  
  
    
    
    
    
     default 
  
   
  
 
  

 
  
  
   
  


#profile配置


 
  
  
   
    
     
  
      
      false 
  
      
      1.7 
  
      
       
  
        
        Windows XP 
  
        
        Windows 
  
        
        x86 
  
        
        5.1.2600 
  
       
  
      
      
       
  
        
        mavenVersion 
  
        
        2.0.3 
  
       
  
      
      
       
  
        
        /usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/ 
  
        
        /usr/local/hudson/hudson-home/jobs/maven-guide-zh-to-production/workspace/ 
  
       
  
     
     
     
     
     
     
     
     
     
     
     
  
#项目信息配置


banseon-maven  
  

http://www.clf.com/  
  



A maven project to study maven.  
  

 
  
  
   
  
 
  

 
  

 
  
  
   
  
    
     Demo  
  
    
     [email protected] 
  
    
     [email protected] 
  
    
     [email protected] 
  
    
     http:/hi.clf.com/ 
  
   
  
 
  

 
  
  
   
  
    
     HELLO WORLD  
  
    
     banseon  
  
    
     [email protected] 
  
    
     
  
    
     
       Project Manager 
      Architect  
     
  
    
     demo 
  
    
    http://hi.clf.com/  
  
    
     
       No  
     
  
    
     -5 
  
   
  
 
  

 
  
  
   
     
     
     
     
     
     
     
     
   
  
 
  


 
  
  
   
  
    
     Apache 2  
  
    
    http://www.clf.com/LICENSE-2.0.txt  
  
    
     repo 
  
    
     Abusiness-friendly OSS license  
  
   
  
 
  

 
  
  
  scm:svn:http://svn.baidu.com/banseon/maven/ 
  
  
  scm:svn:http://svn.baidu.com/banseon/maven/ 
   
  
  
   
  
  
   http://svn.baidu.com/banseon 
  
 
  

 
  
  
   demo  
  
  
   http://www.clf.com/ 
  

你可能感兴趣的:(maven_pom文件)