It's working now, thanks! I also added test-sources so it's easier to link
the source code for studying their code while working on it:

+  integrationTestCompile 'org.apache.logging.log4j:log4j-core:' +
project.'log4j.version' + ':tests'

+  integrationTestCompile 'org.apache.logging.log4j:log4j-core:' +
project.'log4j.version' + ':test-sources'

The gradle classifier isn't quite the same as maven type. Gradle doesn't
seem to have dependency types, and maven seems to provide a type to string
mapping which is defined in the pom for the project.


On Mon, Sep 17, 2018 at 9:36 AM, Sai Boorlagadda <sai.boorlaga...@gmail.com>
wrote:

> It looks[1] like it is been renamed as 'tests', so you can try
>
> testCompile 'org.apache.logging.log4j:log4j-core:' +
> project.'log4j.version' + ':tests'
>
> [1]
> https://repo.maven.apache.org/maven2/org/apache/logging/
> log4j/log4j-core/2.11.0/
>
> On Fri, Sep 14, 2018 at 5:17 PM Jacob Barrett <jbarr...@pivotal.io> wrote:
>
> > The concatenation is missing a : in front of the test-jar.
> >
> > > On Sep 14, 2018, at 4:10 PM, Kirk Lund <kl...@apache.org> wrote:
> > >
> > > Log4j2 publishes a test jar for log4j-core. The jar includes useful
> > things
> > > like LoggerContextRule.
> > >
> > > This blog post shows how to add the dependency for testing to maven:
> > > https://relentlesscoding.com/2018/04/21/unit-test-log4j2-log-output/
> > >
> > > This results look like this:
> > >
> > > <dependency>
> > >    <groupId>org.apache.logging.log4j</groupId>
> > >    <artifactId>log4j-core</artifactId>
> > >    <version>2.11.0</version>
> > >    <type>test-jar</type>
> > > </dependency>
> > >
> > > And these various stackoverflow questions talk about using Gradle's "
> > > classifier" instead of "type":
> > > *
> > >
> > https://stackoverflow.com/questions/20224260/how-do-i-
> pull-maven-test-jars-using-gradle
> > > *
> > >
> > https://stackoverflow.com/questions/13188438/how-to-
> specify-a-classifier-in-a-gradle-dependencys-dependency
> > >
> > > This gradle man page discusses the "classifier" further:
> > > *
> > >
> > https://docs.gradle.org/current/userguide/declaring_
> dependencies.html#sub:resolve_specific_artifacts_from_dependency
> > >
> > > I've tried adding:
> > >
> > > +  compile 'org.apache.logging.log4j:log4j-core:' +
> > project.'log4j.version'
> > > + 'test-jar'
> > >
> > > +  testCompile 'org.apache.logging.log4j:log4j-core:' +
> > > project.'log4j.version' + 'test-jar'
> > >
> > > +  integrationTestCompile 'org.apache.logging.log4j:log4j-core:' +
> > > project.'log4j.version' + 'test-jar'
> > >
> > > ...too geode-core/build.gradle. The result builds but if I then try to
> > use
> > > any classes from the test jar I have no luck. If I check Project
> > Structure
> > > in IntelliJ after making sure that my project re synced from gradle,
> sure
> > > enough the test jar is still missing from the dependencies.
> > >
> > > According to Gradle and SO, this should work. Is the problem our gradle
> > > mess? Does anyone know how to get this working in the Geode gradle
> build?
> >
>

Reply via email to