在 gradle 中添加 apche cxf-bundle 作为依赖项时出现“不支持:http://javax.xml.XMLConstants/property/accessExternalDTD 异常”

getting " Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD exception" while adding apche cxf-bundle as dependency in gradle

尝试在我的 application.But 应用程序中添加 apache-cxf 包时出现以下错误,而 运行 应用程序 实例化失败 [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]: 工厂方法 'payloadRootAnnotationMethodEndpointMapping' 抛出异常;嵌套异常是 java.lang.ExceptionInInitializerError

这是由于 原因:java.lang.IllegalArgumentException:不支持:http://javax.xml.XMLConstants/property/accessExternalDTD

尝试在任务中添加以下属性

wsdl2java {
 System.setProperty('javax.xml.accessExternalSchema', 'all')
 System.setProperty('javax.xml.accessExternalDTD','all')
 generatedWsdlDir = file("src/main/generated-sources/")  // target directory for generated source code
 wsdlsToGenerate = [   //  2d-array of wsdls and cxf-parameters
                      ['src/main/resources/xsd/wsdl/***.wsdl'],
]

}

added the dependency as 
compile group: 'org.apache.cxf', name: 'cxf-bundle', version: '2.4.2'

出现以下错误

Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping]: Factory method 'payloadRootAnnotationMethodEndpointMapping' threw exception; nested exception is java.lang.ExceptionInInitializerError

Caused by: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD
    at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:576) ~[xalan-2.7.1.jar:?]

检查依赖树时,看到 Xalan.Which 的多个版本导致依赖冲突。通过添加以下行解决错误

 compile (group: 'org.apache.cxf', name: 'cxf-bundle', version: '2.4.2')  {    
 exclude module: 'xalan'
}