jenkins 如何使用我的 Maven 脚本进行清理?
我正在 Jenkins 中运行 Maven 构建,但我的构建失败了,因为 Jenkins 不够智能,无法在构建后进行清理 - 它只是尝试删除整个工作区,构建会立即失败。有没有办法让詹金斯不会因此而失败(或者甚至尝试这样做),而是让我的“mvn clean”脚本先运行?如果我能做到这一点,那么我就可以进行所需的专门清理。
I'm running a maven build in Jenkins and my builds are failing because Jenkins isn't smart enough to clean up after my build - it just tries to delete the entire workspace and the builds fails immediatly. Is there a way to NOT have jenkins fail because of this (or even try to do it), but instead let my "mvn clean" script run first? If I can do this then I can do the specialized cleanup that is required.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑您正在使用工作区清理插件。首先要做的是检查如果将其作为预构建步骤而不是构建后执行,会发生什么情况。
或者,构建中存在一个尝试清除工作区的自定义步骤。看看如果将其作为第一个构建步骤而不是最后一个调用它会发生什么。或者尝试使用上述插件。
如果这没有帮助,您可以采用以下其他常规清理策略:
BUILD_ID
键入),以便构建不会意外使用剩余文件来自以前的版本。总结一下:是的,您可以先运行脚本,只需确保它不会过早删除内容即可。还要检查您的作业配置,了解调用清理的位置,并将其设置为预构建步骤或将其删除。
I suspect that you are using Workspace Cleanup Plugin. First thing to do is to check what happens if you do it as a pre-build step, not post-build.
Alternatively there is a custom step in the build that tries to wipe out the workspace. See what happens if you invoke it as the first build step, not the last. Or try using the aforementioned plugin.
If it does not help, here are other general clenup strategies you may employ:
BUILD_ID
) so that builds do not accidentally use leftover files from previous builds.To summarize: Yes, you can run you script first, just make sure it does not delete things prematurely. Also examine your job configuration for where that cleanup of yours is called and set it up as a pre-build step or remove it.