# Prevent ear plugin from accessing external resources

**URL:** <https://discuss.gradle.org/t/prevent-ear-plugin-from-accessing-external-resources/24951>\
**Category:** Help/Discuss\
**Created:** [November 29, 2017, 6:02pm UTC](https://discuss.gradle.org/t/prevent-ear-plugin-from-accessing-external-resources/24951 "2017-11-29T18:02:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![petehayes](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/petehayes/32/2844_2.png) [@petehayes](https://discuss.gradle.org/u/petehayes)\
**Post date:** [November 29, 2017, 6:02pm UTC](https://discuss.gradle.org/t/prevent-ear-plugin-from-accessing-external-resources/24951/1 "2017-11-29T18:02:22Z")

</div>

We are using the ear plugin with a custom application.xml. Over the past couple days we have had a number of build failures as the dtd that our xml references links to a url that has been going up and down. We were unaware that gradle would contact this website while configuring itself.

Looking at the ear plugin code, I don’t see an obvious way of disabling this behavior. We’d prefer to not have any xml validation be performed by gradle.

I have created a sample project here : [https://github.com/petehayes/ear-xml-validation](https://github.com/petehayes/ear-xml-validation)

I changed the dtd reference to point to a bad host name and if you run ./gradlew tasks, gradle errors out with an unknown host exception.

---

<div class="post-metadata">

**Author:** ![petehayes](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/petehayes/32/2844_2.png) [@petehayes](https://discuss.gradle.org/u/petehayes)\
**Post date:** [November 29, 2017, 6:03pm UTC](https://discuss.gradle.org/t/prevent-ear-plugin-from-accessing-external-resources/24951/2 "2017-11-29T18:03:01Z")

</div>

Sorry, here is the error message

```
✔ ~/dev/ear-xml-validation [master L|✚] 
12:53 $ ./gradlew tasks

FAILURE: Build failed with an exception.

* Where:
Build file '/home/vagrant/dev/ear-xml-validation/build.gradle' line: 10

* What went wrong:
A problem occurred evaluating root project 'ear-xml-validation'.
> Failed to apply plugin [id 'org.gradle.ear']
   > java.net.UnknownHostException: nohost.sun.com

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org
```

---

<div class="post-metadata">

**Author:** ![Schalk\_Cronje](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/schalk_cronje/32/6511_2.png) [@Schalk\_Cronje](https://discuss.gradle.org/u/Schalk_Cronje)\
**Post date:** [November 30, 2017, 2:14pm UTC](https://discuss.gradle.org/t/prevent-ear-plugin-from-accessing-external-resources/24951/3 "2017-11-30T14:14:19Z")

</div>

Worthwhile raising am issue on this. FIrstly it still tries to do the validation in `--offline` mode. Secondly. it would be better it the `ear` plugin defers validation to execution time, not configuration time.

---

<div class="post-metadata">

**Author:** ![petehayes](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/petehayes/32/2844_2.png) [@petehayes](https://discuss.gradle.org/u/petehayes)\
**Post date:** [November 30, 2017, 9:24pm UTC](https://discuss.gradle.org/t/prevent-ear-plugin-from-accessing-external-resources/24951/4 "2017-11-30T21:24:54Z")

</div>

Thanks. Opened [https://github.com/gradle/gradle/issues/3677](https://github.com/gradle/gradle/issues/3677)
