Java build time constant configuration

后端 未结 1 1739
囚心锁ツ
囚心锁ツ 2021-01-15 03:22

I have a project I would like to build using multiple configurations. I have a constant that needs to be different between builds but I do not know how to change it based o

1条回答
  •  执笔经年
    2021-01-15 03:53

    I would advise attempting to emulate Maven resource filtering and profile properties

    Source filtering

    src/templates/MyFile.java

    ..
    @WebService(targetNamespace = "@WS_NAMESPACE@")
    public class CustomerWebService {
    ..
    

    build.xml

    
        
           
           
              
           
        
    
    
    
        
            
            
            
            ..
            ..
        
    
    

    Notes:

    • The ANT copy task is capable of performing template substitutions.

    Build profiles

    Property files

    Each configuration has a different property file

    src/properties/dev.properties
    src/properties/qa.properties
    src/properties/prod.properties
    ..
    

    build.xml

    
    
    

    Choosing an alternative build profile

    ant -Dprofile=qa ..
    

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