Showing posts with label ant. Show all posts
Showing posts with label ant. Show all posts

Saturday, May 19, 2012

Adding Ant optional task to Grails

Since version 2 Grails does not include Sshexec with built-in Gant libs, so it broke some of my deployment scripts. Fortunately it is easy to fix with nothing more than few Grapes annotations added to your Gant script:


...

@Grapes([
  @Grab(group ="org.apache.ant", module = "ant-jsch", version ="1.8.1"),
  @Grab(group ="com.jcraft", module = "jsch", version ="0.1.48"),
  @GrabConfig(systemClassLoader = true)
])

...

Possibly, there are other options like adding libs to some magic folders, but I found this one best as it avoids additional configuration, is self explanatory and hard to skip or forget as it is in script itself.

Wednesday, October 12, 2011

Using properties from Grails script

If you have custom Grails script and need to access property file from it, I found that easiest way to do it is to use Ant. There is complete example how to access file and to use variables:
ant.property(file:'user.properties')
ant.scp(file:'target/app.war', todir:"${ant.project.properties.login}:${ant.project.properties.password}@server:/home/tomcat/", trust:true)