|
14 | 14 | import org.apache.maven.plugins.annotations.Parameter;
|
15 | 15 | import se.bjurr.gitchangelog.api.GitChangelogApi;
|
16 | 16 |
|
17 |
| -@Mojo(name = "git-changelog", defaultPhase = PROCESS_SOURCES) |
| 17 | +@Mojo(name = "git-changelog", defaultPhase = PROCESS_SOURCES, threadSafe = true) |
18 | 18 | public class GitChangelogMojo extends AbstractMojo {
|
19 | 19 | private static final String DEFAULT_FILE = "CHANGELOG.md";
|
20 | 20 |
|
@@ -131,142 +131,142 @@ public class GitChangelogMojo extends AbstractMojo {
|
131 | 131 |
|
132 | 132 | @Override
|
133 | 133 | public void execute() throws MojoExecutionException {
|
134 |
| - if (skip != null && skip == true) { |
135 |
| - getLog().info("Skipping changelog generation"); |
| 134 | + if (this.skip != null && this.skip == true) { |
| 135 | + this.getLog().info("Skipping changelog generation"); |
136 | 136 | return;
|
137 | 137 | }
|
138 | 138 | try {
|
139 | 139 | GitChangelogApi builder;
|
140 | 140 | builder = gitChangelogApiBuilder();
|
141 |
| - if (isSupplied(settingsFile)) { |
142 |
| - builder.withSettings(new File(settingsFile).toURI().toURL()); |
| 141 | + if (this.isSupplied(this.settingsFile)) { |
| 142 | + builder.withSettings(new File(this.settingsFile).toURI().toURL()); |
143 | 143 | }
|
144 | 144 |
|
145 |
| - if (isSupplied(extendedVariables)) { |
146 |
| - builder.withExtendedVariables(extendedVariables); |
| 145 | + if (this.isSupplied(this.extendedVariables)) { |
| 146 | + builder.withExtendedVariables(this.extendedVariables); |
147 | 147 | }
|
148 | 148 |
|
149 |
| - if (isSupplied(toRef)) { |
150 |
| - builder.withToRef(toRef); |
| 149 | + if (this.isSupplied(this.toRef)) { |
| 150 | + builder.withToRef(this.toRef); |
151 | 151 | }
|
152 | 152 |
|
153 |
| - if (isSupplied(templateFile)) { |
154 |
| - builder.withTemplatePath(templateFile); |
| 153 | + if (this.isSupplied(this.templateFile)) { |
| 154 | + builder.withTemplatePath(this.templateFile); |
155 | 155 | }
|
156 |
| - if (isSupplied(templateContent)) { |
157 |
| - builder.withTemplateContent(templateContent); |
| 156 | + if (this.isSupplied(this.templateContent)) { |
| 157 | + builder.withTemplateContent(this.templateContent); |
158 | 158 | }
|
159 |
| - if (isSupplied(fromCommit)) { |
160 |
| - builder.withFromCommit(fromCommit); |
| 159 | + if (this.isSupplied(this.fromCommit)) { |
| 160 | + builder.withFromCommit(this.fromCommit); |
161 | 161 | }
|
162 |
| - if (isSupplied(fromRef)) { |
163 |
| - builder.withFromRef(fromRef); |
| 162 | + if (this.isSupplied(this.fromRef)) { |
| 163 | + builder.withFromRef(this.fromRef); |
164 | 164 | }
|
165 |
| - if (isSupplied(toCommit)) { |
166 |
| - builder.withToCommit(toCommit); |
| 165 | + if (this.isSupplied(this.toCommit)) { |
| 166 | + builder.withToCommit(this.toCommit); |
167 | 167 | }
|
168 | 168 |
|
169 |
| - if (isSupplied(ignoreTagsIfNameMatches)) { |
170 |
| - builder.withIgnoreTagsIfNameMatches(ignoreTagsIfNameMatches); |
| 169 | + if (this.isSupplied(this.ignoreTagsIfNameMatches)) { |
| 170 | + builder.withIgnoreTagsIfNameMatches(this.ignoreTagsIfNameMatches); |
171 | 171 | }
|
172 |
| - if (isSupplied(readableTagName)) { |
173 |
| - builder.withReadableTagName(readableTagName); |
| 172 | + if (this.isSupplied(this.readableTagName)) { |
| 173 | + builder.withReadableTagName(this.readableTagName); |
174 | 174 | }
|
175 |
| - if (isSupplied(dateFormat)) { |
176 |
| - builder.withDateFormat(dateFormat); |
| 175 | + if (this.isSupplied(this.dateFormat)) { |
| 176 | + builder.withDateFormat(this.dateFormat); |
177 | 177 | }
|
178 |
| - if (isSupplied(timeZone)) { |
179 |
| - builder.withTimeZone(timeZone); |
| 178 | + if (this.isSupplied(this.timeZone)) { |
| 179 | + builder.withTimeZone(this.timeZone); |
180 | 180 | }
|
181 |
| - builder.withRemoveIssueFromMessageArgument(removeIssueFromMessage); |
182 |
| - if (isSupplied(ignoreCommitsIfMessageMatches)) { |
183 |
| - builder.withIgnoreCommitsWithMessage(ignoreCommitsIfMessageMatches); |
| 181 | + builder.withRemoveIssueFromMessageArgument(this.removeIssueFromMessage); |
| 182 | + if (this.isSupplied(this.ignoreCommitsIfMessageMatches)) { |
| 183 | + builder.withIgnoreCommitsWithMessage(this.ignoreCommitsIfMessageMatches); |
184 | 184 | }
|
185 |
| - if (ignoreCommitsOlderThan != null) { |
186 |
| - builder.withIgnoreCommitsOlderThan(ignoreCommitsOlderThan); |
| 185 | + if (this.ignoreCommitsOlderThan != null) { |
| 186 | + builder.withIgnoreCommitsOlderThan(this.ignoreCommitsOlderThan); |
187 | 187 | }
|
188 |
| - if (isSupplied(untaggedName)) { |
189 |
| - builder.withUntaggedName(untaggedName); |
| 188 | + if (this.isSupplied(this.untaggedName)) { |
| 189 | + builder.withUntaggedName(this.untaggedName); |
190 | 190 | }
|
191 |
| - if (isSupplied(noIssueName)) { |
192 |
| - builder.withNoIssueName(noIssueName); |
| 191 | + if (this.isSupplied(this.noIssueName)) { |
| 192 | + builder.withNoIssueName(this.noIssueName); |
193 | 193 | }
|
194 |
| - if (ignoreCommitsWithoutIssue != null) { |
195 |
| - builder.withIgnoreCommitsWithoutIssue(ignoreCommitsWithoutIssue); |
| 194 | + if (this.ignoreCommitsWithoutIssue != null) { |
| 195 | + builder.withIgnoreCommitsWithoutIssue(this.ignoreCommitsWithoutIssue); |
196 | 196 | }
|
197 |
| - for (final CustomIssue customIssue : customIssues) { |
| 197 | + for (final CustomIssue customIssue : this.customIssues) { |
198 | 198 | builder.withCustomIssue(
|
199 | 199 | customIssue.getName(),
|
200 | 200 | customIssue.getPattern(),
|
201 | 201 | customIssue.getLink(),
|
202 | 202 | customIssue.getTitle());
|
203 | 203 | }
|
204 |
| - if (isSupplied(gitHubApi)) { |
205 |
| - builder.withGitHubApi(gitHubApi); |
| 204 | + if (this.isSupplied(this.gitHubApi)) { |
| 205 | + builder.withGitHubApi(this.gitHubApi); |
206 | 206 | }
|
207 |
| - if (isSupplied(gitHubToken)) { |
208 |
| - builder.withGitHubToken(gitHubToken); |
| 207 | + if (this.isSupplied(this.gitHubToken)) { |
| 208 | + builder.withGitHubToken(this.gitHubToken); |
209 | 209 | }
|
210 |
| - if (isSupplied(gitHubIssuePattern)) { |
211 |
| - builder.withGitHubIssuePattern(gitHubIssuePattern); |
| 210 | + if (this.isSupplied(this.gitHubIssuePattern)) { |
| 211 | + builder.withGitHubIssuePattern(this.gitHubIssuePattern); |
212 | 212 | }
|
213 | 213 |
|
214 |
| - if (isSupplied(gitLabProjectName)) { |
215 |
| - builder.withGitLabProjectName(gitLabProjectName); |
| 214 | + if (this.isSupplied(this.gitLabProjectName)) { |
| 215 | + builder.withGitLabProjectName(this.gitLabProjectName); |
216 | 216 | }
|
217 |
| - if (isSupplied(gitLabServer)) { |
218 |
| - builder.withGitLabServer(gitLabServer); |
| 217 | + if (this.isSupplied(this.gitLabServer)) { |
| 218 | + builder.withGitLabServer(this.gitLabServer); |
219 | 219 | }
|
220 |
| - if (isSupplied(gitLabToken)) { |
221 |
| - builder.withGitLabToken(gitLabToken); |
| 220 | + if (this.isSupplied(this.gitLabToken)) { |
| 221 | + builder.withGitLabToken(this.gitLabToken); |
222 | 222 | }
|
223 | 223 |
|
224 |
| - if (isSupplied(jiraUsername)) { |
225 |
| - builder.withJiraUsername(jiraUsername); |
| 224 | + if (this.isSupplied(this.jiraUsername)) { |
| 225 | + builder.withJiraUsername(this.jiraUsername); |
226 | 226 | }
|
227 |
| - if (isSupplied(jiraPassword)) { |
228 |
| - builder.withJiraPassword(jiraPassword); |
| 227 | + if (this.isSupplied(this.jiraPassword)) { |
| 228 | + builder.withJiraPassword(this.jiraPassword); |
229 | 229 | }
|
230 |
| - if (isSupplied(jiraIssuePattern)) { |
231 |
| - builder.withJiraIssuePattern(jiraIssuePattern); |
| 230 | + if (this.isSupplied(this.jiraIssuePattern)) { |
| 231 | + builder.withJiraIssuePattern(this.jiraIssuePattern); |
232 | 232 | }
|
233 |
| - if (isSupplied(jiraServer)) { |
234 |
| - builder.withJiraServer(jiraServer); |
| 233 | + if (this.isSupplied(this.jiraServer)) { |
| 234 | + builder.withJiraServer(this.jiraServer); |
235 | 235 | }
|
236 | 236 |
|
237 |
| - if (isSupplied(pathFilter)) { |
238 |
| - builder.withPathFilter(pathFilter); |
| 237 | + if (this.isSupplied(this.pathFilter)) { |
| 238 | + builder.withPathFilter(this.pathFilter); |
239 | 239 | }
|
240 | 240 |
|
241 |
| - if (file == null && !isSupplied(mediaWikiUrl)) { |
242 |
| - getLog().info("No output set, using file " + DEFAULT_FILE); |
243 |
| - file = new File(DEFAULT_FILE); |
| 241 | + if (this.file == null && !this.isSupplied(this.mediaWikiUrl)) { |
| 242 | + this.getLog().info("No output set, using file " + DEFAULT_FILE); |
| 243 | + this.file = new File(DEFAULT_FILE); |
244 | 244 | }
|
245 | 245 |
|
246 |
| - if (file != null) { |
247 |
| - builder.toFile(file); |
248 |
| - getLog().info("#"); |
249 |
| - getLog().info("# Wrote: " + file); |
250 |
| - getLog().info("#"); |
| 246 | + if (this.file != null) { |
| 247 | + builder.toFile(this.file); |
| 248 | + this.getLog().info("#"); |
| 249 | + this.getLog().info("# Wrote: " + this.file); |
| 250 | + this.getLog().info("#"); |
251 | 251 | }
|
252 | 252 |
|
253 |
| - if (isSupplied(mediaWikiUrl)) { |
| 253 | + if (this.isSupplied(this.mediaWikiUrl)) { |
254 | 254 | builder //
|
255 | 255 | .toMediaWiki( //
|
256 |
| - mediaWikiUsername, // |
257 |
| - mediaWikiPassword, // |
258 |
| - mediaWikiUrl, // |
259 |
| - mediaWikiTitle); |
260 |
| - getLog().info("#"); |
261 |
| - getLog().info("# Created: " + mediaWikiUrl + "/index.php/" + mediaWikiTitle); |
262 |
| - getLog().info("#"); |
| 256 | + this.mediaWikiUsername, // |
| 257 | + this.mediaWikiPassword, // |
| 258 | + this.mediaWikiUrl, // |
| 259 | + this.mediaWikiTitle); |
| 260 | + this.getLog().info("#"); |
| 261 | + this.getLog().info("# Created: " + this.mediaWikiUrl + "/index.php/" + this.mediaWikiTitle); |
| 262 | + this.getLog().info("#"); |
263 | 263 | }
|
264 | 264 | } catch (final Exception e) {
|
265 |
| - getLog().error("GitChangelog", e); |
| 265 | + this.getLog().error("GitChangelog", e); |
266 | 266 | }
|
267 | 267 | }
|
268 | 268 |
|
269 |
| - private boolean isSupplied(String parameter) { |
| 269 | + private boolean isSupplied(final String parameter) { |
270 | 270 | return !isNullOrEmpty(parameter);
|
271 | 271 | }
|
272 | 272 |
|
|
0 commit comments