环境: Jenkins 2.249.1在Windows Server 2016上。
正在使用的命令是
nuget.exe install itextsharp.pdfa -PreRelease -Version 5.5.13.2 \
-OutputDirectory C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/src/extras/packages \
-Source 'C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/;https://api.nuget.org/v3/index.json'
这是控制台日志的相关部分:
02:17:42 Feeds used:
02:17:42 C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\global-packages
02:17:42 C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/
02:17:42 https://api.nuget.org/v3/index.json
02:17:42
02:17:42
02:17:42
02:17:42 Attempting to gather dependency information for package 'itextsharp.pdfa.5.5.13.2' with respect to project 'C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\packages', targeting 'Any,Version=v0.0'
02:17:43 Gathering dependency information took 215.09 ms
02:17:43 Attempting to resolve dependencies for package 'itextsharp.pdfa.5.5.13.2' with DependencyBehavior 'Lowest'
02:17:43 Resolving dependency information took 0 ms
02:17:43 Resolving actions to install package 'itextsharp.pdfa.5.5.13.2'
02:17:43 Resolved actions to install package 'itextsharp.pdfa.5.5.13.2'
02:17:43 Retrieving package 'BouncyCastle 1.8.6.1' from 'nuget.org'.
02:17:43 Retrieving package 'iTextSharp 5.5.13.2' from 'C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/'.
02:17:43 Retrieving package 'itextsharp.pdfa 5.5.13.2' from 'C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/'.
02:17:43 GET https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg
02:17:43 OK https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg 165ms
02:17:43 WARNING: Error downloading 'BouncyCastle.1.8.6.1' from 'https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg'.
02:17:43 Could not find file 'C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\global-packages\bouncycastle\1.8.6.1\bouncycastle.1.8.6.1.nupkg'.
02:17:43 GET https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg
02:17:43 OK https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg 24ms
02:17:43 WARNING: Error downloading 'BouncyCastle.1.8.6.1' from 'https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg'.
02:17:43 Could not find file 'C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\global-packages\bouncycastle\1.8.6.1\bouncycastle.1.8.6.1.nupkg'.
02:17:43 GET https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg
02:17:43 OK https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg 23ms
02:17:43 WARNING: Install failed. Rolling back...
02:17:43 Executing nuget actions took 482.72 ms
02:17:43 Error downloading 'BouncyCastle.1.8.6.1' from 'https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg'.
02:17:43 Could not find file 'C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\global-packages\bouncycastle\1.8.6.1\bouncycastle.1.8.6.1.nupkg'.
看起来nuget install
正在尝试3次获取bouncycastle.1.8.6.1.nupkg
,这似乎是可行的,而且我还验证了https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg是一个有效的URL:当您打开这个链接时,将下载一个nupkg文件。但是,由于一些未知的原因,下载不能工作吗?
已经尝试过
当我将BouncyCastle目录从packages
和global-packages
中删除,然后再次运行作业时,BouncyCastle by nuget install
的下载就会成功。
然后,当我第三次运行作业时,如果没有再次清除目录,它就会在相同的错误上再次失败。
在所有情况下,要使nuget install
命令成功完成,我需要做什么?
发布于 2020-09-23 11:57:25
我找不到根本原因,而且花了太多的时间,所以我采取了务实的方法。现在,我将始终在构建开始时删除BouncyCastle,如下所示:
sh 'rm --force --recursive ${dest}/global-packages/bouncycastle'
它很脏,我不以它为傲,但它很管用。
https://stackoverflow.com/questions/64024833
复制相似问题