Get configurations.runtimeClasspath in jar task fail

hi, all.

in project pms:

tasks.named("jar") {
    enabled = true
    dependsOn copyLib
    archiveClassifier = 'thin'
    manifest {
        ext.libsStr = configurations.runtimeClasspath.files.collect { "lib/$" }.join(' ')
        attributes "Manifest-Version": 1.0, "Main-Class": "club.walnuts.PmsApp" \
        //,"Class-Path": libsStr

sometimes with error:

An exception occurred applying plugin request [id: '', version: '0.8.18']
> Failed to apply plugin ''.
   > Project#afterEvaluate(Closure) on project ':base-definition' cannot be executed in the current context.

and sometimes with error:

Build file '/Users/lqk/project/IdeaProjects/newbeginning2/pms/build.gradle' line: 214

A problem occurred evaluating project ':pms'.
> Could not create task ':pms:assemble'.
   > Could not create task ':pms:jar'.
      > Could not resolve all files for configuration ':pms:runtimeClasspath'.
         > Could not resolve project :base-definition.
           Required by:
               project :pms
               project :pms > project :base-data
            > Project :pms declares a dependency from configuration 'implementation' to configuration 'default' which is not declared in the descriptor for project :base-definition.

if i breakpoint at line tasks.named("jar") {, and watch configurations.runtimeClasspath, then continue it will success.

So I guess the reason is: when Configure the project pms, in the task jar’s code, the configurations.runtimeClasspath is not ready.

Question is:

  1. Which official document has explain the reason ?
  2. How to fix it?