Scala Overweight Dependence

I found that after I started using the swagger documentation tool for my REST API, the size of my war file increased by almost 4.5 times - from 8.7 MB to 39 MB. I use Maven to create a project.

This is due to the large dependencies of Swagger Scala, especially the scala-compiler. So I tried to figure out which of these dependencies really is not needed. I created a new problem on the Github project page: https://github.com/wordnik/swagger-core/issues/624 They replied that it is not recommended to remove any Scala dependency, since the structure is written in this language and this can break it. It is also recommended that you place dependencies in a container / server as a workaround, rather than inside a war.

+7
java maven swagger
source share
1 answer

After doing trial and erroneous work, I found that it is possible to remove some dependencies without breaking them. While almost a month of use, the document management tool works fine. These are the dependencies removed by me:

<dependency> <groupId>com.wordnik</groupId> <artifactId>swagger-jersey2-jaxrs_2.10</artifactId> <version>${swagger-jersey.version}</version> <exclusions> <exclusion> <artifactId>jackson-module-scala_2.10</artifactId> <groupId>com.fasterxml.jackson.module</groupId> </exclusion> <exclusion> <artifactId>scalap</artifactId> <groupId>org.scala-lang</groupId> </exclusion> </exclusions> </dependency> 

This removes basically three large jars: scalap, scala-compiler and scala -reflect. This means almost 19 MB of reduced size.

I am not saying that you should not follow the advice of the Swagger developers to not remove the scala dependencies, but so far this worked for me and wanted to share it. I made my comments and closed the issue on Github: https://github.com/wordnik/swagger-core/issues/624

+9
source share

All Articles