Ant script: Prevent duplication of JAR in javac-classpath war-lib

前端 未结 2 615
醉话见心
醉话见心 2020-12-31 13:53

I have a ANT script and I have a lot of duplicated path to same set JAR files. But there is so many double wording in the classpath and also in the war element.



        
2条回答
  •  -上瘾入骨i
    2020-12-31 14:52

    Since Ant 1.8.0 there is a new resource collection - mappedresources that can be used in place of the war task lib element.

    So, the task might look like this (pretty much straight from the docs):

    
        
            
               
               
            
            
              
              
            
        
    
    

    This feature was added to resolve a long-standing feature request to make the task flatten jars when deploying to WEB-INF/lib.

    previous answer:

    Although you can't easily convert a path to a fileset with vanilla Ant, you can go the other way. So one option would be to define your jars in a fileset, and derive the path from it. Something like this perhaps:

    
        
        
        
        
        
    
    
    
        
    
    
    
    
    
        
    
    

    Another possibility is to use the ant-contrib pathtofileset task.

提交回复
热议问题