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.

What would be the best way to achieve what I'm trying to do? I was kind of
hoping for a setting on a dependency (whether it's exported or not), but I
can't find it.

Thanks in advance and apologies for the long e-mail,
  Levi

Reply via email to