Skip to content

Commit c729702

Browse files
Marcono1234slawekjaranowski
authored andcommitted
Fix mismatching Parameter initial field values
Field values should match `defaultValue` of `Parameter` annotation. Had to adjust the unit tests because they were apparently manually constructing the Mojos and therefore not using the `Parameter#defaultValue`. Also removes the parameters from `TestUnpackDependenciesMojo#dotestArtifactExceptions` because they were apparently unused since commit 809bfe1.
1 parent 620f8fb commit c729702

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractFromDependenciesMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public abstract class AbstractFromDependenciesMojo extends AbstractDependencyFil
104104
* @since 2.0-alpha-2
105105
*/
106106
@Parameter(property = "mdep.failOnMissingClassifierArtifact", defaultValue = "false")
107-
protected boolean failOnMissingClassifierArtifact = true;
107+
protected boolean failOnMissingClassifierArtifact;
108108

109109
/**
110110
* @return Returns the outputDirectory.

src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class CopyDependenciesMojo extends AbstractFromDependenciesMojo {
6464
* @since 2.0
6565
*/
6666
@Parameter(property = "mdep.copyPom", defaultValue = "false")
67-
protected boolean copyPom = true;
67+
protected boolean copyPom;
6868

6969
@Component
7070
private CopyUtil copyUtil;

src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ public void testArtifactResolutionException() throws MojoFailureException {
429429

430430
public void dotestArtifactExceptions() throws MojoFailureException {
431431
mojo.classifier = "jdk";
432+
mojo.failOnMissingClassifierArtifact = true;
432433
mojo.type = "java-sources";
433434

434435
try {

src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -491,16 +491,13 @@ public void dotestClassifierType(String testClassifier, String testType) throws
491491
}
492492
}
493493

494-
public void testArtifactNotFound() throws Exception {
495-
dotestArtifactExceptions(false, true);
494+
public void testArtifactResolutionException() throws MojoFailureException {
495+
dotestArtifactExceptions();
496496
}
497497

498-
public void testArtifactResolutionException() throws Exception {
499-
dotestArtifactExceptions(true, false);
500-
}
501-
502-
public void dotestArtifactExceptions(boolean are, boolean anfe) throws Exception {
498+
public void dotestArtifactExceptions() throws MojoFailureException {
503499
mojo.classifier = "jdk";
500+
mojo.failOnMissingClassifierArtifact = true;
504501
mojo.type = "java-sources";
505502

506503
try {

0 commit comments

Comments
 (0)