Variables from properties file in Ant

前端 未结 1 1827
醉话见心
醉话见心 2021-01-15 19:49

I have an Android app that needs to be built for different environments (e.g., UAT, staging, production, etc.). Each environment needs different properties (e.g., URLs, pack

1条回答
  •  走了就别回头了
    2021-01-15 20:12

    A frequently asked question about Ant is:

    How can I do something like (double expanding the property)?

    The following Ant build file was inspired by that FAQ.

    parameters.properties

    dev.home-url = http://home_dev.com
    prod.home-url = http://home.com
    

    build.xml

    
        
        
    
        
            
            
            
                
            
        
    
        
            
            ${local.property}
        
    
    

    Executing the example task outputs:

    Buildfile: /workspace/build.xml
    example:
         [echo] http://home_dev.com
    BUILD SUCCESSFUL
    Total time: 405 milliseconds
    

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