1 /** 2 * Copyright 2011-2012 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.maven.plugins.jenkins; 17 18 import java.util.Map; 19 20 /** 21 * Connect to a Jenkins server and kick off a job 22 * 23 * @goal runjob 24 * @threadSafe 25 * @requiresDependencyResolution test 26 */ 27 public class RunJobMojo extends SimpleJobMojo { 28 29 /** 30 * The Jenkins CLI command for running a job 31 * 32 * @parameter expression="${jenkins.cmd}" default-value="build" 33 * @required 34 */ 35 private String cmd; 36 37 /** 38 * If true, wait for the job to complete before continuing. 39 * 40 * @parameter expression="${jenkins.wait}" default-value="false" 41 * @required 42 */ 43 private boolean wait; 44 45 /** 46 * If true, check for changes before running the job. If nothing has changed, do not run the job. 47 * 48 * @parameter expression="${jenkins.skipIfNoChanges}" default-value="false" 49 * @required 50 */ 51 private boolean skipIfNoChanges; 52 53 /** 54 * Comma delimited list of key=value pairs to pass to the Jenkins job as build parameters 55 * 56 * @parameter expression="${jenkins.params}" 57 */ 58 private String params; 59 60 /** 61 * key=value pairs to pass to the Jenkins job as build parameters 62 * 63 * @parameter 64 */ 65 private Map<String, String> paramMap; 66 67 @Override 68 protected void executeMojo() { 69 helper.execute(this); 70 } 71 72 public boolean isWait() { 73 return wait; 74 } 75 76 public void setWait(boolean wait) { 77 this.wait = wait; 78 } 79 80 public boolean isSkipIfNoChanges() { 81 return skipIfNoChanges; 82 } 83 84 public void setSkipIfNoChanges(boolean skipIfNoChanges) { 85 this.skipIfNoChanges = skipIfNoChanges; 86 } 87 88 public Map<String, String> getParamMap() { 89 return paramMap; 90 } 91 92 public void setParamMap(Map<String, String> paramMap) { 93 this.paramMap = paramMap; 94 } 95 96 public String getParams() { 97 return params; 98 } 99 100 public void setParams(String params) { 101 this.params = params; 102 } 103 104 @Override 105 public String getCmd() { 106 return cmd; 107 } 108 109 public void setCmd(String cmd) { 110 this.cmd = cmd; 111 } 112 113 }