diff --git a/src/main/java/com/soebes/maven/plugins/iterator/AbstractIteratorMojo.java b/src/main/java/com/soebes/maven/plugins/iterator/AbstractIteratorMojo.java index 544ba09..943580f 100644 --- a/src/main/java/com/soebes/maven/plugins/iterator/AbstractIteratorMojo.java +++ b/src/main/java/com/soebes/maven/plugins/iterator/AbstractIteratorMojo.java @@ -335,11 +335,15 @@ public void setFolder( File folder ) this.folder = folder; } + protected boolean atLeastOneItemFound()throws MojoExecutionException + { + return (getItemsConverted().size()>0); + } protected boolean isMoreThanOneSet() { // a ^ b ^ c && ! (a && b && c) boolean result = isItemsSet() ^ isContentSet() ^ isItemsWithPropertiesSet() ^ isFolderSet() - && !( isItemsSet() && isContentSet() && isItemsWithPropertiesSet() && isFolderSet() ); + && !( isItemsSet() && isContentSet() && isItemsWithPropertiesSet() && isFolderSet() ); return !result; } diff --git a/src/main/java/com/soebes/maven/plugins/iterator/IteratorMojo.java b/src/main/java/com/soebes/maven/plugins/iterator/IteratorMojo.java index e0897a5..961d674 100644 --- a/src/main/java/com/soebes/maven/plugins/iterator/IteratorMojo.java +++ b/src/main/java/com/soebes/maven/plugins/iterator/IteratorMojo.java @@ -218,11 +218,15 @@ public void execute() throw new MojoExecutionException( "You have to use at least one. " + "Either items element, " + "itemsWithProperties, content or folder element!" ); } - - if ( isMoreThanOneSet() ) + if(atLeastOneItemFound()) { - throw new MojoExecutionException( "You can use only one element. " - + "Either items, itemsWithProperties, content or folder element but not more than one of them." ); + if ( isMoreThanOneSet() ) + { + throw new MojoExecutionException( "You can use only one element. " + + "Either items, itemsWithProperties, content or folder element but not more than one of them." ); + } + }else{ + getLog().info( "The list of items to iterate on is empty. Nothing will be done..." ); } List exceptions = new ArrayList<>();