This message was deleted.
# community-support
s
This message was deleted.
v
I don't use Spring Boot. But assuming you also apply the Spring Boot plugin, and that this adds the documented configuration, then according to https://docs.spring.io/spring-boot/docs/3.2.1/reference/htmlsingle/#using.devtools it should be
Copy code
dependencies {
    developmentOnly("org.springframework.boot:spring-boot-devtools")
}
And the explicit
requireCapability
anyway sounds fishy, as it is the default capability anyway, so a no-op. Or which coordinates is
libs.spring.boot.devtools
pointing at?
c
No, I tried to avoid the spring boot plugin... Well I try to avoid its dependency management. The only thing I tend to use it for is building the boot jar and I don't need that for this library. Honestly it's only really including dev tools so I can reach at the externalized spring properties
It's pointing at the same coordinates. When I tried to had it from something else it got funny and was like that version doesn't exist. It was referencing you know the dot Version or whatever when a version is missing, Even though the version is managed by spring dependencies. I didn't see a way to add a root level optional dependency or whatever
Imagine I'm not using spring boot
v
Whether you use spring boot plugin or not is irrelevant for the capability topic. You just re-request the default capability, so you can as well just leave it out. As for the "dependency management of the spring boot plugin", what dependency management does it do? I'm curious to know. I just know the Spring dependency management plugin does some and there does more harm than good by now and even the maintainer recommends not to use it anymore. But that's separate from the Spring Boot plugin.
c
Well, last I checked that scope is sort of bundled in that dependency management bit. If I use that plug-in like I said the only thing I use it for is the boot jar
I'm not sure what you mean by rerequest the default capability or leave it out or whatever
You just re-request the default capability, so you can as well just leave it out.
I don't understand... what should my code look like (not using the spring boot plugin)
v
What I try to say is, that
Copy code
runtimeOnly(libs.spring.boot.devtools) {
        capabilities {
            requireCapability("org.springframework.boot:spring-boot-devtools")
        }
    }
is identical to
Copy code
runtimeOnly(libs.spring.boot.devtools)
👍 1
c
so is there a way to make devtools optional here?
v
What do you mean by "make it optional"?
c
like consumers of this project don't automatically get devtools
it would be there for this project, but somebody doing implementation(projects.thisProject) wouldn't get it without asking for it themselves
v
Not with a standard configuration I think. That's probably why the boot plugin has a separate configuration for this. You probably need to replicate the same if you want the same behaviour. So a separate
dependencyScope
configuration on which you declare that dependency. A
resolvable
configuration extending it. And then configuring whatever run tasks you have to also include the results of that resolvable configuration.
👍 1
c
I think maybe the answer is this needs to be
testRuntimeOnly
for this module anyways...
v
Yeah, or with a feature variant like mentioned in that blog, but I don't think it fully applies here, as it is not an optional dependency that your consumers might also want to change behavior of your library, but just something you want for development of that project.
Yeah, or
testRuntimeOnly
if that is where you need it, that should probably work.
I assumed you need it for something like
run
task or similar
c
but yeah, I was kind of surprised that this throws an error
Copy code
api(platform(libs.spring.boot.dependencies))    
    api(libs.spring.boot.autoconfigure) {
        capabilities {
            requireCapability("org.springframework.boot:spring-boot-devtools")
        }
    }
v
Why are you surprised?
The autoconfigure dependency most probably does not provide the devtools capability in any of its variants if there are multiple
I would actually wonder if it did
c
it just isn't how I thought capabilities worked 😉
but the error is around the version
or rather, reads to me like it is
Copy code
> Could not resolve org.springframework.boot:spring-boot-autoconfigure.
     Required by:
         project :test-app
      > Unable to find a variant of org.springframework.boot:spring-boot-autoconfigure:2.5.15 providing the requested capability org.springframework.boot:spring-boot-devtools:
           - Variant apiElements provides org.springframework.boot:spring-boot-autoconfigure:2.5.15
           - Variant runtimeElements provides org.springframework.boot:spring-boot-autoconfigure:2.5.15
           - Variant mavenOptionalApiElements provides org.springframework.boot:spring-boot-autoconfigure-maven-optional:2.5.15
           - Variant mavenOptionalRuntimeElements provides org.springframework.boot:spring-boot-autoconfigure-maven-optional:2.5.15
           - Variant javadocElements provides org.springframework.boot:spring-boot-autoconfigure:2.5.15
           - Variant sourcesElements provides org.springframework.boot:spring-boot-autoconfigure:2.5.15
v
If there were a variant of autoconfigure that contains the devtools as dependency, it would probably be a capability like
org.springframework.boot:spring-boot-autoconfigure-devtools
or similar.
c
right
v
Yeah, no, that error is not about version
It says it cannot find a variant providing the requested capability
c
it looks like it because of the
:
that has nothing after it
which is usually what I see for a missing version
v
Ah, yeah, no, taht's just misinterpretation 😄
c
anyways, I'm now not sure how a capabilities actually works
like what would
v
That
:
means "left message" details here as list
c
doesn't matter, I'm gonna go with another solution 😕
maybe some day I'll have a problem that could actually be solved by capabilites
v
Capabilites are how you manually select a feature variant. If you for example have a library that might have dedicated oracle support and dedicated mssql support, you might request the capability
com.example:my-library-oracle
or
com.example:my-library-mssql
where the coordinates are
com.example:my-library
Here you can find the docs about feature variants: https://docs.gradle.org/current/userguide/feature_variants.html
c
I'm not sure how it tells it's a variant, I digress, low priority of understanding it at this second
v
how it tells it's a variant
Who is "it"?
c
ur mom... or gradle
v
My mom does not even know what Gradle is
🤣 1
And Gradle does know, because the producer project defines its feature variants like shown in the doc I linked
c
yes, but Gradle is not a "who"
v
?
c
at least I don't think so... is there a James Gradle or something? like James Workshop?
v
?
c
Who is "it"?
v
And you said "Gradle"
c
but it's not a "who" 😉
it's a "what"
v
And my mom is not an "it", so what's your point?
c
I was making a joke
anyways
and your mom arguably is an "it" if you go with a gender neutral pronoun
v
I know, it's just not funny :-P :-D
c
since "it" is a valid pronoun
v
It's not hers, and I don't support that gendering insanity
But you might not know what I'm talking about, that's probably mostly a German problem
c
how should I know? I don't care what you call my gender, I identify as IDGAF
😉
and tbh... I hate "sex" as physical or born with. I preferred gender...
so then I think if they wanted a cultural identity they should have come up with a new term
🤷 idk
they seem to not understand that it's a "culture" thing
and all of their whine's are about social norms
v
🤷‍♂️
👍 1