Maven String Replace of Text Web Resources

后端 未结 5 1173
萌比男神i
萌比男神i 2021-02-07 07:38

I have a Maven web application with text files in

src/main/webapp/textfilesdir

As I understand it, during the package phase this te

5条回答
  •  耶瑟儿~
    2021-02-07 08:27

    I had a problem with the phases, using prepare-package not copied the file to war, my solution was this:

    Add this configuration in maven-war-plugin

    
                 org.apache.maven.plugins 
                 maven-war-plugin 
                  2.1.1 
             
              
                   prepare-package
                   
                        exploded
                   
              
               
                   
                   
                        
                             ${basedir}/WebContent? 
                   
                             /style.scss
                             
                        
                   
              
              
              Add the configuration to replacer 
     
           com.google.code.maven-replacer-plugin 
           replacer 
           1.5.1 
           
              
                   scss-replacement prepare-package 
                   replace
                    
                   WebContent?/css/style.scss
                    
                   \$url:.
                   
                   \$url: "www.myapplication.com.br/css/style.css";
                   target/app/css/style.scss
    
                   
              
         
    
    

    The output File not overwrite the file, so i put the configuration maven-war-plugin to exclude the file style.scss. bye!

提交回复
热议问题