问题
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".
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
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)
Thank you again :)
回答1:
As i already mentioned: It comes up with the BuildBreaker Plugin.
When i told my class to extend BuildBreaker
public class MySensor extends BuildBreaker implements Sensor {
i had to implement the method executeOn
@Override
public void executeOn(Project arg0, SensorContext arg1) { }
and the method executeOn is activated as a PostJop... So i need to delete this method to avoid my problem.
SOLUTION:
1) Do not extend BuildBreaker anymore -> don't implement the method executeOn anymore
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.
来源:https://stackoverflow.com/questions/22807351/how-to-suppress-execution-of-post-jobs-when-using-buildbreaker-plugin