Build Script ClassPath changes while using Plugins DSL

I am trying to test a gradle plugin that we developed with a test android project.
The plugin specifies org.apache.httpcomponents:httpclient:4.5.1 as a dependency.

The plugin works fine while using the conventional apply plugin syntax.

buildscript {
  repositories {
    maven {
      url ""
  dependencies {
    classpath ""

apply plugin: ""

Im able to find the required version of the httpclient in the classpath

C02T21KRG8WL-lm:ProguardUploadTest suriyasundar$ ./gradlew show | grep -i httpclient

**<-------------> 0% CONFIGURING [0s]**

**> root project > Resolve files of :classpath**


However while using the plugins DSL,

plugins {
  id "" version "1.2.0"

I am finding an older version of the httpclient (4.2.6) in the buildscript classpath

<======-------> 50% CONFIGURING [0s]
> :app

I am running into an issue when the org.apache.http.conn.ssl.SSLConnectionSocketFactory from version 4.5.1 is trying to work with the class org.apache.http.conn.ssl.AllowAllHostnameVerifier from version 4.2.6 of the httpclient dependency.

Please find the sample code in the following repo

You can find the issue in the master branch. The setting which works fine is in the branch branch-without-issue.

I want to fix this in my plugin so that the plugin can find the correct version of httpclient when used in any project.

I would really appreciate any pointers to the way plugin dependencies are handled in the new plugins DSL.
Any gradle expert advice is highly valued.