ResolutionStrategy substitute replace with local project. but build error

According to the Resolution Strategy Document. I replace my dependencies implementation 'me.ryan:javalib:2.0.0-SNAPSHOT with local project :javalib using below code:

configurations.all { DefaultConfiguration defaultConfiguration ->
    defaultConfiguration.resolutionStrategy { DefaultResolutionStrategy resolutionStrategy ->
        resolutionStrategy.dependencySubstitution {
            substitute module('me.ryan:javalib') with project(':javalib')

The IDE I using is IntelliJ IDEA 2019.
After this configuration. The code work fine when I click run in menu and the function in project :javalib also return local code changed value.
But when I click assemble or other tasks like build task in IDEA tool window Gradle. An error has occurred:

Could not determine the dependencies of task ':app:compileJava'.
> Could not resolve all task dependencies for configuration ':app:compileClasspath'.
   > Could not resolve me.ryan:javalib:2.0.0-SNAPSHOT.
     Required by:
         project :app
      > Unable to find a matching configuration of project :javalib:
          - None of the consumable configurations have attributes.

The dependencies task also show failed.

compileClasspath - Compile classpath for source set 'main'.
\--- me.ryan:javalib:2.0.0-SNAPSHOT FAILED
default - Configuration for default artifacts.
\--- me.ryan:javalib:2.0.0-SNAPSHOT FAILED

Could someone explain this? Pelease.