1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.basepom.mojo.propertyhelper;
16
17 import org.basepom.mojo.propertyhelper.fields.NumberField;
18
19 import java.io.IOException;
20 import java.util.List;
21
22 import com.google.common.flogger.FluentLogger;
23 import org.apache.maven.plugin.MojoExecutionException;
24 import org.apache.maven.plugins.annotations.Mojo;
25 import org.apache.maven.plugins.annotations.Parameter;
26
27
28
29
30 @Mojo(name = "inc", threadSafe = true)
31 public final class IncMojo
32 extends AbstractPropertyHelperMojo {
33 private static final FluentLogger LOG = FluentLogger.forEnclosingClass();
34
35
36
37
38
39 @Parameter(defaultValue = "true")
40 boolean persist = true;
41
42 @Override
43 protected void doExecute() throws IOException, MojoExecutionException {
44 LOG.atFine().log("Running IncrementNumbers");
45
46 createFieldDefinitions();
47 createFields();
48 createGroups();
49
50 final List<NumberField> numberFields = getNumbers();
51
52 if (numberFields != null) {
53 for (NumberField nf : numberFields) {
54 nf.increment();
55 }
56 }
57
58 if (persist) {
59 valueCache.persist();
60 }
61 }
62 }