I just finished reading "Everyday Scripting With Ruby", and there is a example
framework in there that I would *love* to use with Java/Groovy. It's called
UserChoices, and it's a configuration framework that is tailored for
Here's basically how you use it. First, you specify your configuration
sources, which can include files and command-line options. Next, you specify
possible properties that can be extracted from those config sources. Finally,
you specify how those choices should be validated and post-processed. In the
book, all of this is done by subclassing abstract classes, but I'm happy using
a framework that involves more or less coding, as long as it gives me the same
Has anyone seen a framework like this for Java? I write a lot of Java
and Groovy scripts, and the thing I like doing the least is
runtime-option parsing. It always involves a ton of brittle, boilerplate
code that is difficult to unit test. I would love to find a way to
simplify this part of my scripts while increasing readability.
I did look at a few frameworks, like the Commons Configuration framework
and a few J2EE-specific frameworks. These don't do much for me,
however, because they don't pull properties from the command line.
Thanks in advance for any help!
P.S. I purchased "Everyday Scripting With Ruby" based mostly on the
Bunkhouse review. After reading the book, I can say that the review was
excellent, and that the book was well worth my time and money. If
you're a scripter using *any* programming language (including Groovy),
this book is a definite must-have.