我正在尝试通过 gradle 脚本为 SOAP Web 服务生成类。我正在使用gradle-jaxws-plugin
maven Central 中提供的插件。
我的脚本如下所示:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "eu.schnuckelig.gradle:gradle-jaxws-plugin:1.0.2"
}
}
apply plugin: 'maven'
apply plugin: 'jaxws'
jaxws {
System.setProperty('javax.xml.accessExternalSchema', 'all')
packageName = 'com.myservice'
wsdlURL = 'https://example.org/services/users.svc?wsdl'
}
repositories {
mavenCentral()
}
如果我按原样使用此脚本,则会出现以下错误
[ant:wsimport] [ERROR] sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
我尝试过解决此错误的一种方法是gradle build -Djavax.net.ssl.trustStore=cacerts -Djavax.net.ssl.trustStorePassword=changeit
. 这行得通。但我想在构建脚本中传递这些 jvm 属性。
我试过systemProperty.set()
了,但没有用。我正在尝试gradle.properties
,但这也不起作用。有没有一种干净的方法来传递这些属性?另外我想知道当我将有一个自动构建时,我将如何在生产中处理这个问题。