diff --git a/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.java b/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.java index 2c346a96..5503d604 100644 --- a/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.java +++ b/src/main/java/org/codehaus/mojo/buildhelper/AbstractAddResourceMojo.java @@ -47,14 +47,6 @@ public abstract class AbstractAddResourceMojo extends AbstractMojo { @Parameter(readonly = true, defaultValue = "${project}") private MavenProject project; - /** - * If a resource directory does not exist, do not add it as a root. - * - * @since 3.4.1 - */ - @Parameter(property = "skipIfMissing", defaultValue = "false") - private boolean skipIfMissing; - /** * Main plugin execution */ @@ -75,7 +67,7 @@ public void execute() { resource.setDirectory(resourceDir.getAbsolutePath()); } - if (skipIfMissing && !resourceDir.exists()) { + if (isSkipIfMissing() && !resourceDir.exists()) { if (getLog().isDebugEnabled()) { getLog().debug("Skipping directory: " + resourceDir + ", because it does not exist."); } @@ -85,6 +77,8 @@ public void execute() { } } + protected abstract boolean isSkipIfMissing(); + protected abstract boolean isSkip(); /** diff --git a/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java b/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java index f4129233..33471484 100644 --- a/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java +++ b/src/main/java/org/codehaus/mojo/buildhelper/AddResourceMojo.java @@ -46,6 +46,14 @@ public class AddResourceMojo extends AbstractAddResourceMojo { @Parameter(property = "buildhelper.addresource.skip", defaultValue = "false") private boolean skipAddResource; + /** + * If a resource directory does not exist, do not add it as a root. + * + * @since 3.5.0 + */ + @Parameter(property = "buildhelper.addresource.skipIfMissing", defaultValue = "false") + private boolean skipIfMissing; + public void addResource(Resource resource) { getProject().addResource(resource); if (getLog().isDebugEnabled()) { @@ -53,6 +61,10 @@ public void addResource(Resource resource) { } } + protected boolean isSkipIfMissing() { + return skipIfMissing; + } + protected boolean isSkip() { return skipAddResource; } diff --git a/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java b/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java index f64081f7..fee48562 100644 --- a/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java +++ b/src/main/java/org/codehaus/mojo/buildhelper/AddSourceMojo.java @@ -57,9 +57,9 @@ public class AddSourceMojo extends AbstractMojo { /** * If a directory does not exist, do not add it as a source root. * - * @since 3.4.1 + * @since 3.5.0 */ - @Parameter(property = "skipIfMissing", defaultValue = "false") + @Parameter(property = "buildhelper.addsource.skipIfMissing", defaultValue = "false") private boolean skipIfMissing; /** diff --git a/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java b/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java index a1000caf..8e90b5ca 100644 --- a/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java +++ b/src/main/java/org/codehaus/mojo/buildhelper/AddTestResourceMojo.java @@ -46,6 +46,14 @@ public class AddTestResourceMojo extends AbstractAddResourceMojo { @Parameter(property = "buildhelper.addtestresource.skip", defaultValue = "false") private boolean skipAddTestResource; + /** + * If a test resource directory does not exist, do not add it as a root. + * + * @since 3.5.0 + */ + @Parameter(property = "buildhelper.addtestresource.skipIfMissing", defaultValue = "false") + private boolean skipIfMissing; + /** * Add the resource to the project. * @@ -62,4 +70,8 @@ public void addResource(Resource resource) { protected boolean isSkip() { return skipAddTestResource; } + + protected boolean isSkipIfMissing() { + return skipIfMissing; + } } diff --git a/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java b/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java index 8e18f987..0938841e 100644 --- a/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java +++ b/src/main/java/org/codehaus/mojo/buildhelper/AddTestSourceMojo.java @@ -58,9 +58,9 @@ public class AddTestSourceMojo extends AbstractMojo { /** * If a directory does not exist, do not add it as a test source root. * - * @since 3.4.1 + * @since 3.5.0 */ - @Parameter(property = "skipIfMissing", defaultValue = "false") + @Parameter(property = "buildhelper.addtestsource.skipIfMissing", defaultValue = "false") private boolean skipIfMissing; /**