This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-patch-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new e548ec6  Don't fail builds because default patch directories are not 
present
e548ec6 is described below

commit e548ec632931292c4fa8fda1890e48bf907bf8a1
Author: David Blevins <[email protected]>
AuthorDate: Fri Apr 30 16:38:07 2021 -0700

    Don't fail builds because default patch directories are not present
---
 .../java/org/apache/tomee/patch/plugin/PatchMojo.java   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git 
a/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java 
b/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
index 099b662..db3250b 100644
--- 
a/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
+++ 
b/tomee-patch-plugin/src/main/java/org/apache/tomee/patch/plugin/PatchMojo.java
@@ -240,9 +240,18 @@ public class PatchMojo extends AbstractMojo {
     }
 
     private void prepareResources() throws MojoExecutionException {
+        final File defaultPatchResources = new File(basedir, 
"src/patch/resources");
+
         Files.mkdir(patchResourceDirectory);
         for (final File patchResource : patchResources) {
             if (!patchResource.exists()) {
+
+                if 
(patchResource.getAbsolutePath().equals(defaultPatchResources.getAbsolutePath())){
+                    // If the default directory does not exist, the user 
likely did not explicitly
+                    // ask for it.  Just silently skip it.
+                    continue;
+                }
+
                 final String message = "Patch resource directory does not 
exist: " + patchResource.getAbsolutePath();
                 getLog().error(message);
                 throw new MojoExecutionException(message);
@@ -343,9 +352,17 @@ public class PatchMojo extends AbstractMojo {
             executable = tc.findTool(compilerId);
         }
 
+        final File defaultPatchSources = new File(basedir, "src/patch/java");
         Files.mkdir(patchSourceDirectory);
         for (final File patchSource : patchSources) {
             if (!patchSource.exists()) {
+
+                if 
(patchSource.getAbsolutePath().equals(defaultPatchSources.getAbsolutePath())){
+                    // If the default directory does not exist, the user 
likely did not explicitly
+                    // ask for it.  Just silently skip it.
+                    continue;
+                }
+
                 final String message = "Patch source directory does not exist: 
" + patchSource.getAbsolutePath();
                 getLog().error(message);
                 throw new MojoExecutionException(message);

Reply via email to