mill icon indicating copy to clipboard operation
mill copied to clipboard

KSP: kotlinSymbolProcessorsResolved does not resolve with bom

Open vaslabs opened this issue 2 weeks ago • 7 comments

Found it during testing with Micronaut:

we should be able to do this

  def kotlinSymbolProcessors = Seq(
    mvn"io.micronaut:micronaut-inject-kotlin:4.9.9",
    mvn"io.micronaut.openapi:micronaut-openapi:6.19.3"
  )

without the versions as happens in micronaut gradle for the versions that exist in:

mvn"io.micronaut.platform:micronaut-platform:4.9.2"

vaslabs avatar Dec 09 '25 11:12 vaslabs

it looks like if checkGradleModules is true bom is not working , for example with:

  def kotlinSymbolProcessorsResolved: T[Seq[PathRef]] = Task {
    defaultResolver().classpath(
      kotlinSymbolProcessors(),
      boms = allBomDeps()
    )
  }

See: https://github.com/com-lihaoyi/mill/pull/6359

any ideas?

@lefou @alexarchambault @lihaoyi

Error without the checkGradleModules override:

8461]   done compiling
8461]   [error] micronaut.kotlinSymbolProcessorsResolved
8461]   java.lang.RuntimeException: 
8461]   Resolution failed for 1 modules:
8461]   --------------------------------------------
8461]     io.micronaut:micronaut-inject-kotlin: 
8461]           not found: /home/vnicolaou/mill/out/dist/localRepo.dest/io/micronaut/micronaut-inject-kotlin/maven-metadata.xml
8461]           not found: /home/vnicolaou/.ivy2/local/io.micronaut/micronaut-inject-kotlin
8461]           No version available in (,)
8461]   

vaslabs avatar Dec 09 '25 13:12 vaslabs

I'm not sure TBH, @alexarchambault would probably know if anyone since he worked on the gradle module support in coursier

lihaoyi avatar Dec 09 '25 22:12 lihaoyi

from my side, I can either introduce a workaround, with a ksp dedicated resolver that has gradle modules disabled or start looking into coursier . A third option is to figure out the difference in code paths with the resolve mvn deps which is clearly working and see if it can be reused

EDIT: I'll start with the third option

vaslabs avatar Dec 10 '25 08:12 vaslabs

So https://github.com/coursier/coursier/pull/3534 should fix that, after a coursier release, and coursier version bump here

alexarchambault avatar Dec 11 '25 14:12 alexarchambault

So coursier/coursier#3534 should fix that, after a coursier release, and coursier version bump here

ah nice, thank you! if we had that default in kotlinmodule and pass it to the resolver, it would also fix it , right? (just out of interest)

vaslabs avatar Dec 11 '25 14:12 vaslabs

ah nice, thank you! if we had that default in kotlinmodule and pass it to the resolver, it would also fix it , right? (just out of interest)

What do you mean? Which default?

alexarchambault avatar Dec 11 '25 15:12 alexarchambault

ah nice, thank you! if we had that default in kotlinmodule and pass it to the resolver, it would also fix it , right? (just out of interest)

What do you mean? Which default?

    def classpath[T: CoursierModule.Resolvable](
        deps: IterableOnce[T],
        sources: Boolean = false,
        artifactTypes: Option[Set[coursier.Type]] = None,
        resolutionParamsMapOpt: Option[ResolutionParams => ResolutionParams] = None,

I thought there was something in the resolution params to workaround the issue, but looking at it now, I think not

vaslabs avatar Dec 11 '25 15:12 vaslabs

Waiting for a new coursier release, which should fix it.

lefou avatar Dec 15 '25 09:12 lefou

there's a new version that fixes both issues (+ the gradle rejects), thanks @alexarchambault

vaslabs avatar Dec 19 '25 18:12 vaslabs

there's a new version that fixes both issues (+ the gradle rejects), thanks @alexarchambault

Yes, but there are issues on the coursier CI that are making the release fail. Working on it.

alexarchambault avatar Dec 19 '25 18:12 alexarchambault

there's a new version that fixes both issues (+ the gradle rejects), thanks @alexarchambault

Yes, but there are issues on the coursier CI that are making the release fail. Working on it.

ah , I saw the tag, yep, no worries!

vaslabs avatar Dec 19 '25 18:12 vaslabs