Android gradle 从多个目录复制到一个.jar
Android gradle Copy from more that one directory into one .jar
我想从多个目录复制一个 .Jar 文件:
所以两个目录中的所有.class文件都打包成一个.jar文件,这可能吗?
task makeJar(type: Copy)
from('directory1') && (directory2)
into('another directory')
include('classes.jar')
我可以像这样从一个目录复制:
task makeJar(type: Copy)
from('directory1')
into('another directory')
include('classes.jar')
对于Android:
命令:
gradlew jarDebug / gradlew jarRelease
代码:
android.libraryVariants.all { variant ->
task("jar${variant.name}", type: Jar) {
description "Bundles compiled .class files into a JAR file for $variant.name."
dependsOn variant.javaCompile
from variant.javaCompile.destinationDir
exclude '**/R.class', '**/R$*.class', '**/R.html', '**/R.*.html'
}
}
来源:
Java 或 Android 项目:
task makeJar(type: Copy) {
from('directory1/')
from('directory2/')
into('another directory/')
include('classes.jar')
}
类似:
示例:
task initConfig(type: Copy) {
from('src/main/config') {
include '**/*.properties'
include '**/*.xml'
filter(ReplaceTokens, tokens: [version: '2.3.1'])
}
from('src/main/config') {
exclude '**/*.properties', '**/*.xml'
}
from('src/main/languages') {
rename 'EN_US_(.*)', ''
}
into 'build/target/config'
exclude '**/*.bak'
includeEmptyDirs = false
with dataContent
}
来源: http://gradle.org/docs/current/dsl/org.gradle.api.tasks.Copy.html
我想从多个目录复制一个 .Jar 文件:
所以两个目录中的所有.class文件都打包成一个.jar文件,这可能吗?
task makeJar(type: Copy)
from('directory1') && (directory2)
into('another directory')
include('classes.jar')
我可以像这样从一个目录复制:
task makeJar(type: Copy)
from('directory1')
into('another directory')
include('classes.jar')
对于Android:
命令:
gradlew jarDebug / gradlew jarRelease
代码:
android.libraryVariants.all { variant ->
task("jar${variant.name}", type: Jar) {
description "Bundles compiled .class files into a JAR file for $variant.name."
dependsOn variant.javaCompile
from variant.javaCompile.destinationDir
exclude '**/R.class', '**/R$*.class', '**/R.html', '**/R.*.html'
}
}
来源:
Java 或 Android 项目:
task makeJar(type: Copy) {
from('directory1/')
from('directory2/')
into('another directory/')
include('classes.jar')
}
类似:
示例:
task initConfig(type: Copy) {
from('src/main/config') {
include '**/*.properties'
include '**/*.xml'
filter(ReplaceTokens, tokens: [version: '2.3.1'])
}
from('src/main/config') {
exclude '**/*.properties', '**/*.xml'
}
from('src/main/languages') {
rename 'EN_US_(.*)', ''
}
into 'build/target/config'
exclude '**/*.bak'
includeEmptyDirs = false
with dataContent
}
来源: http://gradle.org/docs/current/dsl/org.gradle.api.tasks.Copy.html