本文整理汇总了Java中hudson.model.BuildListener.error方法的典型用法代码示例。如果您正苦于以下问题:Java BuildListener.error方法的具体用法?Java BuildListener.error怎么用?Java BuildListener.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.BuildListener
的用法示例。
在下文中一共展示了BuildListener.error方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean perform(AbstractBuild build, Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {
if (build.getResult() != null && build.getResult() == Result.FAILURE) {
return false;
}
listener.getLogger().println("TestFairy Advanced Uploader (Android)... v " + Utils.getVersion(getClass()) + ", run on " + getHostName());
try {
EnvVars vars = build.getEnvironment(listener);
String changeLog = Utils.extractChangeLog(vars, build.getChangeSet(), listener.getLogger());
AndroidBuildEnvironment environment = getDescriptor().getEnvironment(launcher);
try {
launcher.getChannel().call(new AndroidRemoteRecorder(listener, this, vars, environment, changeLog));
} catch (Throwable ue) {
throw new TestFairyException(ue.getMessage(), ue);
}
return true;
} catch (TestFairyException e) {
listener.error(e.getMessage() + "\n");
e.printStackTrace(listener.getLogger());
return false;
}
}
示例2: perform
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean perform(AbstractBuild build, Launcher launcher, final BuildListener listener) throws IOException, InterruptedException {
if (build.getResult() != null && build.getResult() == Result.FAILURE) {
return false;
}
listener.getLogger().println("TestFairy iOS/Android Uploader... v " + Utils.getVersion(getClass()) + ", run on " + getHostName());
try {
EnvVars vars = build.getEnvironment(listener);
String changeLog = Utils.extractChangeLog(vars, build.getChangeSet(), listener.getLogger());
try {
launcher.getChannel().call(new IosRemoteRecorder(listener, this, vars, changeLog));
} catch (Throwable ue) {
throw new TestFairyException(ue.getMessage(), ue);
}
return true;
} catch (TestFairyException e) {
listener.error(e.getMessage() + "\n");
e.printStackTrace(listener.getLogger());
return false;
}
}
示例3: prebuild
import hudson.model.BuildListener; //导入方法依赖的package包/类
@Override
public boolean prebuild(AbstractBuild<?, ?> build, BuildListener listener) {
globalConfigDataForSonarInstance = buildDecision.chooseSonarInstance(jobExecutionService.getGlobalConfigData(), jobConfigData);
if (globalConfigDataForSonarInstance == null) {
listener.error(JobExecutionService.GLOBAL_CONFIG_NO_LONGER_EXISTS_ERROR, jobConfigData.getSonarInstanceName());
return false;
}
return true;
}
示例4: applyMacro
import hudson.model.BuildListener; //导入方法依赖的package包/类
/**
* Replace macro with environment variable if it exists
* @param build
* @param listener
* @param macro
* @return
* @throws InterruptedException
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static String applyMacro(AbstractBuild build, BuildListener listener, String macro)
throws InterruptedException{
try {
EnvVars envVars = new EnvVars(Computer.currentComputer().getEnvironment());
envVars.putAll(build.getEnvironment(listener));
envVars.putAll(build.getBuildVariables());
return Util.replaceMacro(macro, envVars);
} catch (IOException e) {
listener.getLogger().println("Failed to apply macro " + macro);
listener.error(ExceptionUtils.getStackTrace(e));
}
return macro;
}
示例5: setUpContext
import hudson.model.BuildListener; //导入方法依赖的package包/类
/**
* set up a context and add/exclude url to/from it
* @param listener the listener to display log during the job execution in jenkins
* @param URL the URL to be added to context
* @param excludedUrl the URL to exclude from context
* @param zapClientAPI the client API to use ZAP API methods
* @return the context ID of the context
* @throws ClientApiException
*/
private String setUpContext(BuildListener listener, String url, String excludedUrl,ClientApi zapClientAPI)
throws ClientApiException {
url=url.trim();
String contextName="context1";//name of the Context to be created
String contextURL="\\Q"+url+"\\E.*";//url to be added to the context (the same url given by the user to be scanned)
String contextIdTemp;
//Create new context
//method signature : newContext(String apikey,String contextname) throws ClientApiException
contextIdTemp=extractContextId(zapClientAPI.context.newContext(API_KEY,contextName));
//add url to the context
//method signature : includeInContext(String apikey, String contextname, String regex)
// throws ClientApiException
zapClientAPI.context.includeInContext(API_KEY,contextName,contextURL);
listener.getLogger().println("URL "+url+" added to Context ["+contextIdTemp+"]");
//excluded urls from context
if (!excludedUrl.equals("")) {
try {
String[] urls = excludedUrl.split("\n");
String contextExcludedUrl="";//url to exclude from context like the log out url
for (int i = 0; i < urls.length; i++) {
urls[i] = urls[i].trim();
if (!urls[i].isEmpty()) {
contextExcludedUrl="\\Q"+urls[i]+"\\E";
zapClientAPI.context.excludeFromContext(API_KEY, contextName, contextExcludedUrl);
listener.getLogger().println("URL exluded from context : "+urls[i]);
}
}
} catch (ClientApiException e) {
e.printStackTrace();
listener.error(ExceptionUtils.getStackTrace(e));
}
}
return contextIdTemp;
}