Get classifier from a dependency?

Some of my projects have dependencies on other projects which are build with classifiers. eg.


In a plugin I need to iterate the dependencies and perform a certain operation if the dependency has a specific classifier. I thought I could do:

for (Configuration configuration : configurations) {
      DependencySet allDependencies = configuration.getAllDependencies();
      for (Dependency dependency : allDependencies) {

but that does not get the classifier info. I have also tried:

PublishArtifactSet artifacts = configuration.getArtifacts();
      for (PublishArtifact publishArtifact : artifacts) {
        System.out.println("this is publishArtifact.getClassifier() : " + publishArtifact.getClassifier());
        System.out.println("this is publishArtifact.getName() : " + publishArtifact.getName());

This seems to be the right info. The only problem is that its “this” project’s classifier and not “this” project’s dependencies classifiers. Is there any way to get the classifier info for a projects dependencies?

Has it became possible in Gradle 2.2?

You can do something like this (shows two examples of explicitly adding the classifier):

repositories { mavenCentral() }
  configurations {
  dependencies {
  someConf 'log4j:log4j:1.2.17'
  someConf 'log4j:log4j:1.2.17:sources'
  someConf 'log4j:log4j:1.2.17:javadoc@jar'
  task listClassifier() {
  doLast() {
     configurations.someConf.resolvedConfiguration.resolvedArtifacts.each { println it }

Thanks Sterling.