Geertjan's Blog

  • April 17, 2007

xwork.xml in Configuration Files Node

Geertjan Wielenga
Product Manager
I worked out how to put the xwork.xml file in the Configuration Files node, by looking at how it is done for Struts, and (for the first time) implemented WebFrameworkProvider.getConfigurationFiles. This is the result:

The only purpose of the Configuration Files node is that it provides a centralized location for all configuration files, which must first be found somewhere else, after which they are copied (programmatically, by the module that provides them) to the Configuration Files node. However, xwork.xml must end up in WEB-INF/classes, so initially I had that file in WEB-INF/classes or in the default Java package. Neither is very satisfactory. The point of a logical view is that you should have as few folders as possible in the Projects window, which is a project's logical view. So, having WEB-INF/classes is not ideal (and using the default package is just plain messy). Therefore, I write the file to WEB-INF, but I add a target to the build.xml file, which moves the xwork.xml file to WEB-INF/classes from the build/web/WEB-INF folder. That's a sneaky way of moving the file to the correct location at compile time. However, the down side is that the user has an odd looking Ant target in the build.xml file. Not sure if there is a nicer way of handling this (maybe I should smuggle the Ant target into build-impl.xml instead, so the user will not notice it at all). Is there Java code for copying files at compile time (or after compile time)? In the absence of that, I chose the Ant route.

In other news. This morning I received a cool tip about the Rich Client Programming book, from Fred Griggs, via e-mail. He writes: "Aside from the technical value of the book, there's tremendous monetary benefit to ordering through this -- Safari Books Online -- mechanism. For $35 worth of book, I paid $35; and I got to read the book within minutes of my request. This contrasts sharply with my order from Amazon, where $33 worth of book will cost me $52 – and that's when I eventually get it (with an estimated 1 to two months' delivery)! I like to annotate my books, and until we all read all on-line, this is the way to buy!" And then Fred attached his Amazon shipping form which shows he'd have to pay $18,99 for shipping, on top of the $32.99 for the book...

Join the discussion

Comments ( 3 )
  • Pramod Tuesday, April 17, 2007
    Why not leave the file in the src directory. The normal builds will move it exactly where it needs to go and it will not be confusing. The current solution you outlined would confuse the hell out of me. But if it was in the root src directory you would expect it to endup in the WEB-INF/classes directory.
    Just my thoughts :)
  • dietervb Wednesday, April 18, 2007
    The way Pramod describes, is also the way I do it. When compiling my project, the xwork.xml is copied to WEB-INF/classes.
  • Geertjan Wednesday, April 18, 2007
    Thanks for sharing your thoughts, Pramod and dietervb! Good to hear from real WebWork users out there.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.