Adam Murdoch-2 wrote:
>
>
>
> On 27/03/10 6:36 AM, mjparme wrote:
>> I am new to Gradle and to help learn it I am trying to get one of my
>> projects
>> currently built with ANT to build with Gradle. I can't even get the
>> project
>> to compile with Gradle. My project is laid out like this:
>>
>> projectroot/
>> --lib
>> --src
>> ----java
>> --test
>> ----java
>>
>> The lib directory contains all the dependent jars needed to build the
>> project. I have included the contents of my build.gradle file. Gradle
>> fails
>> to find all the jars needed (compiler fails as it can't find the classes
>> from the jar files). It does however find the source files based on my
>> custom sourceSets.
>>
>> usePlugin 'java'
>>
>> dependencies {
>> runtime fileTree(dir: 'lib', includes: ['*.jar'])
>>
>
> You should use the 'compile' configuration:
>
> dependencies {
> compile fileTree(...)
> }
>
> The compile configuration is used to compile the code. The runtime
> configuration (which also includes everything in the compile
> configuration) is used to execute the code (eg to run tests, etc).
>
>
> --
> Adam Murdoch
> Gradle Developer
> http://www.gradle.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
>
I had just found Table 18.5 in the Chapter 18 of the UserGuide that listed
the dependencies configurations and had just started to mess with compile
when I saw your message.
I have it compiling now, the solution was:
dependencies {
compile fileTree(dir: 'lib', includes: ['*.jar'])
}
compile files(fileTree(dir: 'lib', includes: ['*.jar'])) also works.
I guess I was using runtime because I think of all the jars in "lib" as the
jars that are needed at runtime.
--
View this message in context:
http://old.nabble.com/Compile-using-jars-from-a-lib-directory-tp28047035p28047693.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email