logo       

Re: Java World: Build scripts with Groovy and Ant artcicle: msg#00162

lang.groovy.user

Subject: Re: Java World: Build scripts with Groovy and Ant artcicle

Daniel Serodio wrote:
There's one great Ant feature that's missing from this example: build.properties files.

It's a pretty common "idiom" for Ant scripts to include a build.properties in the project's root (ie, same dir as build.xml) with defaults and another on $HOME, which overrides these defaults.

I have tons of projects and a pretty large ~/build.properties, with locations for libraries, etc. How can I achieve the same functionslity with Groovy builder?

TIA,
Daniel Serodio

Philippe Ombredanne wrote:

The article is dated from tomorrow :-) I guess it is already Monday in Europe!
http://www.javaworld.com/javaworld/jw-10-2004/jw-1004-groovy_p.html
By Filippo Diotalevi : http://www.jroller.com/page/fdiotalevi

I just started converting some build.xml files to build.groovy. I immediately found that I'd like some of my build properties available as Groovy variables, so I now do something like this:

props = new Properties(System.properties)
props.load(new FileInputStream('build.properties'))

I should really close the FileInputStream, but this is a build script so I don't care that much.

I haven't looked, but it would nice if there was a one-shot addition to Properties in the GroovyJDK bits so you could do something like this:

props = Properties.loadFile('build.properties')

and maybe some others like:

props = Properties.loadResource(myClass,myResourceName)
props = Properties.loadStream(inputStream)


--
Patrick Mueller
pmuellr-/E1597aS9LQAvxtiuMwx3w@xxxxxxxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise