[英]How to do sonar job separately in jenkins for maven 3 project
I am configuring sonar plug-in in Jenkins to execute on Maven 3 projects. 我正在Jenkins中配置声纳插件,以在Maven 3项目上执行。
Currently my maven project is scheduled to build when a code change in svn and also for every 2hrs 目前,我的maven项目计划在svn中每2小时更改一次代码时进行构建
Now I want to run the sonar on the same project only once in the night time, this should not impact the regular builds. 现在,我只想在夜间在同一项目上运行一次声纳,这应该不会影响常规构建。
I installed Jenkins Sonar Plugin and could able to add the sonar in the 'Post Build Actions' of the project configuration, and the everything build fine. 我安装了Jenkins Sonar插件,并且能够在项目配置的“后期构建操作”中添加声纳,并且一切正常。 But in this case the sonar is running each time after the project build is done, I want to run the sonar only at the night time. 但是在这种情况下,在项目构建完成后每次都运行声纳,我只想在晚上运行声纳。
In my approach I did not included sonar maven plugin in pom file, since I want to use Jenkins sonar plugin 在我的方法中,我没有在Pom文件中包含声纳Maven插件,因为我想使用Jenkins声纳插件
Please let me know what changes I need to do from pom end and Jenkins end. 请让我知道从pom end和Jenkins end需要做些什么更改。
The cleanest solution is definitely to create a dedicated Jenkins Job to schedule those SonarQube analysis. 最干净的解决方案肯定是创建专门的Jenkins Job来安排这些SonarQube分析。 Some users are also using the trigger configuration "Skip if environment variable is defined and set to true" to reach such goal. 一些用户还使用触发器配置“如果定义了环境变量并将其设置为true,则跳过”以实现此目标。
you don't have to install sonar plugin in your pom file. 您无需在pom文件中安装声纳插件。 sonar plugin for jenkins does the job.all you have to do is for every project create two different jobs in jenkins . jenkins的声纳插件可以完成这项工作。您要做的就是为每个项目在jenkins中创建两个不同的工作。
-another job is to run sonar analysis for the project and you can configure it to run every midnight. -另一项工作是对该项目运行声纳分析,您可以将其配置为在每个午夜运行。 ( you can give like ' @midnight ') (你可以给像'@midnight')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.