ProjectPublications not working?

I’ve got a basic Gradle Java project that publishes a jar to a flatDir repo. When I yse the tooling API to build the ProjectPublications model (http://www.gradle.org/docs/1.12/javadoc/org/gradle/tooling/model/gradle/ProjectPublications.html) it returns an empty collection for the publications.

I was expecting to get one publication back since the project publishes a single jar.

Why am I not getting any publications?

apply plugin: ‘java’

apply plugin: ‘eclipse’

sourceCompatibility = 1.5

version = ‘1.0’

jar {

manifest {

attributes ‘Implementation-Title’: ‘Gradle Quickstart’, ‘Implementation-Version’: version

}

}

repositories {

mavenCentral()

}

dependencies {

compile group: ‘commons-collections’, name: ‘commons-collections’, version: ‘3.2’

testCompile group: ‘junit’, name: ‘junit’, version: ‘4.+’

}

test {

systemProperties ‘property’: ‘value’

}

uploadArchives {

repositories {

flatDir {

dirs ‘…/repos’

}

}

}

BTW apparantly it works when I change the build.gradle to use a maven repository for publishing. So maybe it just doesn’t work for ‘flatDit’ publications?

apply plugin: ‘java’

apply plugin: ‘eclipse’

apply plugin: ‘maven’

sourceCompatibility = 1.5

version = ‘1.0’

group = ‘demo’

jar {

manifest {

attributes ‘Implementation-Title’: ‘Gradle Quickstart’, ‘Implementation-Version’: version

}

}

repositories {

mavenCentral()

}

dependencies {

compile group: ‘commons-collections’, name: ‘commons-collections’, version: ‘3.2’

testCompile group: ‘junit’, name: ‘junit’, version: ‘4.+’

}

test {

systemProperties ‘property’: ‘value’

}

uploadArchives {

repositories {

mavenDeployer {

repository(url: file("…/repos/maven").toURI())

}

}

}

This is related STS issue: https://issuetracker.springsource.com/browse/STS-2834

Although I beleave it doesn’t work for ‘flatDir’ publications.

I closed the STS issue as fixed as it works for publications to maven repos.

As far as I’m concerned the fact it doesn’t work for ‘flatDir’ is a bug in Gradle / ToolingAPI implementation of the

ProjectPublications model. Of course its just my opinion. since nobody responded to my question, my own opinion is really all I have to go on.