View Javadoc

1   /**
2    * Copyright 2004-2011 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.mojo;
17  
18  import java.io.File;
19  import java.util.List;
20  
21  import org.apache.maven.artifact.Artifact;
22  import org.apache.maven.plugin.AbstractMojo;
23  import org.apache.maven.project.MavenProject;
24  
25  /**
26   * 
27   */
28  public abstract class BaseMojo extends AbstractMojo {
29  	public static final String FS = System.getProperty("file.separator");
30  	JenkinsHelper helper = new JenkinsHelper();
31  
32  	/**
33  	 * The Maven project object
34  	 * 
35  	 * @parameter expression="${project}"
36  	 * @readonly
37  	 */
38  	private MavenProject project;
39  
40  	/**
41  	 * The plugin dependencies.
42  	 * 
43  	 * @parameter expression="${plugin.artifacts}"
44  	 * @required
45  	 * @readonly
46  	 */
47  	private List<Artifact> pluginArtifacts;
48  
49  	/**
50  	 * The Jenkins instance to connect to.
51  	 * 
52  	 * @parameter expression="${jenkins.url}" default-value="${project.ciManagement.url}"
53  	 * @required
54  	 */
55  	private String url;
56  
57  	/**
58  	 * The format for timestamp displays
59  	 * 
60  	 * @parameter expression="${jenkins.timestampFormat}" default-value="yyyy-MM-dd HH:mm:ss z"
61  	 * @required
62  	 */
63  	private String timestampFormat;
64  
65  	/**
66  	 * The working directory for the plugin
67  	 * 
68  	 * @parameter expression="${jenkins.workingDir}" default-value="${project.build.directory}/jenkins"
69  	 * @required
70  	 */
71  	private File workingDir;
72  
73  	/**
74  	 * If set to true, the build will fail the first time it encounters an issue. When false, mojo's that issue multiple requests, will proceed through
75  	 * their list of requests and then fail at the end if an issue was encountered along the way.
76  	 * 
77  	 * @parameter expression="${jenkins.stopOnError}" default-value="false"
78  	 * @required
79  	 */
80  	private boolean stopOnError;
81  
82  	public MavenProject getProject() {
83  		return project;
84  	}
85  
86  	public List<Artifact> getPluginArtifacts() {
87  		return pluginArtifacts;
88  	}
89  
90  	public String getUrl() {
91  		return url;
92  	}
93  
94  	public void setUrl(String server) {
95  		this.url = server;
96  	}
97  
98  	public String getTimestampFormat() {
99  		return timestampFormat;
100 	}
101 
102 	public void setTimestampFormat(String timestampFormat) {
103 		this.timestampFormat = timestampFormat;
104 	}
105 
106 	public File getWorkingDir() {
107 		return workingDir;
108 	}
109 
110 	public void setWorkingDir(File workingDir) {
111 		this.workingDir = workingDir;
112 	}
113 
114 	public boolean isStopOnError() {
115 		return stopOnError;
116 	}
117 
118 	public void setStopOnError(boolean stopOnError) {
119 		this.stopOnError = stopOnError;
120 	}
121 
122 }