gpt4 book ai didi

Gradle ant ftp错误: "425 Connection timed out"

转载 作者:行者123 更新时间:2023-12-02 00:08:12 25 4
gpt4 key购买 nike

我的 gradle 构建脚本有问题:

apply plugin: 'java'

/*
* Sources:
* http://stackoverflow.com/q/17201815/4490015
* https://github.com/Vazkii/Botania/blob/master/build.gradle
*/

repositories {
mavenCentral()
}

configurations {
ftpAntTask
}

/*
* Load configuration file.
*/
ext.priv = parseConfig(file('private.properties'))

/*
* Some project properties
*/
version = '0.0.1'
group = 'randers.notenoughvocab'
archivesBaseName = 'NotEnoughVocab'

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'
}
}
}

void ftp(Map args, Closure antFileset = {}) {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
Map ftpArgs = args + [ //some default options
verbose : 'yes',
server : priv.host,
userid : priv.user,
password: priv.pass
]
delegate.ftp(ftpArgs) {
antFileset.delegate = delegate
antFileset()
}
}
}

def parseConfig(File config) {
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
}

/**
* Uploads the javadoc to the server specified in private.properties
*/
task('uploadJavadoc', dependsOn: 'javadoc') << {
ftp(action: 'send') {
fileset(dir: 'build/docs/javadoc')
}
}

jar {
manifest {
attributes 'Main-Class': 'randers.notenoughvocab.main.NotEnoughVocab'
}
}

task('prepareBuild') {
ant.replace(file: 'src/main/java/randers/notenoughvocab/main/Reference.java', token: '@VERSION@', value: version)
}

build.dependsOn(tasks.prepareBuild)

我收到以下错误消息:

could not put file: 425 Could not open data connection to port 55080: Connection timed out

显然它有效for others 。我在 private.properties 中指定的服务器与 FileZilla 等 FTP 客户端配合良好,不会超时。我也尝试过使用本地 FTP 服务器进行相同的操作,但由于传输没有带宽限制,因此传输是即时的。
我可以做什么来防止超时?我应该关心端口 55080 吗?

我之前还进行了一些调试,并确保 priv.hostpriv.userpriv.pass 变量包含正确的信息.

最佳答案

如果当您从家用计算机(通常经过 NAT 且没有公共(public)可路由 IP)启动程序时出现该错误,您可以尝试使用 FTP 被动模式。来自 Ant task您只需将 passive: 'yes' 添加到您的 ftpArgs 中即可。

FTP 是一个很奇怪的协议(protocol):为了下载和上传文件,服务器到客户端会打开另一个连接,这通常会让没有公共(public) IP 的家庭用户感到头疼。简单的解决方案称为“被动模式”

关于Gradle ant ftp错误: "425 Connection timed out",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30018446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com