# Using jersey-client and https in custom task

**URL:** <https://discuss.gradle.org/t/using-jersey-client-and-https-in-custom-task/8707>\
**Category:** Help/Discuss\
**Created:** [April 7, 2015, 9:18pm UTC](https://discuss.gradle.org/t/using-jersey-client-and-https-in-custom-task/8707 "2015-04-07T21:18:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkubec](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@mkubec](https://discuss.gradle.org/u/mkubec)\
**Post date:** [April 7, 2015, 9:18pm UTC](https://discuss.gradle.org/t/using-jersey-client-and-https-in-custom-task/8707/1 "2015-04-07T21:18:01Z")

</div>

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?

Thanks

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [April 8, 2015, 12:09am UTC](https://discuss.gradle.org/t/using-jersey-client-and-https-in-custom-task/8707/2 "2015-04-08T00:09:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mkubec](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@mkubec](https://discuss.gradle.org/u/mkubec)\
**Post date:** [April 8, 2015, 7:48am UTC](https://discuss.gradle.org/t/using-jersey-client-and-https-in-custom-task/8707/3 "2015-04-08T07:48:03Z")

</div>

Yes, they load exactly the same file.

---

<div class="post-metadata">

**Author:** ![mkubec](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@mkubec](https://discuss.gradle.org/u/mkubec)\
**Post date:** [April 8, 2015, 9:00am UTC](https://discuss.gradle.org/t/using-jersey-client-and-https-in-custom-task/8707/4 "2015-04-08T09:00:25Z")

</div>

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.
