Swagger-api with dropwizard.io 0.9.1

I am trying to configure swagger using dropwizard 0.9.1 framework.

In my pom.xml:

<dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jersey2-jaxrs</artifactId> <version>1.5.4</version> <scope>compile</scope> <exclusions> <exclusion> <groupId>com.sun.jersey</groupId> <artifactId>*</artifactId> </exclusion> </exclusions> </dependency> 

but a java.lang.NoClassDefFoundError: jersey/repackaged/com/google/common/collect/ImmutableMap .

What's wrong?

The solution is to set the correct exceptions in the dependency section:

  <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jersey2-jaxrs</artifactId> <version>1.5.4</version> <scope>compile</scope> <exclusions> <exclusion> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet</artifactId> </exclusion> <exclusion> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet-core</artifactId> </exclusion> </exclusions> </dependency> 
+5
source share

Source: https://habr.com/ru/post/1235791/


All Articles