You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by pa...@apache.org on 2015/05/19 07:10:56 UTC

[1/5] incubator-groovy git commit: Converted code using OptionBuilder, deprecated in commons-cli 1.3, to use Option.builder. Removed the synchronized modifier from buildOptions(): it is no more needed with the new commons-cli 1.3 api.

Repository: incubator-groovy
Updated Branches:
  refs/heads/master 149534c3d -> 5d36cef26


Converted code using OptionBuilder, deprecated in commons-cli 1.3, to use Option.builder. Removed the synchronized modifier from buildOptions(): it is no more needed with the new commons-cli 1.3 api.


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/df676e69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/df676e69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/df676e69

Branch: refs/heads/master
Commit: df676e69ec8f60796bc1ff887b0edd60e45d56ad
Parents: 149534c
Author: Jacopo Cappellato <ja...@gmail.com>
Authored: Fri May 8 06:50:29 2015 +0200
Committer: Paul King <pa...@asert.com.au>
Committed: Tue May 19 14:44:24 2015 +1000

----------------------------------------------------------------------
 src/main/groovy/ui/GroovyMain.java | 129 +++++++++++++++-----------------
 1 file changed, 62 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/df676e69/src/main/groovy/ui/GroovyMain.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/ui/GroovyMain.java b/src/main/groovy/ui/GroovyMain.java
index ca2d783..3ac93bc 100644
--- a/src/main/groovy/ui/GroovyMain.java
+++ b/src/main/groovy/ui/GroovyMain.java
@@ -29,7 +29,7 @@ import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.GroovyInternalPosixParser;
 import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.codehaus.groovy.control.CompilationFailedException;
@@ -170,95 +170,90 @@ public class GroovyMain {
     }
 
     /**
-     * Build the options parser.  Has to be synchronized because of the way Options are constructed.
+     * Build the options parser.
      *
      * @return an options parser.
      */
     @SuppressWarnings("static-access")
-    private static synchronized Options buildOptions() {
+    private static Options buildOptions() {
         Options options = new Options();
-        options.addOption(OptionBuilder.hasArg().withArgName("path").withDescription("Specify where to find the class files - must be first argument").create("classpath"));
-        options.addOption(OptionBuilder.withLongOpt("classpath").hasArg().withArgName("path").withDescription("Aliases for '-classpath'").create("cp"));
+        options.addOption(Option.builder("classpath").hasArg().argName("path").desc("Specify where to find the class files - must be first argument").build());
+        options.addOption(Option.builder("cp").longOpt("classpath").hasArg().argName("path").desc("Aliases for '-classpath'").build());
 
+        options.addOption(Option.builder("D").longOpt("define").desc("define a system property").hasArg().argName("name=value").build());
         options.addOption(
-            OptionBuilder.withLongOpt("define").
-            withDescription("define a system property").
-            hasArg(true).
-            withArgName("name=value").
-            create('D'));
-        options.addOption(
-            OptionBuilder.withLongOpt("disableopt").
-            withDescription("disables one or all optimization elements. " +
-                            "optlist can be a comma separated list with the elements: " +
-                            "all (disables all optimizations), " +
-                            "int (disable any int based optimizations)").
-            hasArg(true).
-            withArgName("optlist").
-            create());
+            Option.builder().longOpt("disableopt")
+            .desc("disables one or all optimization elements. " +
+                  "optlist can be a comma separated list with the elements: " +
+                  "all (disables all optimizations), " +
+                  "int (disable any int based optimizations)")
+            .hasArg()
+            .argName("optlist")
+            .build());
+
         options.addOption(
-            OptionBuilder.hasArg(false)
-            .withDescription("usage information")
-            .withLongOpt("help")
-            .create('h'));
+            Option.builder("h").hasArg(false)
+            .desc("usage information")
+            .longOpt("help")
+            .build());
         options.addOption(
-            OptionBuilder.hasArg(false)
-            .withDescription("debug mode will print out full stack traces")
-            .withLongOpt("debug")
-            .create('d'));
+            Option.builder("d").hasArg(false)
+            .desc("debug mode will print out full stack traces")
+            .longOpt("debug")
+            .build());
         options.addOption(
-            OptionBuilder.hasArg(false)
-            .withDescription("display the Groovy and JVM versions")
-            .withLongOpt("version")
-            .create('v'));
+            Option.builder("v").hasArg(false)
+            .desc("display the Groovy and JVM versions")
+            .longOpt("version")
+            .build());
         options.addOption(
-            OptionBuilder.withArgName("charset")
+            Option.builder("c").argName("charset")
             .hasArg()
-            .withDescription("specify the encoding of the files")
-            .withLongOpt("encoding")
-            .create('c'));
+            .desc("specify the encoding of the files")
+            .longOpt("encoding")
+            .build());
         options.addOption(
-            OptionBuilder.withArgName("script")
+            Option.builder("e").argName("script")
             .hasArg()
-            .withDescription("specify a command line script")
-            .create('e'));
+            .desc("specify a command line script")
+            .build());
         options.addOption(
-            OptionBuilder.withArgName("extension")
-            .hasOptionalArg()
-            .withDescription("modify files in place; create backup if extension is given (e.g. \'.bak\')")
-            .create('i'));
+            Option.builder("i").argName("extension")
+            .optionalArg(true)
+            .desc("modify files in place; create backup if extension is given (e.g. \'.bak\')")
+            .build());
         options.addOption(
-            OptionBuilder.hasArg(false)
-            .withDescription("process files line by line using implicit 'line' variable")
-            .create('n'));
+            Option.builder("n").hasArg(false)
+            .desc("process files line by line using implicit 'line' variable")
+            .build());
         options.addOption(
-            OptionBuilder.hasArg(false)
-            .withDescription("process files line by line and print result (see also -n)")
-            .create('p'));
+            Option.builder("p").hasArg(false)
+            .desc("process files line by line and print result (see also -n)")
+            .build());
         options.addOption(
-            OptionBuilder.withArgName("port")
-            .hasOptionalArg()
-            .withDescription("listen on a port and process inbound lines (default: 1960)")
-            .create('l'));
+            Option.builder("l").argName("port")
+            .optionalArg(true)
+            .desc("listen on a port and process inbound lines (default: 1960)")
+            .build());
         options.addOption(
-            OptionBuilder.withArgName("splitPattern")
-            .hasOptionalArg()
-            .withDescription("split lines using splitPattern (default '\\s') using implicit 'split' variable")
-            .withLongOpt("autosplit")
-            .create('a'));
+            Option.builder("a").argName("splitPattern")
+            .optionalArg(true)
+            .desc("split lines using splitPattern (default '\\s') using implicit 'split' variable")
+            .longOpt("autosplit")
+            .build());
         options.addOption(
-            OptionBuilder.withLongOpt("indy")
-            .withDescription("enables compilation using invokedynamic")
-            .create());
+            Option.builder().longOpt("indy")
+            .desc("enables compilation using invokedynamic")
+            .build());
         options.addOption(
-            OptionBuilder.withLongOpt("configscript")
-            .hasArg().withDescription("A script for tweaking the configuration options")
-            .create());
+            Option.builder().longOpt("configscript")
+            .hasArg().desc("A script for tweaking the configuration options")
+            .build());
         options.addOption(
-                OptionBuilder.withLongOpt("basescript")
-                .hasArg().withArgName("class").withDescription("Base class name for scripts (must derive from Script)")
-                .create('b'));
+            Option.builder("b").longOpt("basescript")
+            .hasArg().argName("class").desc("Base class name for scripts (must derive from Script)")
+            .build());
         return options;
-
     }
 
     private static void setSystemPropertyFrom(final String nameValue) {


[3/5] incubator-groovy git commit: Converted FileSystemCompiler to the new commons-cli 1.3 api: replaced OptionBuilder, deprecated in 1.3, with Option.builder

Posted by pa...@apache.org.
Converted FileSystemCompiler to the new commons-cli 1.3 api: replaced OptionBuilder, deprecated in 1.3, with Option.builder


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/e78b2922
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/e78b2922
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/e78b2922

Branch: refs/heads/master
Commit: e78b292246d75455a5ebeb97ba39cd1d0f5dff7e
Parents: fac9d94
Author: Jacopo Cappellato <ja...@gmail.com>
Authored: Fri May 8 07:04:35 2015 +0200
Committer: Paul King <pa...@asert.com.au>
Committed: Tue May 19 14:44:33 2015 +1000

----------------------------------------------------------------------
 .../groovy/tools/FileSystemCompiler.java        | 44 ++++++++++----------
 1 file changed, 22 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/e78b2922/src/main/org/codehaus/groovy/tools/FileSystemCompiler.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/tools/FileSystemCompiler.java b/src/main/org/codehaus/groovy/tools/FileSystemCompiler.java
index 25d30ef..8e0a432 100644
--- a/src/main/org/codehaus/groovy/tools/FileSystemCompiler.java
+++ b/src/main/org/codehaus/groovy/tools/FileSystemCompiler.java
@@ -316,33 +316,33 @@ public class FileSystemCompiler {
 
         Options options = new Options();
 
-        options.addOption(OptionBuilder.hasArg().withArgName("path").withDescription("Specify where to find the class files - must be first argument").create("classpath"));
-        options.addOption(OptionBuilder.withLongOpt("classpath").hasArg().withArgName("path").withDescription("Aliases for '-classpath'").create("cp"));
-        options.addOption(OptionBuilder.withLongOpt("sourcepath").hasArg().withArgName("path").withDescription("Specify where to find the source files").create());
-        options.addOption(OptionBuilder.withLongOpt("temp").hasArg().withArgName("temp").withDescription("Specify temporary directory").create());
-        options.addOption(OptionBuilder.withLongOpt("encoding").hasArg().withArgName("encoding").withDescription("Specify the encoding of the user class files").create());
-        options.addOption(OptionBuilder.hasArg().withDescription("Specify where to place generated class files").create('d'));
-//            options.addOption(OptionBuilder.withLongOpt("strict").withDescription("Turn on strict type safety.").create('s'));
-        options.addOption(OptionBuilder.withLongOpt("help").withDescription("Print a synopsis of standard options").create('h'));
-        options.addOption(OptionBuilder.withLongOpt("version").withDescription("Print the version").create('v'));
-        options.addOption(OptionBuilder.withLongOpt("exception").withDescription("Print stack trace on error").create('e'));
-        options.addOption(OptionBuilder.withLongOpt("jointCompilation").withDescription("Attach javac compiler to compile .java files").create('j'));
-        options.addOption(OptionBuilder.withLongOpt("basescript").hasArg().withArgName("class").withDescription("Base class name for scripts (must derive from Script)").create('b'));
+        options.addOption(Option.builder("classpath").hasArg().argName("path").desc("Specify where to find the class files - must be first argument").build());
+        options.addOption(Option.builder("cp").longOpt("classpath").hasArg().argName("path").desc("Aliases for '-classpath'").build());
+        options.addOption(Option.builder().longOpt("sourcepath").hasArg().argName("path").desc("Specify where to find the source files").build());
+        options.addOption(Option.builder().longOpt("temp").hasArg().argName("temp").desc("Specify temporary directory").build());
+        options.addOption(Option.builder().longOpt("encoding").hasArg().argName("encoding").desc("Specify the encoding of the user class files").build());
+        options.addOption(Option.builder("d").hasArg().desc("Specify where to place generated class files").build());
+//            options.addOption(Option.builder("s").longOpt("strict").desc("Turn on strict type safety.").build());
+        options.addOption(Option.builder("h").longOpt("help").desc("Print a synopsis of standard options").build());
+        options.addOption(Option.builder("v").longOpt("version").desc("Print the version").build());
+        options.addOption(Option.builder("e").longOpt("exception").desc("Print stack trace on error").build());
+        options.addOption(Option.builder("j").longOpt("jointCompilation").desc("Attach javac compiler to compile .java files").build());
+        options.addOption(Option.builder("b").longOpt("basescript").hasArg().argName("class").desc("Base class name for scripts (must derive from Script)").build());
 
         options.addOption(
-                OptionBuilder.withArgName("property=value")
-                        .withValueSeparator()
-                        .hasArgs(2)
-                        .withDescription("name-value pairs to pass to javac")
-                        .create("J"));
+                Option.builder("J").argName("property=value")
+                        .valueSeparator()
+                        .numberOfArgs(2)
+                        .desc("name-value pairs to pass to javac")
+                        .build());
         options.addOption(
-                OptionBuilder.withArgName("flag")
+                Option.builder("F").argName("flag")
                         .hasArg()
-                        .withDescription("passed to javac for joint compilation")
-                        .create("F"));
+                        .desc("passed to javac for joint compilation")
+                        .build());
 
-        options.addOption(OptionBuilder.withLongOpt("indy").withDescription("enables compilation using invokedynamic").create());
-        options.addOption(OptionBuilder.withLongOpt("configscript").hasArg().withDescription("A script for tweaking the configuration options").create());
+        options.addOption(Option.builder().longOpt("indy").desc("enables compilation using invokedynamic").build());
+        options.addOption(Option.builder().longOpt("configscript").hasArg().desc("A script for tweaking the configuration options").build());
         return options;
     }
 


[5/5] incubator-groovy git commit: GROOVY-7429: CLONE - upgrade Apache Commons CLI to version 1.3 - migrate OptionBuilder to Option.builder() (Closes #11)

Posted by pa...@apache.org.
GROOVY-7429: CLONE - upgrade Apache Commons CLI to version 1.3 - migrate OptionBuilder to Option.builder() (Closes #11)


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/5d36cef2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/5d36cef2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/5d36cef2

Branch: refs/heads/master
Commit: 5d36cef26ad989f9f43450fae8aacda6fc541900
Parents: 753afb2
Author: Paul King <pa...@asert.com.au>
Authored: Tue May 19 15:10:40 2015 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Tue May 19 15:10:40 2015 +1000

----------------------------------------------------------------------
 src/main/groovy/ui/GroovyMain.java | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/5d36cef2/src/main/groovy/ui/GroovyMain.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/ui/GroovyMain.java b/src/main/groovy/ui/GroovyMain.java
index 3ac93bc..294d91d 100644
--- a/src/main/groovy/ui/GroovyMain.java
+++ b/src/main/groovy/ui/GroovyMain.java
@@ -57,7 +57,6 @@ import java.util.regex.Pattern;
  * @author Jeremy Rayner
  * @author Yuri Schimke
  * @author Roshan Dawrani
- * @version $Revision$
  */
 public class GroovyMain {
 
@@ -174,7 +173,6 @@ public class GroovyMain {
      *
      * @return an options parser.
      */
-    @SuppressWarnings("static-access")
     private static Options buildOptions() {
         Options options = new Options();
         options.addOption(Option.builder("classpath").hasArg().argName("path").desc("Specify where to find the class files - must be first argument").build());


[2/5] incubator-groovy git commit: Converted CliBuilder to the new commons-cli 1.3 api: replaced OptionBuilder, deprecated in 1.3, with Option.builder

Posted by pa...@apache.org.
Converted CliBuilder to the new commons-cli 1.3 api: replaced OptionBuilder, deprecated in 1.3, with Option.builder


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/fac9d943
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/fac9d943
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/fac9d943

Branch: refs/heads/master
Commit: fac9d943e59980950d8d6b5ee7fdb8c22746da2d
Parents: df676e6
Author: Jacopo Cappellato <ja...@gmail.com>
Authored: Fri May 8 06:59:26 2015 +0200
Committer: Paul King <pa...@asert.com.au>
Committed: Tue May 19 14:44:28 2015 +1000

----------------------------------------------------------------------
 src/main/groovy/util/CliBuilder.groovy     | 6 +++---
 src/test/groovy/util/CliBuilderTest.groovy | 5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/fac9d943/src/main/groovy/util/CliBuilder.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/util/CliBuilder.groovy b/src/main/groovy/util/CliBuilder.groovy
index ef4d4a9..dd71606 100644
--- a/src/main/groovy/util/CliBuilder.groovy
+++ b/src/main/groovy/util/CliBuilder.groovy
@@ -124,8 +124,8 @@ import org.codehaus.groovy.runtime.InvokerHelper
  * import org.apache.commons.cli.*
  * ... as before ...
  * cli << new Option('q', false, 'If used as the first parameter disables .curlrc')
- * cli << OptionBuilder.withLongOpt('url').hasArg().withArgName('URL').
- *                      withDescription('Set URL to work with').create()
+ * cli << Option.builder().longOpt('url').hasArg().argName('URL').
+ *                      desc('Set URL to work with').build()
  * ...
  * </pre>
  *
@@ -286,7 +286,7 @@ class CliBuilder {
     Option option(shortname, Map details, info) {
         Option option
         if (shortname == '_') {
-            option = OptionBuilder.withDescription(info).withLongOpt(details.longOpt).create()
+            option = Option.builder().desc(info).longOpt(details.longOpt).build()
             details.remove('longOpt')
         } else {
             option = new Option(shortname, info)

http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/fac9d943/src/test/groovy/util/CliBuilderTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/util/CliBuilderTest.groovy b/src/test/groovy/util/CliBuilderTest.groovy
index 80ae944..d1760e1 100644
--- a/src/test/groovy/util/CliBuilderTest.groovy
+++ b/src/test/groovy/util/CliBuilderTest.groovy
@@ -21,7 +21,6 @@ package groovy.util
 import org.codehaus.groovy.cli.GroovyPosixParser
 import org.apache.commons.cli.GnuParser
 import org.apache.commons.cli.Option
-import org.apache.commons.cli.OptionBuilder
 import org.apache.commons.cli.PosixParser
 import org.apache.commons.cli.BasicParser
 
@@ -188,7 +187,7 @@ usage: groovy
     }
 
     private void checkLongOptsOnly_nonOptionShouldStopArgProcessing(CliBuilder cli) {
-        def anOption = OptionBuilder.withLongOpt('anOption').hasArg().withDescription('An option.').create()
+        def anOption = Option.builder().longOpt('anOption').hasArg().desc('An option.').build()
         cli.options.addOption(anOption)
         def options = cli.parse(['-v', '--anOption', 'something'])
         // no options should be found
@@ -216,7 +215,7 @@ usage: groovy
 
     private void checkLongAndShortOpts_allOptionsValid(parser) {
         def cli = new CliBuilder(parser: parser)
-        def anOption = OptionBuilder.withLongOpt('anOption').hasArg().withDescription('An option.').create()
+        def anOption = Option.builder().longOpt('anOption').hasArg().desc('An option.').build()
         cli.options.addOption(anOption)
         cli.v(longOpt: 'verbose', 'verbose mode')
         def options = cli.parse(['-v', '--anOption', 'something'])


[4/5] incubator-groovy git commit: Converted GrapeMain to the new commons-cli 1.3 api: replaced OptionBuilder, deprecated in 1.3, with Option.builder

Posted by pa...@apache.org.
Converted GrapeMain to the new commons-cli 1.3 api: replaced OptionBuilder, deprecated in 1.3, with Option.builder


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/753afb20
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/753afb20
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/753afb20

Branch: refs/heads/master
Commit: 753afb20ae9149bb80326c644162a38453cc4897
Parents: e78b292
Author: Jacopo Cappellato <ja...@gmail.com>
Authored: Fri May 8 07:51:03 2015 +0200
Committer: Paul King <pa...@asert.com.au>
Committed: Tue May 19 15:02:58 2015 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/tools/GrapeMain.groovy  | 91 ++++----------------
 1 file changed, 15 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/753afb20/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/tools/GrapeMain.groovy b/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
index 2aec87b..0620c6c 100644
--- a/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
+++ b/src/main/org/codehaus/groovy/tools/GrapeMain.groovy
@@ -116,26 +116,10 @@ import org.apache.commons.cli.*
 
 @Field resolve = {arg, cmd ->
     Options options = new Options();
-    options.addOption(
-        OptionBuilder.hasArg(false)
-            .withLongOpt("ant")
-            .create('a')
-    );
-    options.addOption(
-        OptionBuilder.hasArg(false)
-            .withLongOpt("dos")
-            .create('d')
-    );
-    options.addOption(
-        OptionBuilder.hasArg(false)
-            .withLongOpt("shell")
-            .create('s')
-    );
-    options.addOption(
-            OptionBuilder.hasArg(false)
-                .withLongOpt("ivy")
-                .create('i')
-        );
+    options.addOption(Option.builder("a").hasArg(false).longOpt("ant").build());
+    options.addOption(Option.builder("d").hasArg(false).longOpt("dos").build());
+    options.addOption(Option.builder("s").hasArg(false).longOpt("shell").build());
+    options.addOption(Option.builder("i").hasArg(false).longOpt("ivy").build());
     CommandLine cmd2 = new GroovyInternalPosixParser().parse(options, arg[1..-1] as String[], true);
     arg = cmd2.args
 
@@ -199,7 +183,7 @@ import org.apache.commons.cli.*
             }
         } else {
             depsInfo.each { dep ->
-                results += ('org="' + dep.group + '" name="' + dep.module + '" revision="' + dep.revision)   
+                results += ('org="' + dep.group + '" name="' + dep.module + '" revision="' + dep.revision)
             }
         }
 
@@ -273,65 +257,20 @@ import org.apache.commons.cli.*
 // command line parsing
 @Field Options options = new Options();
 
-options.addOption(
-    OptionBuilder.withLongOpt("define")
-        .withDescription("define a system property")
-        .hasArg(true)
-        .withArgName("name=value")
-        .create('D')
-);
-options.addOption(
-    OptionBuilder.withLongOpt("resolver")
-        .withDescription("define a grab resolver (for install)")
-        .hasArg(true)
-        .withArgName("url")
-        .create('r')
-);
-options.addOption(
-    OptionBuilder.hasArg(false)
-        .withDescription("usage information")
-        .withLongOpt("help")
-        .create('h')
-);
+options.addOption(Option.builder("D").longOpt("define").desc("define a system property").hasArg(true).argName("name=value").build());
+options.addOption(Option.builder("r").longOpt("resolver").desc("define a grab resolver (for install)").hasArg(true).argName("url").build());
+options.addOption(Option.builder("h").hasArg(false).desc("usage information").longOpt("help").build());
 
 // Logging Level Options
 options.addOptionGroup(
-    new OptionGroup().addOption(
-        OptionBuilder.hasArg(false)
-        .withDescription("Log level 0 - only errors")
-        .withLongOpt("quiet")
-        .create('q'))
-    .addOption(
-        OptionBuilder.hasArg(false)
-        .withDescription("Log level 1 - errors and warnings")
-        .withLongOpt("warn")
-        .create('w'))
-    .addOption(
-        OptionBuilder.hasArg(false)
-        .withDescription("Log level 2 - info")
-        .withLongOpt("info")
-        .create('i'))
-    .addOption(
-        OptionBuilder.hasArg(false)
-        .withDescription("Log level 3 - verbose")
-        .withLongOpt("verbose")
-
-        .create('V'))
-    .addOption(
-        OptionBuilder.hasArg(false)
-        .withDescription("Log level 4 - debug")
-        .withLongOpt("debug")
-        .create('d'))
+        new OptionGroup()
+                .addOption(Option.builder("q").hasArg(false).desc("Log level 0 - only errors").longOpt("quiet").build())
+                .addOption(Option.builder("w").hasArg(false).desc("Log level 1 - errors and warnings").longOpt("warn").build())
+                .addOption(Option.builder("i").hasArg(false).desc("Log level 2 - info").longOpt("info").build())
+                .addOption(Option.builder("V").hasArg(false).desc("Log level 3 - verbose").longOpt("verbose").build())
+                .addOption(Option.builder("d").hasArg(false).desc("Log level 4 - debug").longOpt("debug").build())
 )
-
-
-options.addOption(
-    OptionBuilder.hasArg(false)
-        .withDescription("display the Groovy and JVM versions")
-        .withLongOpt("version")
-        .create('v')
-);
-
+options.addOption(Option.builder("v").hasArg(false).desc("display the Groovy and JVM versions").longOpt("version").build());
 
 @Field CommandLine cmd