Javascript and CSS files combining in Maven build WITHOUT compression, minification etc

后端 未结 4 1275

Is there an Maven plugin that just combines js and css resources but doesn\'t do any minification, obsucation, compressing etc? Just simple resources concatenation.

4条回答
  •  庸人自扰
    2021-02-20 16:28

    Make the following changes to your project:

    1. In your pom.xml, tag, place:

      
      
          ro.isdc.wro4j
          wro4j-core
      
      
    2. In your pom.xml, tag, place:

      
          ro.isdc.wro4j
          wro4j-maven-plugin
          1.4.3
          
              
                  process-resources
                  
                      run
                  
              
          
          
              allDev
              ${basedir}/src/main/webapp/
              ${basedir}/src/main/webapp/
          
      
      
    3. In your pom.xml (or the parent pom.xml) tag, place:

      
      
          ro.isdc.wro4j
          wro4j-core
          1.8.0
      
      
    4. Create a wro.xml under /project/src/main/webapp/WEB-INF and place something like the following:

      
        
            
              /my1stJsFolder/*.js
              /my2ndJsFolder/*.js
              /someFileDirectlyUnderWEBINF.js
          
        
      
    5. In web.xml insert:

      
          WebResourceOptimizer
          ro.isdc.wro.http.WroFilter
      
      
          WebResourceOptimizer
          /wro/*
      
      

    allDev.js will be generated under /project/src/main/webapp.

    I am not sure yet how I could tell wro4j to only generate one in target (now you have two - one in the project source files and one in target).

    When compressing with yui plugin I only get one in target. But this should not be that big of a problem for you.

    For more:

    • https://code.google.com/p/wro4j/wiki/GettingStarted
    • https://code.google.com/p/wro4j/wiki/MavenPlugin
    • http://www.jarvana.com/jarvana/search?search_type=project&project=wro4j-maven-plugin

    ADDITIONALLY:

    If you have any problems with the resource processing try adding to tag:

    
        
            src/main/resources
            true
        
    
    

    And also to add

    
        org.apache.maven.plugins
        maven-resources-plugin
        
            
                pdf
                swf
                jpg
                jpeg
                class
                jks
                exe
                wmv
                jar
                zip
                gz
            
        
      
    

提交回复
热议问题