How to use JSF versioning for resources in jar

前端 未结 3 1039
别那么骄傲
别那么骄傲 2020-12-01 13:20

PF 3.5.10, Mojarra 2.1.21, omnifaces 1.5

I have a JSF library (with css files only). This library is in a .jar file. The css will be included in xhtml with &l

3条回答
  •  甜味超标
    2020-12-01 13:24

    You can also use your project version and append it as a version number for your resource files. This can be done using the maven-war-plugin. The maven-war-plugin will look at your pages during the build time and replace the defined properties.

    The following example shows you how to configure the maven-war-plugin to filter your webapp resources in order to inject the custom property asset.version:

    pom.xml

    
    
      ...
    
      
        ${project.version}    
      
    
      ...
    
      
        
          ...
    
          
            org.apache.maven.plugins
            maven-war-plugin
            2.3
            
    
              
                gif
                ico
                jpg
                png
                pdf
              
    
              false
    
               
                
                  ${basedir}/src/main/webapp 
                  true 
                
               
    
            
          
    
          ...
        
      
    
    
    

    The asset.version property can then be used in your JSF file.

    Here is an example tested with JSF 2.2:

    
    
    
    
    ...
    
    

提交回复
热议问题