Version catalog and platforms

Hi,
I hope this is not a silly question. But I’ve been rewriting our project to use version catalog (using libs.versions.toml file) and I’ve noticed that this normally works:

implementation libs.somelib

But with platform, I need to call a get() method. Otherwise, I get an error:

implementation platform(libs.bootdependencies.get())

Is this intentional? Or am I using something wrong?

Thank you very much

No, I don’t think it should be necessary.
Can you knit an MCVE to show what you see?

Oh, thanks a lot for pointing me in the right direction. I found the culprit. We also have an ‘exclude’. And when I pass that as well I need to use get().

For example, this works completely fine:

dependencies {
	implementation platform(libs.bootdependencies)
}

But here, I need that get() call.

dependencies {
	implementation platform(libs.bootdependencies.get()) {
		exclude group: 'mysql'
	}
}

I am not sure if that exclude is even 100% correct but that’s what we have.

And here is a console output:

Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\devel\eurofunk\tmp\demo\demo\build.gradle' line: 15

* What went wrong:
A problem occurred evaluating root project 'demo'.
> Cannot convert the provided notation to an object of type Dependency: map(valueof(DependencyValueSource)).
  The following types/formats are supported:
    - String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
    - Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
    - FileCollections, for example files('some.jar', 'someOther.jar').
    - Projects, for example project(':some:project:path').
    - ClassPathNotation, for example gradleApi().

  Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
<-------------> 0% WAITING
> IDLE

I think this should work:

dependencies {
	implementation(platform(libs.bootdependencies)) {
		exclude group: 'mysql'
	}
}

Oh damn. It works. So it was a rookie mistake on my part with the Groovy syntax.
Thanks a lot for the help. I really appreciate it.

Yep, better use the Kotlin DSL. :slight_smile:
Amazingly better IDE support, type-safe build scripts and errors that are a ton more helpful.