Prevent ear plugin from accessing external resources


(Peter Hayes) #1

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

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.


(Peter Hayes) #2

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

(Schalk Cronjé) #3

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.


(Peter Hayes) #4

Thanks. Opened https://github.com/gradle/gradle/issues/3677