我正在尝试使用gradle通过gradle上传文件。我在执行build.gradle时遇到一些问题。
代码:
task publisher(dependsOn: rpmpackage) {
exec {
executable "curl"; args "-k", "-u", "'un:pwd'" , " -F upload=@/distributions/test.rpm" , "http://ip:port/#browse/browse:test-files:com%2Fcompany%2Fcomponent"
}
}
错误:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: ; Unknown error
100 5037 100 5037 0 0 1703k 0 --:--:-- --:--:-- --:--:-- 1703k
<!DOCTYPE html>
<html>
<head>
<title>Nexus Repository Manager</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="description" content="Nexus Repository Manager"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<!--[if lt IE 9]>
<script>(new Image).src="http://ip:port/static/rapture/resources/favicon.ico?_v=3.12.1-01"</script>
<![endif]-->
<link rel="icon" type="image/png" href="http://ip:port/static/rapture/resources/favicon-32x32.png?_v=3.12.1-01" sizes="32x32">
........................................
<form id="history-form" class="x-hide-display">
<input type="hidden" id="x-history-field"/>
<iframe id="x-history-frame"></iframe>
</form>
</body>
</html>
> Task :rpmpackage
> Task :publisher
BUILD SUCCESSFUL in 5s
1 actionable task: 1 executed
即使构建成功,文件也不会上传到所需位置。
谢谢!
答案 0 :(得分:0)
我已经解决了上述问题。
这对我来说很好。
task publisher(dependsOn: rpmpackage) {
exec {
executable "curl"; args "-k", "-v","-u", "un:pwd" ,"-T", "$project.buildDir/distributions/test.rpm" , "http://ip:port/#browse/browse:test-files:com%2Fcompany%2Fcomponent"
}
}