Skip to content

Commit 6599033

Browse files
authored
Merge pull request #474 from jjlharrison/fix-mvn-default-params
Fix default values for Maven configuration parameters
2 parents aac58cc + 070bcf3 commit 6599033

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

japicmp-maven-plugin/src/main/java/japicmp/maven/ConfigParameters.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class ConfigParameters {
4949
private List<String> ignoreMissingClassesByRegularExpressions;
5050

5151
@Parameter(defaultValue = "true")
52-
private boolean skipPomModules;
52+
private boolean skipPomModules = true;
5353

5454
@Parameter
5555
private String htmlStylesheet;
@@ -85,7 +85,7 @@ public class ConfigParameters {
8585
private boolean skipXmlReport;
8686

8787
@Parameter(defaultValue = "true")
88-
private boolean ignoreMissingOldVersion;
88+
private boolean ignoreMissingOldVersion = true;
8989

9090
@Parameter
9191
private boolean ignoreMissingNewVersion;
@@ -94,10 +94,10 @@ public class ConfigParameters {
9494
private String oldVersionPattern;
9595

9696
@Parameter(defaultValue = "false")
97-
private boolean includeSnapshots;
97+
private boolean includeSnapshots = false;
9898

9999
@Parameter(defaultValue = "true")
100-
private boolean breakBuildIfCausedByExclusion;
100+
private boolean breakBuildIfCausedByExclusion = true;
101101

102102
@Parameter
103103
private boolean reportOnlyFilename;
@@ -113,10 +113,10 @@ public class ConfigParameters {
113113

114114

115115
@Parameter(defaultValue = "false")
116-
private boolean includeExclusively;
116+
private boolean includeExclusively = false;
117117

118118
@Parameter(defaultValue = "false")
119-
private boolean excludeExclusively;
119+
private boolean excludeExclusively = false;
120120

121121
@Parameter
122122
private List<OverrideCompatibilityChangeParameter> overrideCompatibilityChangeParameters;

japicmp-maven-plugin/src/test/java/japicmp/maven/JApiCmpMojoTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package japicmp.maven;
22

3+
import static org.hamcrest.MatcherAssert.assertThat;
4+
import static org.hamcrest.core.Is.is;
35
import static org.junit.jupiter.api.Assertions.assertNotNull;
46
import static org.junit.jupiter.api.Assertions.assertThrows;
57

@@ -33,6 +35,21 @@ final class JApiCmpMojoTest extends AbstractTest {
3335
super();
3436
}
3537

38+
@Test
39+
@InjectMojo(goal = "cmp", pom = "target/test-run/default/pom.xml")
40+
void testDefaultParameterValues(final JApiCmpMojo testMojo) {
41+
assertNotNull(testMojo);
42+
assertNotNull(testMojo.parameter);
43+
44+
// Verify all default values are set correctly
45+
assertThat(testMojo.parameter.getSkipPomModules(), is(true));
46+
assertThat(testMojo.parameter.getIgnoreMissingOldVersion(), is(true));
47+
assertThat(testMojo.parameter.isIncludeSnapshots(), is(false));
48+
assertThat(testMojo.parameter.isBreakBuildIfCausedByExclusion(), is(true));
49+
assertThat(testMojo.parameter.isIncludeExclusively(), is(false));
50+
assertThat(testMojo.parameter.isExcludeExclusively(), is(false));
51+
}
52+
3653
@Test
3754
@InjectMojo(goal = "cmp", pom = "target/test-run/default/pom.xml")
3855
void testSkip(final JApiCmpMojo testMojo) throws Exception {

japicmp-maven-plugin/src/test/resources/data/configured/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<markdownTitle>New Markdown Title</markdownTitle>
4040
<reportLinkName>API Comparison Report</reportLinkName>
4141
<postAnalysisScript>groovy/SamplePostAnalysis.groovy</postAnalysisScript>
42+
<ignoreMissingOldVersion>false</ignoreMissingOldVersion>
4243
</parameter>
4344
</configuration>
4445
<executions>

0 commit comments

Comments
 (0)