在 Hudson 中执行命令作为构建后操作
我是哈德逊的新人。 我想在 Hudson 中执行“sourcecodeanalyzer”命令作为构建后操作来生成 html 报告。请让我知道这是否可能,如果是,请让我知道执行该命令的 Hudson 配置步骤。
您在这方面的最早回复将会非常有帮助。
提前致谢。
I am new in Hudson.
I would like to execute a 'sourcecodeanalyzer' command in Hudson as Post-build Actions to generate an html report. Please let me know is this at all possible, if yes let me know the Hudson configuration steps to execute the command.
Your earliest response in this regard will be extremely helpful.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
是的,这几乎肯定是可能的。
您需要将 Hudson 项目配置为具有运行源代码分析器的构建后操作或构建步骤。
您没有在问题中准确说明哪个分析器 - 可能 Hudson 已经为其安装了一个插件,在这种情况下,它可能会列在项目底部的“后”下的“配置”页面上构建操作。
如果没有,接下来检查是否有可用于尚未安装的分析器的插件。从 Hudson 主页面中选择
管理 Hudson
,然后选择管理插件
,然后选择可用
选项卡。如果有可用的插件,那么使用它绝对是个好主意,因为它们通常与 Hudson 本身集成得很好。作为最后的手段,您必须配置构建步骤来运行分析器。配置项目,然后选择“添加构建步骤”。显示的下拉列表取决于您的环境(Windows 或 Linux),但应包含运行 shell 命令或批处理文件的功能。您可以在那里配置您的分析器。
(如果您正在构建 Windows Visual Studio 应用程序,我使用的更灵活的方法是使用 MSBuild 插件进行构建,并使用 MSBuild 脚本来构建应用程序,然后运行分析工具。这可以相当自动化一切:我的构建应用程序,构建验收测试数据库,运行验收测试并将结果 HTML 复制到从项目链接的页面。)
Yes, it is almost certainly possible.
You will need to configure the Hudson project to have either a post-build action or a build step that runs your source code analyzer.
You've not stated in your question precisely which analyzer - it may be that Hudson already has a plug-in installed for it, in which case it may be listed on the Config page for the project at the bottom under Post-build Actions.
If not, next check to see if there's a plug-in available for the analyzer that hasn't been installed. From the main Hudson page select
Manage Hudson
, thenManage Plugins
, and choose theAvailable
tab. If there is a plug-in available it's definitely a good idea to use it as they are generally very well integrated with Hudson itself.As a last resort you'll have to configure a build step to run the analyzer. Configure the project, then choose "Add build step". The drop-down that appears depends on your environment (Windows or Linux) but should include the ability to run a shell command or batch file. You can configure your analyzer there.
(If you're building Windows Visual Studio applications, a more flexible way that I've used is to use the MSBuild plug-in for builds, and have an MSBuild script that builds the application and then runs analysis tools. This can automate pretty much everything: mine builds the application, builds an acceptance test database, runs the acceptance tests and copies the result HTML to a page linked from the project.)
您可以使用“执行 Shell”构建步骤创建一个新作业。在文本框中输入您要运行的命令。然后您所要做的就是通过选择:
“在构建其他项目后构建”来
触发此作业,并从列表中选择触发作业。
希望这有帮助!
You could create a new job with a "Execute Shell" build step. Type in the command you wish to run in the text box. Then all you have to do is trigger this job by selecting:
"Build after other projects are built"
And select the trigger job from the list.
Hope this helps!
作为杰里米帖子的后续。如果您看不到添加构建后步骤的功能,您可能会使用 Maven 作业。在这种情况下,您需要 Hudson M2 Extra Steps 插件。这将为您提供构建前和构建后的步骤。
As a follow up to Jeremy's post. If you don't see the ability to add post build steps, you might work with maven jobs. In that case you need the Hudson M2 Extra Steps Plugin. This will give you pre and post build steps.
我使用“构建后任务”插件在构建后删除一些资源。您可以调用任何 shell 脚本或命令行。如果您愿意,您可以根据某些日志记录输出进行调用。
I use the 'Post build task' plugin to delete some resources after a build. You could call any shell script or command lines. If you want you could make the call depends on some logging output.
有一种最佳方法可以解决此问题:
there is one best way to solve this:
目前,我正在试验声纳插件。看起来很棒,请在此处查看详细信息
http://sonar.codehaus.org/a-new-hudson-plugin-for-a-closer-integration-with-sonar/
http://wiki.hudson-ci.org/display/HUDSON/Sonar+plugin
Currently , I am experiment with sonar plug in. It looks great check the details here
http://sonar.codehaus.org/a-new-hudson-plugin-for-a-closer-integration-with-sonar/
http://wiki.hudson-ci.org/display/HUDSON/Sonar+plugin