我正在尝试在Gradle构建后FTP签名的APK。我已经添加了新的构建配置来签署APK,但是我卡在了如何调用FTP任务上。
我在第59.6节中找到了一个官方样例,但是它抱怨无法解析依赖项org.apache.ant:ant-commons-net:1.8.4。所以显然我错过了一些明显的地方,比如给定的jar文件在哪里放置或引用它,尽管我认为maven会处理这种事情?
以下是链接的示例,它因依赖关系而失败:
这里是我完整的gradle.build文件,已删除一些敏感信息:
我在第59.6节中找到了一个官方样例,但是它抱怨无法解析依赖项org.apache.ant:ant-commons-net:1.8.4。所以显然我错过了一些明显的地方,比如给定的jar文件在哪里放置或引用它,尽管我认为maven会处理这种事情?
以下是链接的示例,它因依赖关系而失败:
configurations {
ftpAntTask
}
dependencies {
ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
module("commons-net:commons-net:1.4.1") {
dependencies "oro:oro:2.0.8:jar"
}
}
}
task ftp << {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
ftp(server: "ftp.apache.org", userid: "anonymous", password: "me@myorg.com") {
fileset(dir: "htdocs/manual")
}
}
}
这个失败了,显示如下信息:
> Could not find org.apache.ant:ant-commons-net:1.8.4.
这里是我完整的gradle.build文件,已删除一些敏感信息:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 17
}
signingConfigs {
signed {
storeFile file("(removed)")
storePassword "(removed)"
keyAlias "(removed)"
keyPassword "(removed)"
}
}
buildTypes {
signed {
debuggable false
jniDebugBuild false
signingConfig signingConfigs.signed
}
}
}
configurations {
ftpAntTask
}
dependencies {
ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
module("commons-net:commons-net:1.4.1") {
dependencies "oro:oro:2.0.8:jar"
}
}
}
task ftp << {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
ftp(server: "(removed)", userid: "(removed)", password: "(removed)", remoteDir: "(removed)") {
fileset(dir: "(removed)") {
include(name: "(removed)")
}
}
}
}