For what it's worth, I was trying to create a script for setting the runtime classpath. This is something we've grown accustomed to in our ANT builds because it makes it easy to run various classes, utilities, etc. with the same classpath ant built.

I'm definitely a groovy-newbie but after poking around, I ended up with:

    def fullCp = [] as Set
    dependencies.resolve("runtime" ).each{ fullCp.add(it) }
    fullCp += compile.destinationDir
new File( "setclasspath-gradle.cmd" ).write( "set CLASSPATH=" + fullCp.join( System.properties.'path.separator' ) )

...for the windows environment.

Given that I've barely scratched the surface of gradle + groovy, there may be better ways to accomplish that. I was just happy to have it working.

-Paul

Hans Dockter wrote:
Originally the main use case for this method was to get an Ant path. For some reason I always thought that an Ant path needs a colon separator in any case. But I was wrong. Ant accepts ':', and ';'. In trunk, as Steve has pointed out, the method now uses the 'path.separator'.

For Groovy newbies: What you can always do with any collection is something like: compile.resolve().join('*'), which return a String where the elements are separated with a '*'.

- Hans

On Apr 11, 2009, at 12:22 AM, Steve Appling wrote:

That is a bug in the 0.5.2 build that has been corrected in the current main trunk version.

PSpeed wrote:
Note: Trying to get something similar to work, I tried the below but on
Windows it uses the ":" separator it seems instead of ";". So, it doesn't look like it's using System.properties.'path.separator'... though I could
have missed something.  I'm still a gradle-noob.
-Paul
Steve Appling wrote:
is dependencies.compile.asPath what you want?


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email



--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to