简体   繁体   English

如何在Jenkins中为Maven 3项目单独进行声纳工作

[英]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中创建两个不同的工作。

  • one job is to trigger automated build whenever there is svn checkin (you can configure it for every 2 hrs as you said) 一项工作是每当有svn签入时触发自动构建(您可以按照您所说的每2小时配置一次)

-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.

相关问题 声纳分析导致0个文件通过Jenkins在Maven项目上建立索引 - Sonar analysis causes 0 files indexed on a maven project through Jenkins 如何在使用sonar:sonar构建Maven项目中解决插件容器异常? - How to resolve Plugin Container Exception in building maven project with sonar:sonar? 如何在多模块 maven 项目中单独构建模块? - How to build a module separately in multimodular maven project? 为 maven 作业指定 JAVA_HOME java 8 和声纳扫描 Java 11 in jenkins - Specify JAVA_HOME for maven job with java 8 and sonar scan with Java 11 in jenkins Jenkins Sonar Scanner vs Maven声纳:声纳目标 - Jenkins Sonar Scanner vs Maven sonar:sonar goal 如何从Jenkins Maven2 / 3工作中删除过时的Maven工件? - How to remove outdated Maven artifacts from Jenkins Maven2/3 job? 无法通过具有Jenkins构建和Maven项目的Sonar分析中的ClassLoader警告访问“ XXX / XXX / XXX”类 - Class 'XXX/XXX/XXX ' is not accessible through the ClassLoader warning in Sonar analysis with Jenkins build and maven project 如何从声纳分析中排除一些maven项目 - How to exclude some maven project from sonar analysis 如何为Maven多项目添加声纳模块? - How can i add a module to a maven multi-project for sonar? 如何为Java项目创建詹金斯工作 - how to create a jenkins job for a java project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM