我想存档我程序的工件,但是当构建失败时他不保存工件。这是为什么?
因为我只想在作业失败的时候读取神器!
感谢您的回复!
--
总是当工作失败时,我没有得到神器。我在非常小的工作中测试它:
空批处理文件+神器一个文件, 结果:工作成功, 神器:成功
退出1个批处理文件+神器一个文件, 结果:作业失败, 神器:什么都没做
作业的config.xml文件:
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<customWorkspace>C:\test\</customWorkspace>
<builders>
<hudson.tasks.BatchFile>
<command>exit 1</command>
</hudson.tasks.BatchFile>
</builders>
<publishers>
<hudson.tasks.ArtifactArchiver>
<artifacts>tomcat\logs\tomcat.log</artifacts>
<latestOnly>false</latestOnly>
</hudson.tasks.ArtifactArchiver>
</publishers>
<buildWrappers/>
</project>
最佳答案
无论构建是否失败,工件都会被归档。确保以下几点:
- 您正在查看实际的上次构建工件,而不是“上次成功构建”工件。
- 生成工件(或将它们复制到您的工作区以供存档)的构建步骤实际运行 - 如果它应该在失败后运行,它很可能不会运行。在这种情况下,您需要根据您的具体情况采取解决方法。
关于tomcat - Jenkins 在构建失败时保存工件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10928928/