So, I was more than a little disappointed to discover that the Grails developers are using Ant for most of the command-line stuff (partly because I was hoping to learn some cool tricks for starting up HSQLDB and Jetty for Chama). It just seems a little weird to me to rely on Ant tasks to do something that in my mind should be handled as part of the class (or Groovy file in this case).
Here are some examples of what I’m talking about:
<target name="run-app:impl">
<basename property="project.dir" file="."/>
<groovy>
import org.mortbay.jetty.*
import org.mortbay.http.*
System.setProperty('org.mortbay.xml.XmlParser.NotValidating', 'true')
def server = new Server()
project.addReference('server', server)
try {
def listener = new SocketListener()
listener.setPort(properties.'server.port'.toInteger())
server.addListener(listener)
server.addWebApplication("/" + properties."project.dir", 'tmp/war')
server.start()
} catch(Throwable t) {
t.printStackTrace()
}
</groovy>
</target>
I can understand, to a certain degree, why one would do something like this, but this seems like a bit overkill. I have a real problem with adding scripting into Ant files, it just seems like you are really pushing Ant to do something that it was never meant to do, but that’s just my opinion.
Also, to be fair, the Grails developers seem to have realized this and are now moving towards a true command line interface with the GrailsScriptRunner.groovy. Again though they are tying themselves to Ant unnecessarily. My personal preference is to create a true standalone command line interface (which is what I’m doing with Chama).
These are, of course, my opinions but I thought that others not familiar with Grails might be interested. And also note that I loathe Ant
, I’m a true Maven convert.
When we started Grails we needed something that would get us off the ground quickly without having to write our own build system and that was Ant at the time.
We of course knew we would have to rip it out and replace it with something eventually, but to start off with it gave us what we needed. Hence there is no reason to claim “Grails weirdness” about something that is being replaced
With 0.4 we are replacing it with a Gant based build system that combines Groovy scripts with Ant expression, as you mentioned. This has all the benefit of a free form scripting environment and the power of Ant tasks so I have no problem with “tying” ourselves to Ant because we get the best of both worlds.
As far as Maven goes, Maven 1 was the spawn of satan. One of the most evil, unintuitive, and awful pieces of software ever to come out of Apache. If I can pyschologically get over how rubbish Maven 1 was we might provide support for Maven 2 in a future release of Grails.
Hi Graeme, I wasn’t so much complaining about using Ant at all, more specifically about using it to do stuff that, in my mind, really belongs elsewhere.
I couldn’t find in the current codebase where you guys are doing the “start app” stuff.
I guess what I was expecting is something similar to Rails where everything is written using Ruby (including all the deployment stuff and server startup). I can certainly understand just getting something to work and I’m sure that you all are still developing, developing, developing
.
I know alot of developers had serious issues with Maven 1 but Maven2 is a whole different beast (literally, complete code rewrite).