makeJar

task makeJar(type: Jar) {
//指定生成的jar名
baseName 'plugin'
//从哪里打包class文件
from('build/intermediates/classes/debug/com/xhrd/mobile/hybridframework/plugin/')
//打包到jar后的目录结构
into('com/xhrd/mobile/hybridframework/plugin/')
//去掉不需要打包的目录和文件
exclude('test/', 'BuildConfig.class', 'R.class')
//去掉R$开头的文件
exclude{ it.name.startsWith('R$');}
}

task makeJar2(type: Jar){
archiveName = "myJarName.jar"
from('build/intermediates/classes/debug/com/xhrd/mobile/hybridframework/plugin/'){
exclude('BuildConfig.class', 'R.class')
//去掉R$开头的文件
exclude{ it.name.startsWith('R$');}
}
//打包到jar后的目录结构
into('com/xhrd/mobile/hybridframework/plugin/')
}



http://stackoverflow.com/questions/11474729/how-to-build-sources-jar-with-gradle
http://www.alloyteam.com/2015/03/shi-yong-gradle-da-bao-zhi-ding-bao-ming-he-lei-di-jar/
posted @ 2015-07-09 20:46  AZ_mxl  阅读(829)  评论(0编辑  收藏  举报