yuicompressor maven plugin and maven-war-plugin

前端 未结 7 1407
走了就别回头了
走了就别回头了 2020-12-24 03:34

I\'ve been struggling with getting this plugin to play nicely with the maven-war-plugin for a couple of hours now and I thought it was time to ask for help. I have the plugi

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 04:01

    I would like to add the configuration which worked for me:

    First, to fix m2e complaining about the 'Plugin execution not covered by lifecycle' I added the following in the parent pom taken from this post:

      
        
            
            
                org.eclipse.m2e
                lifecycle-mapping
                1.0.0
                
                    
                        
                            
                                
                                    net.alchim31.maven                               
                                    yuicompressor-maven-plugin
                                    [1.0.0,)
                                    
                                        compress
                                    
                                
                                
                                    
                                
                            
                        
                    
                
            
        
    
    

    Then in the war pom I put:

    
        
            
            net.alchim31.maven
            yuicompressor-maven-plugin
            1.4.0
            
            
                
                  compress
                
                
                   300
                   
                     **/*-min.js
                     **/*.min.js
                     **/*-min.css
                     **/*.min.css
                                 
                   true
                
            
            
            
            
                maven-war-plugin
                2.4
                
                    **/*.css,**/*.js
                
            
        
    
    

    This generates the minified css and js files in the project build target directory while excluding the original files.

    I hope this saves someone time.

提交回复
热议问题