Kapt support for BOM (Bills of Material)

I am getting error for using platform and enforceplatform of gradle 5 to import BOM file to an Android project which use Kotlin and Kapt. The error say

It works fine if I use “io.spring.dependency-management” plugin to import BOM file:

    dependencyManagement {
    imports {
        mavenBom 'bombomfile:0.0.1'
    }
}

error detail

14:23:36.634 [DEBUG]     [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'androidx.room:room-compiler:' in resolver cache 'maven'
14:23:36.634 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'androidx.room:room-compiler:' in resolver cache 'Google'
14:23:36.635 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'androidx.room:room-compiler:' in resolver cache 'maven2'
14:23:36.635 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module 'androidx.room:room-compiler:' in resolver cache 'maven3'
14:23:36.635 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] No meta-data file or artifact found for module 'androidx.room:room-compiler:' in repository 'maven'.
14:23:36.635 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.PersistentModuleMetadataCache] Recording absence of module descriptor in cache: androidx.room:room-compiler: [changing = false]
14:23:36.635 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] No meta-data file or artifact found for module 'androidx.room:room-compiler:' in repository 'Google'.
14:23:36.635 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.PersistentModuleMetadataCache] Recording absence of module descriptor in cache: androidx.room:room-compiler: [changing = false]
14:23:36.635 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] No meta-data file or artifact found for module 'androidx.room:room-compiler:' in repository 'maven2'.
14:23:36.635 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.PersistentModuleMetadataCache] Recording absence of module descriptor in cache: androidx.room:room-compiler: [changing = false]
14:23:36.636 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] No meta-data file or artifact found for module 'androidx.room:room-compiler:' in repository 'maven3'.
14:23:36.636 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.modulecache.PersistentModuleMetadataCache] Recording absence of module descriptor in cache: androidx.room:room-compiler: [changing = false]
14:23:36.636 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResultsBuilder] Flushing resolved configuration data in Binary store in /private/var/folders/t2/khg1_tss7xdfnlx8dt37ctnm0000gp/T/gradle8979807312677144269.bin. Wrote root 2.
14:23:36.637 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Resolve dependencies of :mylib:kapt'
14:23:36.637 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Resolve dependencies of :mylib:kapt' completed
14:23:36.637 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Calculate task graph'
14:23:36.637 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Calculate task graph' completed
14:23:36.638 [DEBUG] [org.jetbrains.kotlin.gradle.plugin.KotlinGradleBuildServices] [KOTLIN] Disposed KotlinGradleBuildServices
14:23:36.638 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1 completed (0 worker(s) in use)
14:23:36.638 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 4: released lock on root.1
14:23:36.638 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
14:23:36.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
14:23:36.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
14:23:36.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
14:23:36.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Could not determine the dependencies of task ':mylib:kaptReleaseKotlin'.
14:23:36.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve all task dependencies for configuration ':mylib:kapt'.
14:23:36.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]    > Could not find androidx.room:room-compiler:.
14:23:36.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]      Required by:
14:23:36.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]          project :mylib

Please help me.

I have the same problem, did you find a solution?

Found the solution, you need to put a kapt platform() declaration aswell