Adam, tinkering with compile.unmanagedClasspath seemed to get me nowhere. This property is clearly not used by the Groovy installation used by Gradle via the dependencies.groovy. I found that the following seems to work fine:
groovyJarList = groovyLib.listFiles ( [ accept : { File dir , String
name -> ( name =~ '.jar$' ).find ( ) } ] as FilenameFilter ) as List
def getVersionNumberOfJar ( root ) {
def jarName = groovyJarList.find { File file -> ( file.name =~ ( root
+ '-[0-9].*.jar$' ) ).find ( ) }
( jarName =~ ( '.*' + root + /-(.*)\.jar/ ) )[0][1]
}
dependencies {
addFlatDirResolver ( 'lib' , groovyLib )
groovy ( [ 'groovy' , 'asm' , 'antlr' , 'commons-cli' ].collect { ':'
+ it + ':' + getVersionNumberOfJar ( it ) } )
}
where groovyLib is a File object pointing at a Groovy installation.
I am not sure whether this is the way the dependencies.groovy should be used
but it works.
On Wed, 2009-03-25 at 07:06 +1100, Adam Murdoch wrote:
> You can add them to the compile task's unmanaged classpath:
>
> compile.unmanagedClasspath << .. a collection of files ...
>
> In Gradle 0.6 or 0.7, we want to provide a simple way to add a
> collection of files to a configuration, something like:
>
> dependencies {
> compile files(... a collection of files ...)
> }
>
>
> Russel Winder wrote:
> > Actually what I really want is to be able to do:
> >
> > compile.classpath += groovyLib.listFiles ( [ accept : { File dir , String
> > name -> ( name =~ '.jar$' ).find ( ) } ] as FilenameFilter ) as List
> >
> >
> > On Tue, 2009-03-24 at 19:40 +0000, Russel Winder wrote:
> >
> >> In ant you can create class paths with filesets which allows you not to
> >> have to specify the version number of a dependency. Basically you are
> >> saying "just use all the jars in there".
> >>
> >> The flat directory resolver is part way to doing this for dependencies
> >> in Gradle and yet you have to specify the version number. Is there a
> >> way of getting Gradle to deduce the version number. I tried:
> >>
> >> dependencies {
> >> addFlatDirResolver ( 'lib' , groovyHome.path + '/lib' )
> >> groovy ( ':groovy:' )
> >> testCompile ( ':junit:' )
> >> }
> >>
> >> but Gradle didn't like that. I even tried globs and stuff but nothing
> >> seemed to work, an explicit version number appears to be required.
> >>
> >> Am I just missing the right example in the user guide?
> >>
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
--
Russel.
============================================================
Dr Russel Winder Partner
Concertant LLP t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road, f: +44 8700 516 084 voip:
sip:[email protected]
London SW11 1EN, UK. m: +44 7770 465 077 xmpp: [email protected]
signature.asc
Description: This is a digitally signed message part
