|
11 | 11 | import java.util.HashMap;
|
12 | 12 | import java.util.List;
|
13 | 13 | import java.util.Map;
|
14 |
| -import org.apache.maven.model.Model; |
15 | 14 | import org.apache.maven.plugin.AbstractMojo;
|
16 | 15 | import org.apache.maven.plugin.MojoExecutionException;
|
17 |
| -import org.apache.maven.plugins.annotations.Component; |
18 | 16 | import org.apache.maven.plugins.annotations.Mojo;
|
19 | 17 | import org.apache.maven.plugins.annotations.Parameter;
|
20 |
| -import org.apache.maven.project.MavenProject; |
21 | 18 | import se.bjurr.gitchangelog.api.GitChangelogApi;
|
22 |
| -import se.bjurr.gitchangelog.internal.semantic.SemanticVersion; |
23 | 19 |
|
24 | 20 | @Mojo(name = "git-changelog", defaultPhase = PROCESS_SOURCES, threadSafe = true)
|
25 | 21 | public class GitChangelogMojo extends AbstractMojo {
|
26 | 22 | private static final String DEFAULT_FILE = "CHANGELOG.md";
|
27 | 23 |
|
28 |
| - @Component private MavenProject project; |
29 |
| - |
30 | 24 | @Parameter(property = "toRef", required = false)
|
31 | 25 | private String toRef;
|
32 | 26 |
|
@@ -182,61 +176,8 @@ public class GitChangelogMojo extends AbstractMojo {
|
182 | 176 | @Parameter(property = "prependToFile", required = false)
|
183 | 177 | public Boolean prependToFile;
|
184 | 178 |
|
185 |
| - @Parameter( |
186 |
| - property = "updatePomWithNextSemanticVersion", |
187 |
| - required = false, |
188 |
| - defaultValue = "false") |
189 |
| - private boolean updatePomWithNextSemanticVersion; |
190 |
| - |
191 |
| - @Parameter( |
192 |
| - property = "updatePomWithNextSemanticVersionSuffixSnapshot", |
193 |
| - required = false, |
194 |
| - defaultValue = "true") |
195 |
| - private boolean updatePomWithNextSemanticVersionSuffixSnapshot; |
196 |
| - |
197 |
| - @Parameter(property = "semanticMajorVersionPattern", required = false) |
198 |
| - private String semanticMajorVersionPattern; |
199 |
| - |
200 |
| - @Parameter(property = "semanticMinorVersionPattern", required = false) |
201 |
| - private String semanticMinorVersionPattern; |
202 |
| - |
203 |
| - @Parameter(property = "semanticPatchVersionPattern", required = false) |
204 |
| - private String semanticPatchVersionPattern; |
205 |
| - |
206 | 179 | @Override
|
207 | 180 | public void execute() throws MojoExecutionException {
|
208 |
| - if (this.updatePomWithNextSemanticVersion) { |
209 |
| - try { |
210 |
| - final GitChangelogApi gitChangelogApiBuilder = gitChangelogApiBuilder(); |
211 |
| - if (this.isSupplied(this.semanticMajorVersionPattern)) { |
212 |
| - gitChangelogApiBuilder.withSemanticMajorVersionPattern(this.semanticMajorVersionPattern); |
213 |
| - } |
214 |
| - if (this.isSupplied(this.semanticMinorVersionPattern)) { |
215 |
| - gitChangelogApiBuilder.withSemanticMinorVersionPattern(this.semanticMinorVersionPattern); |
216 |
| - } |
217 |
| - if (this.isSupplied(this.semanticPatchVersionPattern)) { |
218 |
| - gitChangelogApiBuilder.withSemanticPatchVersionPattern(this.semanticPatchVersionPattern); |
219 |
| - } |
220 |
| - final SemanticVersion nextSemanticVersion = gitChangelogApiBuilder.getNextSemanticVersion(); |
221 |
| - final String nextVersion = |
222 |
| - this.updatePomWithNextSemanticVersionSuffixSnapshot |
223 |
| - ? nextSemanticVersion.getVersion() + "-SNAPSHOT" |
224 |
| - : nextSemanticVersion.getVersion(); |
225 |
| - |
226 |
| - final Model model = this.project.getModel(); |
227 |
| - final String versionOrig = model.getVersion(); |
228 |
| - final File pomFile = this.project.getFile(); |
229 |
| - this.getLog() |
230 |
| - .info("Setting version to " + nextVersion + " was (" + versionOrig + ") in " + pomFile); |
231 |
| - // Change version during build |
232 |
| - model.setVersion(nextVersion); |
233 |
| - |
234 |
| - // Change version in file |
235 |
| - new XmlModifier(pomFile).setVersion(nextVersion); |
236 |
| - } catch (final Exception e) { |
237 |
| - throw new MojoExecutionException(e.getMessage(), e); |
238 |
| - } |
239 |
| - } |
240 | 181 | if (this.skip != null && this.skip == true) {
|
241 | 182 | this.getLog().info("Skipping changelog generation");
|
242 | 183 | return;
|
|
0 commit comments