logo       

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

lang.groovy.user

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

I think being able to easily load properties files would be quite useful. I do this all the time, both in ant scripts, and plain old programs.

I also like the way that ant does "in-file property expansion". From the Ant doc on the property task:

Example of entries in a .properties file:
build.compiler=jikes
deploy.server=lucky
deploy.port=8080
deploy.url=http://${deploy.server}:${deploy.port}/

Patrick Mueller
pmuellr-/E1597aS9LQAvxtiuMwx3w@xxxxxxxxxxxxxxxx

On Oct 29, 2004, at 9:00 AM, Laforge Guillaume wrote:

Hello Patrick,

Interesting, I had an idea along the lines that I didn't commit on CVS.
It's a GProperties class which would allow us to do things like:

props = new GProperties("build.properties")
println props.maven.skip.test
props.my.other.prop = 3

But I can't really create new branches, just read, and modify actual values.
I'll have another go at it if you think it's useful.


--
Guillaume Laforge
http://glaforge.free.fr/weblog


-----Message d'origine-----
De : news [mailto:news-WnDAp88bSu3NLxjTenLetw@xxxxxxxxxxxxxxxx]De la part de
Patrick Mueller
Envoyé : vendredi 29 octobre 2004 14:49
À : groovy-user-81qHHgoATdGxIXFVlbCvtR2eb7JE58TQ@xxxxxxxxxxxxxxxx
Objet : [groovy-user] Re: Java World: Build scripts with Groovy and Ant
artcicle


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)




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

News | FAQ | advertise