Bash or PHP script has a function that returns the directory path of the current script file.
$my_dir=dirname(__FILE__);
Groovy script lacks such a capability but an alternative is available by calling
def my_dir = new File(getClass().protectionDomain.codeSource.location.path).parent
Friday, September 30, 2011
Tuesday, September 27, 2011
Skip download when groovy code annotated with Grapes
Grapes is a great utility to manage class path automation when coding with groovy.
http://groovy.codehaus.org/Grape
But it slows down the start-up if there are a lot of dependent jars to download. Even all the dependent jar files have been downloaded to local m2 and grapes store previously, the download process still takes place, which slow things down unnecessarily.
Use the following options to ask groovy look into local storage directly.
groovy -Dgroovy.grape.autoDownload=false [groovy file path] [arguments ......]
http://groovy.codehaus.org/Grape
But it slows down the start-up if there are a lot of dependent jars to download. Even all the dependent jar files have been downloaded to local m2 and grapes store previously, the download process still takes place, which slow things down unnecessarily.
Use the following options to ask groovy look into local storage directly.
groovy -Dgroovy.grape.autoDownload=false [groovy file path] [arguments ......]
Friday, September 23, 2011
Suppress test stage during maven build
Use
-Dmaven.test.skip.exec=true
to skip running test cases without skipping test jar build
-Dmaven.test.skip.exec=true
to skip running test cases without skipping test jar build
A class path with all jar files in a folder
Typing in all the jar files to form a class path is not a fun job. This quick trick may alleviate some of the pain.
export CLASSPATH=`echo $PWD/*.jar | sed 's/ /:/g'`
Customize the "echo" part to get all the files needed.
Such as
export CLASSPATH=`echo $PWD/*.jar . $HOME/lib | sed 's/ /:/g'`
Subscribe to:
Posts (Atom)