maven切换环境配置

maven结构 


父级pom代码

com.minifast
	minifast
	0.0.1-SNAPSHOT
	pom

	minifast
	http://maven.apache.org

	
		UTF-8
	
	
		
		  javax.servlet
		  javax.servlet-api
		  3.0.1
		
	
	
		minifast-biz
		minifast-common
		minifast-web
	

biz pom代码

    com.minifast
    minifast
    0.0.1-SNAPSHOT
  
  minifast-biz
  jar
  minifast-biz
  http://maven.apache.org

 
     
      com.minifast
      minifast-common
      ${project.version}
    
  

common pom 代码

       
	        com.minifast
		minifast
		0.0.1-SNAPSHOT
	
	minifast-common
	jar

	minifast-common
	http://maven.apache.org
web pom 代码


    com.minifast
    minifast
    0.0.1-SNAPSHOT
  
  minifast-web
  war
  minifast-web
  http://maven.apache.org
  
     
      com.minifast
	      minifast-config
	      ${project.version}
      
      
      com.minifast
	      minifast-biz
	      ${project.version}
      
  
  
    minifast-web
    
            
                src/main/resources
                true
                
                    dev/*
                    test/*
                    prd/*
                
            
        
        
            
                org.apache.maven.plugins
                maven-war-plugin
                2.1.1
                
                    
                        false
                    
                    
                        
                            src/main/resources/${package.environment}
                            WEB-INF/classes
                            true
                        
                    
                
            
        
  
  
        
            dev
            
                dev
            
            
                true
            
        
         
            test
            
                test
            
        
        
            prd
            
                prd
            
        
    

profiles配置使maven可以切换不同目录


web目录结构



install会执行默认的dev环境

可以使用-P命令传入对应参数prd 或者test

clean install -P prd

你可能感兴趣的:(maven切换环境配置)