Dependency for standalone plugin is not used

plugins

(Rolf Krüger) #1

Hi,

env: gradle wrapper v. 4.2.1.

we have a standalone gradle plugin which needs to use org.apache.httpcomponents:httpclient:4.5.+
This dependency is, of course, defined in the plugin’s gradle. Running unit tests works fine

Now we are trying to run the plugin in a subproject of another gradle project. Also the httpclient dependency is defined in the subprojects dependencies but it is not used at all, because we always receive a
java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory.getDefaultHostnameVerifier()Ljavax/net/ssl/HostnameVerifier;
which clearly shows that some httpclient version < 4.4 is used (in fact we have seen that it is 4.3.5 which is downloaded to the gradle cache - most probably gradle’s “own” httpclient?!?).
We have tried all possibilities to define the dependency, but could not solve the problem. Do you have any suggestions?

thx in advance


(Schalk Cronjé) #2

I suspect that your plugin might be dependent on 4.5, but when the other project runs it uses the cnfiguration in the project, nit your plugins classpath.

  • Possibly your plugin is not injecting the 4.5 dependency into the correct configuration when it is applied.
  • Maybe your are injecting it as a default dependency and that gets overwritten.

Start by running ./gradlew dependencies on the other project to see what depdencies are resolved per configuration.