Thanks Hans,
Nowhere did I try to imply that it was a bug :) But I do think that it would
be useful to include the functionality of being able to declare that you
depend on a project and its dependencies. I haven't really thought of any
convincing examples (other than my standalone *tests* project), but if
you're not keen on implementing this I could try to come up with scenarios
in which it would be a good idea.
Regards,
Levi
On Mon, Sep 29, 2008 at 11:03 AM, Hans Dockter <[EMAIL PROTECTED]> wrote:
>
> On Sep 27, 2008, at 2:03 PM, Levi Hoogenberg wrote:
>
> Hello,
>>
>> I have the following project layout:
>>
>> root/
>> core/
>> lib/
>> slf4j-api-1.5.2.jar
>> src/
>> main/
>> java/
>> build.gradle
>> tests/
>> lib/
>> testng-5.8-jdk15.jar
>> src/
>> test/
>> java/
>> build.gradle
>> build.gradle
>> settings.gradle
>>
>> root/build.gradle contains:
>>
>> subprojects {
>> usePlugin('java')
>>
>> dependencies {
>> addFlatDirResolver('lib', new File(projectDir, 'lib'))
>> }
>>
>> // ...
>> }
>>
>> project/build.gradle looks like this:
>>
>> dependencies {
>> compile(':slf4j-api:[EMAIL PROTECTED]')
>> }
>>
>> And finally, tests/build.gradle looks like this:
>>
>> dependencies {
>> testCompile project(':core'), ':testng:5.8:[EMAIL PROTECTED]'
>> }
>>
>> According to section 14.7, the project dependency on core from tests makes
>> sure that core's dependencies are added to the classpath of the tests
>> project. Now I may misunderstand this, but I expected my test classes to be
>> able to use SLF4J classes. When I run gradle testCompile inside tests
>> however, I get compiler errors like the following:
>>
>> cannot find symbol
>> symbol : class Logger
>> location: package org.slf4j
>> import org.slf4j.Logger;
>> ^
>>
>> So I guess this is not what the user guide means when it says that
>> dependencies of the other project are added to the classpath.
>>
>
> This is not a bug but a feature of Gradle. We explain this in detail in UG
> 12.1.2. The dependencies of the other project are added to the runtime
> classpath. We intentionally do never put transitive dependencies of a
> project or an external lib into the compile classpath of the using project.
> We consider it as best practices that your first level dependencies are
> explicitly declared. This is easy to change but we don't think it is a good
> idea.
>
> - Hans
>
> --
> Hans Dockter
> Gradle Project lead
> http://www.gradle.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>