Running resource filters when using jetty:run

前端 未结 3 784
盖世英雄少女心
盖世英雄少女心 2021-02-08 20:15

I\'m using resource filtering on jsps, based on profiles. I\'m also developing locally using mvn jetty:run, but the filtering phase does not run.

How can I

3条回答
  •  一个人的身影
    2021-02-08 20:41

    Thanks to @Randy I managed to get this working too. Heres an up to date example showing both the resources filtering and the jetty rebasing baseResource using org.eclipse.jetty rather than the older mortbay. Here we are filtering two jsp pages login.jsp and index.jsp and setting a variable "${login.resources}" in the jsp to "login.res.jsp" as per the properties section below. Note we filter and write these to "jetty.docroot", then we overlay jetty.docroot over src/main/webapps so our filtered jsps get used by jetty. The overlay is updated from @Randy to use the newer "org.eclipse.jetty.util.resource.ResourceCollection" implementation.

    
    
        jetty
    
        
            ${project.build.directory}/jetty
            login.res.jsp
        
    
        
    
            
    
                
                    maven-resources-plugin
                    3.0.2
                    
                        
                            jetty-docroot
                            
                            test-compile
    
                            
                                copy-resources
                            
                            
                                ${jetty.docroot}
                                
                                    
                                        ${basedir}/src/main/webapp
                                        true
                                        
                                            **/login.jsp
                                            **/index.jsp
                                        
                                    
                                
                            
                        
                    
                
    
                
    
                    org.eclipse.jetty
                    jetty-maven-plugin
                    9.4.0.v20161208
                    
    
                        2
    
                        
                            /intamerge
                             
    
                                 ${jetty.docroot},${basedir}/src/main/webapp
                                
                            false
                        
    
    
                    
                
            
        
    
    

提交回复
热议问题