Jenkins Artifactory 插件在尝试上传大型工件时给出意外字符

Jenkins Artifactory plugin give Unexpected character when trying to upload large artifacts

我使用 Jenkins Artifactory 插件。 Artifactory 安装在 Nginx 服务器旁边。有时,Jenkins return 上传错误:

[main] ERROR org.jfrog.build.extractor.maven.BuildInfoClientBuilder - Failed while reading the response from: PUT https://XXXX.XXX/XX-XXXXXXX-XXX/com/XXXX/XXXX/xxxxxxxx/xxxxxxx-api/1.0.0-SNAPSHOT/xxxxxxx-api-1.0.0-SNAPSHOT-jar-with-dependencies.jar;build.timestamp=1457104033410;build.name=xxxxxxx-build;build.number=75 HTTP/1.1
org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')

仅当文件大于特定大小时才会出现此错误。

这个问题是Nginx的问题。当我尝试使用来自其他软件(例如:DNC)的 "PUT" 操作时,我收到 Nginx 错误消息,而不是 Artifactory。这就是Artifactory无法理解的原因。

PUT https://XXXX.XXX/XX-XXXXXXX-XXX/com/XXXX/XXXX/xxxxxxxx/xxxxxxx-api/1.0.0-SNAPSHOT/xxxxxxx-api-1.0.0-SNAPSHOT-jar-with-dependencies.jar;build.timestamp=1457104033410;build.name=xxxxxxx-build;build.number=75 HTTP/1.1

结果:

<html>
<head><title>413 Request Entity Too Large</title></head>
<body bgcolor="white">
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.8.1</center>
</body>
</html>

你需要在你的 Nginx 配置文件中增加 client_max_body_size: /etc/nginx/nginx.conf

# set client body size to 500M #
client_max_body_size 500M;

500M 表示您需要上传的工件的最大大小。

更多信息在这里:http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/