Configgy is a great configuration and logging library for Scala. You can read info/examples on the release page or git the current repository.
To install, just download and, in its directory, type
$ant package
( The ‘$’ is your terminal command-line prompt. Don’t type it.)
If you see the following errors:
[scalac] Compiling 16 source files to /Users/Gary/Development/scala/configgy/target/classes
[scalac] /Users/Gary/Development/scala/configgy/src/main/scala/net/lag/configgy/JMXWrapper.scala:51: error: wrong number of arguments for constructor MBeanInfo: (java.lang.String,java.lang.String,Array[javax.management.MBeanAttributeInfo],Array[javax.management.MBeanConstructorInfo],Array[javax.management.MBeanOperationInfo],Array[javax.management.MBeanNotificationInfo])javax.management.MBeanInfo
[scalac] new jmx.MBeanInfo(”net.lag.configgy.ConfigMap”, “configuration node”, node.asJmxAttributes(),
[scalac] ^
[scalac] /Users/Gary/Development/scala/configgy/src/main/scala/net/lag/configgy/JMXWrapper.scala:115: error: value asList is not a member of javax.management.AttributeList
[scalac] for (attr <- jcl.Buffer(attrs.asList)) setAttribute(attr)
[scalac] ^
[scalac] two errors found
…it’s because Configgy requires Java 1.6. You probably haven’t set your JAVA_HOME and are defaulting to Java 1.5. To correct your environment variables on the Mac, see my notes below.
Next, if you’re trying out the example code and see an error like:
Compiling 1 source file to /Users/Gary/Development/NetBeansProjects/ScalaApplication1/build/classes
/Users/Gary/Development/NetBeansProjects/ScalaApplication1/src/scalaapplication1/Main.scala:27: error: value get is not a member of net.lag.configgy.Config
val hostname = config.get(”hostname”, “localhost”)
…it’s because that function has been renamed getString(), but not all of the documentation has been updated. Change it to:
val hostname = config.getString(”hostname”, “localhost”)
Tags: configgy