allegro / grunt-maven-plugin

Grunt + Maven integration done right
Other
213 stars 32 forks source link

Add options for grunt run #8

Closed zzzLobster closed 11 years ago

zzzLobster commented 11 years ago

Sometimes it's need to define additional options for grunt. Please, add this feature. May be something like this:


---
 src/main/java/pl/allegro/tdr/gruntmaven/ExecGruntMojo.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/main/java/pl/allegro/tdr/gruntmaven/ExecGruntMojo.java b/src/main/java/pl/allegro/tdr/gruntmaven/ExecGruntMojo.java
index a152afd..4b5e211 100644
--- a/src/main/java/pl/allegro/tdr/gruntmaven/ExecGruntMojo.java
+++ b/src/main/java/pl/allegro/tdr/gruntmaven/ExecGruntMojo.java
@@ -55,6 +55,12 @@ public class ExecGruntMojo extends AbstractExecutableMojo {
     @Parameter(property = "runGruntWithNode", defaultValue = "false")
     private boolean runGruntWithNode;

+    /**
+     * Additional options for grunt.
+     */
+    @Parameter(property = "gruntOptions")
+    private String[] gruntOptions;
+
     @Override
     protected String getExecutable() {
         if (runGruntWithNode) {
@@ -76,6 +82,12 @@ public class ExecGruntMojo extends AbstractExecutableMojo {
         if(target != null && !target.isEmpty()) {
             arguments.add(element(name("argument"), target));
         }
+        if(gruntOptions != null && gruntOptions.length > 0) {
+            for (String option : gruntOptions) {
+                getLog().info("additionalArgument: " + option);
+                arguments.add(element(name("argument"), option));
+            }
+        }

         return arguments.toArray(new Element[arguments.size()]);
     }
-- 
adamdubiel commented 11 years ago

Thanks for the report, I will take care of it. 1.0.3 will be released this week for sure.

adamdubiel commented 11 years ago

I just pushed 1.0.3 release to Maven Central, should be available in few hours.

zzzLobster commented 11 years ago

Thank you very much!