maven - Jenkins 管道未完成 tomcat war 部署

标签 maven tomcat curl jenkins jenkins-pipeline

我想使用 Tomcat 管理器从 Jenkins 部署一场 war 。 这是我在命令行中所做的:

curl -v -u user:pasword -T target/app.war "http://host:8180/manager/text/deploy?path=&update=true"

这需要一点时间并且有效:

 * Hostname was NOT found in DNS cache
*   Trying ip...
* Connected to host.com (ip) port 8180 (#0)
* Server auth using Basic with user 'jenkins'
> PUT /manager/text/deploy?path=&update=true HTTP/1.1
> Authorization: Basic amVua2luczpLbzNEaUE=
> User-Agent: curl/7.38.0
> Host: host.com:8180
> Accept: */*
> Content-Length: 71682391
> Expect: 100-continue
> 
< HTTP/1.1 100 
* We are completely uploaded and fine
< HTTP/1.1 200 
< Cache-Control: private
< Expires: Thu, 01 Jan 1970 00:00:00 UTC
< Content-Type: text/plain;charset=utf-8
< Transfer-Encoding: chunked
< Date: Tue, 14 Aug 2018 13:18:22 GMT
< 
OK - Application déployée pour le chemin de contexte [/]
* Connection #0 to host host.com left intact

我的问题是当我在 Jenkins 管道中执行此命令时:

    stage('Tomcat Deploy') {
       sh "curl -v -u user:password -T app.war http://host:8180/manager/text/deploy?path=&update=true"
   }

curl 命令未正确完成:

    + curl -v -u jenkins:pass -T app.war http://host:8180/manager/text/deploy?path=
* Hostname was NOT found in DNS cache
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying ip...
* Connected to host.com (ip) port 8180 (#0)
* Server auth using Basic with user 'jenkins'
> PUT /manager/text/deploy?path= HTTP/1.1
> Authorization: Basic amVua2luczpLbzNEaUE=
> User-Agent: curl/7.38.0
> Host: host.com:8180
> Accept: */*
> Content-Length: 71682391
> Expect: 100-continue
> 
< HTTP/1.1 100 
} [data not shown]
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage

并且无需等待 curl 部署结果即可进入下一阶段。有什么快速解决方案可以解决这个问题吗?

最佳答案

是的, war 没有上传。但是我使用 --upload-file 选项解决了我的问题。现在 Jenkins 等待上传。谢谢。

关于maven - Jenkins 管道未完成 tomcat war 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51842967/

相关文章:

java - 使用 PostgreSQL 和 Tomcat 的单个应用程序/数据库服务器的安全性

apache - 使用 apache 和 tomcat 的虚拟主机

jakarta-ee - tomcat启动时出现 "javax.naming.OperationNotSupportedException"是什么原因

java - 无法下载 groovy.jar

python - 我尝试抓取网站,但不断收到 404 错误

linux - Bash 输出消失

bash - bash 脚本中要 curl 的变量中的特殊字符

java - 从 Maven 项目的类路径中排除某些依赖项

java - 项目编码设置为 UTF-8,默认字符集返回 windows-1252

java - 私下分发 jar 并解决其依赖关系的最简单方法是什么?