Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Version 1.1.7
Grails 1.1.1
Description
When I run the code-coverage plugin with an XML report on (ie. grails test-app -coverage -xml) and NOT connected to the Internet in any way, I get the following error:
Error executing script TestApp: java.net.UnknownHostException: cobertura.sourceforge.net
gant.TargetExecutionException: java.net.UnknownHostException: cobertura.sourceforge.net
I believe this is similar to:
https://developer.atlassian.com/jira/browse/CBRT-7
It's going to the internet to parse the DTD or something.
Would it be possible to please remove reliance on Internet connection for this to run? My Hudson CI server is not connected to the internet - we install plugins manually and this is currently breaking the build.
I have a quick and dirty way to get this working - this could probably be put into a proper patch with some configuration (or even be smart enough to fall back to this). It's based on Atlassian's code - but just 1 line with the help of expando. You need to download the DTD to the local file system.
In _Events.groovy change the following in replaceClosureNamesInXmlReports()
FROM:
def parser = new XmlParser().parse(xml)
TO:
def entityResolver = { a, b ->
new org.xml.sax.InputSource(new File("./coverage-04.dtd").newInputStream())
} as org.xml.sax.EntityResolver
def parser = new XmlParser(entityResolver: entityResolver).parse(xml)