Is it possible to use proxy only when a specific profile is active in Maven?

前端 未结 1 1702
栀梦
栀梦 2021-02-13 02:06

I would like to use proxy only when a specific profile is active. To accomplish this, my guess is to parameterize the property of

1条回答
  •  没有蜡笔的小新
    2021-02-13 02:53

    You could try the following approach:

    
    
        
            
                httpproxy
                ${activate.proxy}
                http
                some.host
                8080
                localhost|127.0.0.1
            
        
    
        
            
                proxy-on
                
                    true
                
            
    
            
                proxy-off
                
                    false
                
            
        
    
        
            proxy-off
        
    
    

    So by default the proxy-off profile would be active, which would set activate.proxy to false and as such active of proxy to false.

    Then executing with:

    mvn clean install -Pproxy-on
    

    Would activate the proxy-on profile and the whole chain should result to true for active.

    0 讨论(0)
提交回复
热议问题