简体   繁体   中英

How should I add a dependency with Gradle / Springboot

I am a newbie with Spring / Springboot / Gradle.

I am trying to write a service, and I am getting:

Exception in thread "main" javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found
        at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:31)
        at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:28)
        at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:73)
        at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:82)
        at javax.xml.ws.spi.Provider.provider(Provider.java:66)
        at javax.xml.ws.Service.<init>(Service.java:82)
        at com.sunchain.sge.RecherchePointV20.<init>(RecherchePointV20.java:42)
        at com.sunchain.sge.DemoApplication.main(DemoApplication.java:22)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at javax.xml.ws.spi.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:60)
        at javax.xml.ws.spi.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:93)
        at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:71)
        ... 5 more

So, in this thread , I have the solution using Maven. But thing is I am using gradle for this project.

What should be the equivalent in with Gradle?

I tried:

compile('javax.xml.ws:jaxws-api')
compile('com.sun.xml.ws:rt')

inside dependencies block, but it is not working

When you want to add a dependency, you should look it up at mvnrepository.com. It will tell you how to add it to your project. Here is a link to one of the dependencies:

https://mvnrepository.com/artifact/com.sun.xml.ws/rt/2.2.10

Look under the gradle tab and ypu will find the example:

compile group: 'com.sun.xml.ws', name: 'rt', version: '2.2.10'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM