Obtaining maven-style coordinates for published artifacts via tooling API


(Kris De Volder) #1

These questions are in reference to https://issuetracker.springsource.com/browse/STS-2834

This is right now the highest voted issue for Gradle STS tooling.

As far as I know it is not possible to get information from Gradle Tooling API about the artifacts that a project creates/publishes.

I was able to implement something that detects when a given Gradle dependencies with given version (where version is an instance of class org.gradle.tooling.model.GradleModuleVersion) corresponds to an existing m2e project in the workspace. If so then the jar dependencies is replaced by the tools with a project dependency.

Issue STS-2834 essentially is asking that the same feature to also be implemented for Gradle -> Gradle dependencies (not just Gradle -> Maven).

I believe that in order to do this we (tools) would need to be able to ask Gradle tooling API for information about the artifact(s) published by a project, more specifically, we need somehow to be able to obtain a GradleModuleVersion for any given Gradle project that publishes a jar with compiled classes. With this information it would then be possible to remap Gradle jar dependencies to Gradle projects.

Questions:

  1. Am I correct in assuming this information cannot currently be obtained via tooling API?

  2. If 1 => yes, would it be something you would consider adding? 3) if 1 => no, please point out the relevant API :slight_smile:

  3. Maybe you have a better idea? (I recall a quick discussion about possibly someway of modeling the IDE workspace and letting Gradle itself do this remapping).

If it were up to me I would go for option 2 right now. This seems the easiest thing to implement right now and also makes it ‘symmetrical’ with how we already handle maven projects. Also the feature can be configured or turned on-off via IDE UI preference pages. But we can certainly discuss about this.


(Luke Daley) #2

Hi Kris,

This indeed is an important issue. I’ve built adhoc solutions several times based on customising the ‘.classpath’ file using the Eclipse plugin for Gradle.

This is going to involve a non trivial discussion, so it would probably be better to use the dev list for it. The forum doesn’t scale well to multithreaded discussions.

Would you mind reposting to the dev list?


(Kris De Volder) #3

Sure, reposting shortly.


(Luke Daley) #4

Mailing list discussion can be found @ http://gradle.1045684.n5.nabble.com/Obtaining-maven-style-coordinates-for-published-artifacts-via-tooling-API-tp5711131.html