How to replace a value in web.xml with a Maven property?

前端 未结 6 479
滥情空心
滥情空心 2020-12-03 06:35

I have a Maven project that downloads some test files into its build directory ./target/files. These files should then be available to a servlet, which I can ea

6条回答
  •  Happy的楠姐
    2020-12-03 07:14

    You can use Replace Ant Task to do it.

    Heres a sample Implementation where i replace the tokenkeys in a property file , adapt it to suit your needs

    test.properties

    SERVER_NAME=@SERVER_NAME@
    PROFILE_NAME=@PROFILE_NAME@
    

    pom.xml

     
        maven-antrun-plugin
        1.7
        
          
            compile
            
              
    
                
                  
                 
                 
                             
    
              
            
            
              run
            
          
        
       
    

    voila! Now execute

    mvn clean package
    

提交回复
热议问题