在 ant 构建脚本中使用buildnumber计算新版本号时,ivy 将在计算下一个版本时挂起长达 20 分钟。随着构建数量的增加,它似乎呈指数级增长(我正在测试的项目大约有 600 个)。起初我以为可能是因为大文件和哈希检查,但后来我打开调试,看到了大约 1200 次:
[ivy:buildnumber] using ssh to list all in /Storage/ivy/status/base//module/version
[ivy:buildnumber] SShRepository:list called: /Storage/ivy/status/base//module/version
[ivy:buildnumber] found 12 urls
[ivy:buildnumber] 0 matched /Storage/ivy/status/base//module/version/[artifact]-version.jar
出于某种原因,它正在遍历每个目录以查找某个 jar 文件,当它找不到它要查找的内容时,它会转到第二个解析器并再次尝试。当然,它永远不会找到匹配项,因为任何目录中都没有 jar。
ivysettings 文件如下所示:
<ivysettings>
<property name="ivy.checksums" value="" />
<property name="tisivy.host" value="builds.example.com" />
<property name="tisivy.url.path" value="http://${tisivy.host}" />
<property name="tisivy.file.path" value="/Storage/ivy" />
<property name="tisivy.repo.pattern" value="[module]/[revision]" />
<property name="tisivy.artifact.pattern" value="${tisivy.repo.pattern}/[artifact]-[revision].[ext]" />
<settings defaultResolver="url-chain" />
<caches/>
<resolvers>
<chain name="url-chain" returnFirst="true">
<url name="http">
<ivy pattern="${tisivy.url.path}/status/${tisivy.repo.pattern}/ivy.xml" />
<artifact pattern="${tisivy.url.path}/status/${tisivy.artifact.pattern}" />
</url>
</chain>
<ssh name="ssh" user="example" userPassword="****************" host="${tisivy.host}" publishPermissions="0644">
<ivy pattern="${tisivy.file.path}/status/${tisivy.repo.pattern}/ivy.xml" />
<artifact pattern="${tisivy.file.path}/status/${tisivy.artifact.pattern}" />
</ssh>
</resolvers>
<triggers>
</triggers>
<statuses>
<status name="production" integration="false" />
<status name="integration" integration="true" />
<status name="status" integration="false" />
</statuses>
<modules>
</modules>
</ivysettings>
对内部版本号的调用如下所示:
<ivy:buildnumber organisation="org" module="${ivy.module.doubleslash}" revision="${version.base}" />
我似乎找不到其他人遇到这个问题,所以我确定我在某个地方犯了错误。