Cannot invoke "getPreferredVersion()" because "versionConstraint" is null

I have a Kotlin project that has a dependency on a library named dsl. At the moment dsl is living in my Maven Local. The dependency is specified in my build.gradle as follows:

dependencies {

When I build my project, I get the following error:

Execution failed for task ':compileKotlin'.
> Error while evaluating property 'filteredArgumentsMap' of task ':compileKotlin'
   > Could not resolve all files for configuration ':compileClasspath'.
      > Could not resolve com.test.platform:dsl:0.0.1-SNAPSHOT.
        Required by:
            project :
         > Cannot invoke "org.gradle.api.artifacts.VersionConstraint.getPreferredVersion()" because "versionConstraint" is null

I can’t figure out what this error means–does anybody have an idea?

Some details:

  • I’m generating the dsl library from another Kotlin project. It’s in my local Maven and it appears to look right.
  • The parse-tree library is a dependency of dsl–I’m not sure that it needs to be here, but I get the same behavior whether or not I include it.
  • FWIW, my project is a regular JVM Kotlin project, and so is dsl. However, parse-tree is multiplatform. dsl has a dependency on the “common” part of parse-tree. Not sure if this is relevant.

I don’t have too much experience with publishing artifacts, so I might be missing something silly.

I stumbled upon something similar when I declared mavenLocal() after mavenCentral() in build.gradle.kts. I’m not you’re looking at the same problem, but it’s probably worth checking out.