Gradle offline does not use artifact from mavenLocal

Based on the response from my stackoverflow question,

I’m writing a gradle plugin and using it in another build.gradle file. When I run:

gradle --offline publishToMavenLocal

it publishes the artifact to my local maven repository. But when I then do

gradle --offline tasks

to print the tasks, it fails as it could not resolve my plugin. Only when I remove --offlin option, I’m able to see the tasks (i.e, load the plugin)

Why is it that for publishing --offline successfully publishes to local repository, whereas does not consider mavenLocal() when resolving the dependencies?

I tried this with 1.11 version; Will try with 2.0 and update the issue accordingly