Specify classifier and type in gradle dependency

buildship

(Alessandro Baffa) #1

I need to add a dependency (test-jar, from log4j), but I don’t know what is the correct syntax in gradle to include it in the compile("…") config step.

I need to specify the classifier and the type, but in the compile step I can only specify :group :name :version.

What is the correct syntax?

(I am using gradle 2.7)

Thanks!


(James Justinic) #2

The classifier can be added to end after the version: org.apache.logging.log4j:log4j-api:2.10.0:tests.

There isn’t a “type” in Maven coordinates. There’s packaging, but even that “test-jar” is still a jar. It’s log4j-api-2.10.0-tests.jar, not log4j-api-2.10.0-tests.test-jar, and jar is the default packaging.


(Alessandro Baffa) #3

It works, perfect. Thank you very much!