本文介绍了使用BuildBreaker插件时如何禁止执行职位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为公司开发了一个插件.现在已经完成了主要工作,并且插件本身也可以正常工作.

I developed a plugin for my company. The main work is done and the plugin itself works also fine for now.

我所拥有的只是一种美学问题".

All i have is kind of "aesthetics problems".

当构建作业完成而没有失败时,控制台输出会告诉我以下内容:(仅用于协议:我正在使用Jenkins执行构建作业)

When a build job is finished without failure the console output tells me the following thing:(just for the protocol: I'm using Jenkins to execute build jobs)

[...]
[INFO] [16:12:08.270] <- Clean snapshot 574387
[INFO] [16:12:08.723] Executing post-job class org.sonar.plugins.projectkeychecker.ProjectKeyCheckerSensor
[INFO]     ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

您知道我如何抑制最后的信息输出吗?它带有BuildBreaker插件.我在这里什么也没做,所以我不想在输出中显示此消息.

Do you know how i can suppress that last info output?It comes up with the BuildBreaker Plugin. I don't do anything here so I don't want to show this message in my output.

(有关更多上下文,请浏览)

(for more context please browse stackoverflow link)

再次感谢您:)

推荐答案

正如我已经提到的:BuildBreaker插件附带了它.

As i already mentioned: It comes up with the BuildBreaker Plugin.

当我告诉班级扩展BuildBreaker

When i told my class to extend BuildBreaker

public class MySensor extends BuildBreaker implements Sensor {

我必须实现方法executeOn

i had to implement the method executeOn

@Override
public void executeOn(Project arg0, SensorContext arg1) { }

并且方法executeOn被激活为PostJop ...所以我需要删除此方法以避免出现问题.

and the method executeOn is activated as a PostJop... So i need to delete this method to avoid my problem.

解决方案:

1)不再扩展BuildBreaker->不再实现executeOn方法

1) Do not extend BuildBreaker anymore -> don't implement the method executeOn anymore

2.)而不是使用BuildBreaker附带的方法"fail(String message)"(失败(字符串消息)),直接使用命令"throw new SonarException(String message);"(您将需要导入org.sonar.api .utils.SonarException)

2.) Instead of using the Method "fail (String message)", which came also up with BuildBreaker use directly the command "throw new SonarException(String message);"(you will need to import org.sonar.api.utils.SonarException as well)

感谢阅读本文的所有人.

Thanks everyone, who read this.

这篇关于使用BuildBreaker插件时如何禁止执行职位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 11:50