Using jersey-client and https in custom task

I have custom taks for uploading an artifact to private repository via REST API using https and jersey-client library. The code is using HttpsProperties to configure Jersey Client, when SSL truststore is loaded to initiate TrustManagerFactory. If I run this code as regular Java Application is works OK, the strange thing happens when I run the exact same code as custom Gradle task - then the https communication cannot be established and I get “PKIX path building failed: … unable to find valid certification path to requested target” error. The custom task extends DefaultTask and task action is annotated with @TaskAction.

The https communication part is Java code, the custom task is Groovy code.

Is there something special about custom Gradle tasks regarding to loading trustores/keystores? Or handling keystores in general?


Nothing intentionally specific. Are the app and the build store sharing the same keystore?

Yes, they load exactly the same file.

The problem was system wide Gradle settings with http/https proxy definitions. I commented out those properties and https communication is running like a charm.