2010/7/23 Jason Porter <[email protected]>

> On Fri, Jul 23, 2010 at 05:03, Dariusz Ludera <[email protected]>
> wrote:
> > Hi!
> >
> > First of all I'd like to say that I'm newbie in gradle. Secondly, I'd
> like
> > to use dependencies for example:
> >
> > compile 'log4j:log4j:1.2.16'
> > compile 'org.slf4j:slf4j-log4j12:1.6.1'
> >
> > to be avialable in testCompile scope. How can I declare it in my
> > build.gradle script?
> >
> > I want to use classes from this libraries in /src/main/java and
> > /src/test/java, but when I use it in my test classes, while testCompile
> task
> > execution I get an error that packages org.slf4j and log4j doesn't exist,
> so
> > gradle doesn't include libraries. I've got Maven pom.xml configured the
> same
> > way as build.gradle and there my tests work correctly.
> >
> >
> >
> > --
> > Regards,
> > Darek
> >
>
> Just add it as testCompile as well, though you shouldn't have to.
> testCompile should be inheriting from compile.  Which version of
> gradle are you using?
>
> --
> Jason Porter
> http://lightguard-jp.blogspot.com
> http://twitter.com/lightguardjp
>
> Software Engineer
> Open Source Advocate
>
> PGP key id: 926CCFF5
> PGP key available at: keyserver.net, pgp.mit.edu
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>
Thanks for your replay!

Adding as a testCompile didn't help.

Here is my dependencies section:

dependencies {
    compile 'log4j:log4j:1.2.16'
    compile 'org.slf4j:slf4j-log4j12:1.6.1'
    // for debug reason I removed other dependencies
}

and output from gradle test run task (info level):

:compileTestJava
:: resolving dependencies :: #crm;0.1-SNAPSHOT
    confs: [testCompile]
    found log4j#log4j;1.2.16 in
file:/C:/Documents%20and%20Settings/dludera/.m2/repository/
    found org.slf4j#slf4j-log4j12;1.6.1 in
file:/C:/Documents%20and%20Settings/dludera/.m2/repository/
:: resolution report :: resolve 16ms :: artifacts dl 0ms

(...) and then:
MyClassName.java:5: package org.slf4j does not exist
import org.slf4j.Logger;

So ant compile task couldn't find package org.slf4j which is in
:slf4j-log4j12-1.6.1.jar library. I don't underestand why gradle doesn't
attach it - maven in the same configuration works fine. I use gradle 0.9-p3
with useTestNG(), here is my test section:

test {
    useTestNG()
    systemProperties 'org.uncommons.reportng.stylesheet':
"${projectDir}/resources/hudsonesque.css"
    options {
        listeners << 'org.uncommons.reportng.HTMLReporter'
        listeners << 'org.uncommons.reportng.JUnitXMLReporter'
    }
    useDefaultListeners = false
}




-- 
Regards,

Darek

Reply via email to