Generate minimized jar with only used classes

前端 未结 4 1268
失恋的感觉
失恋的感觉 2021-01-17 11:44

I\'m in need of creating the minimal jar of utils library for use in Android. I\'m using some methods from apache commons libraries (such as IOUtils, Stri

4条回答
  •  臣服心动
    2021-01-17 12:39

    The maven plugin you can't remember is probably Apache Maven Shade Plugin, there is minimizeJar option. As Andreas_D noticed, this won't include classes, loaded with Class.forName, so you will need to implicity say in configuration, that you need them. Here is how i made maven to include jdbc driver in my single jar:

    
      net.sourceforge.jtds:jtds
        
          **
        
    
    

提交回复
热议问题