Gradle Tooling API. Get group id, artifact id, version of a project

Here is the graldle.build file contents:

plugins {
	id 'org.springframework.boot' version '2.3.0.M2'
	id 'io.spring.dependency-management' version '1.0.9.RELEASE'
	id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
}

repositories {
	mavenCentral()
	maven { url 'https://repo.spring.io/milestone' }
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-activemq'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
	testImplementation('org.springframework.boot:spring-boot-starter-test') {
		exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
	}
}

test {
	useJUnitPlatform()
}

I’d like to have a project model via Gradle Tooling API or Buildship Eclipse plugin:

GradleCore.getWorkspace().getBuild(project).get().withConnection(connection -> {
    return connection.getModel(SomeProjectModel.class);
}, new NullProgressMonitor())

where SomeProjectModel is the model that could provide me with:

  • group (which is ‘com.example’)
  • version (which is ‘0.0.1-SNAPSHOT’
  • artifact
  • plugins (i.e. have access to id ‘org.springframework.boot’ version ‘2.3.0.M2’)

Can I use any of the existing models to get to the data above? Or am I’m better off registering a model builder to extract all this data directly from Gradle?

Thanks in advance