Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger-core Scala dependencies excessive size #624

Closed
raspacorp opened this issue Jul 17, 2014 · 8 comments
Closed

Swagger-core Scala dependencies excessive size #624

raspacorp opened this issue Jul 17, 2014 · 8 comments

Comments

@raspacorp
Copy link

Before adding swagger tool my war file was 8.7 MB, after adding swagger now it is 39MB. My manager will complain about that, do you have a minified version or something?

It seems that the scala dependencies are the bigger ones: scala-compiler, scala-reflect, scala-library, jackson-module-scala.

I am using swagger-jersey2-jaxrs_2.10 via maven, as I am not using scala in my project should I exclude those jars? I don't know if that would break something.

@webron
Copy link
Contributor

webron commented Jul 17, 2014

@raspacorp - swagger-core is written almost exclusively in scala (except for the annotations), so removing the scala dependencies will pretty much break everything.

Currently, there's not much you can do (unless you have several WAR files in which case you can install some dependencies on your application server directly). Actually, even if you have a single WAR, you can deploy these dependencies as part of your environment build-up rather than your WAR (depending on the way you work).

Future (major) versions of swagger-core may migrate completely to Java and remove the scala dependencies, however, no date can be given as to when.

@raspacorp
Copy link
Author

I was able to remove some dependencies and reduced almost 19MB of size, so far the api-docs is working fine, however I will keep testing. This is the dependency with the exclusions (scalap has transitive dependencies so when removed it also removes scala-compiler and scala-reflect):

    <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>

@raspacorp
Copy link
Author

Almost one month using it with removed dependencies and everything seems to work well, with a small API with 20 operations with GET, PUT, POST and DELETE methods. I will close the issue.

@phraktle
Copy link

Hi @raspacorp,

Please re-open this ticket. The library should be migrated to pure java – pulling in an entire Scala compiler etc is clearly excessive...

Thanks,
Viktor

@webron
Copy link
Contributor

webron commented Aug 20, 2015

@phraktle - the only scala dependencies are for testing. It has zero effect on the compiled output. No need to reopen it.

@phraktle
Copy link

Hi @webron,

Based on the dependency graph below, there are still scala dependencies in the released modules. Or am I using some outdated version?

Thanks,
Viktor

+--- com.wordnik:swagger-jersey2-jaxrs_2.11:1.3.12
|    +--- com.wordnik:swagger-jaxrs_2.11:1.3.12
|    |    +--- org.scala-lang:scala-library:2.11.1
|    |    +--- com.wordnik:swagger-core_2.11:1.3.12
|    |    |    +--- org.slf4j:slf4j-api:1.6.3 -> 1.7.7
|    |    |    +--- com.fasterxml.jackson.module:jackson-module-scala_2.11:2.4.1
|    |    |    |    +--- org.scala-lang:scala-library:2.11.1
|    |    |    |    +--- org.scala-lang:scala-reflect:2.11.1
|    |    |    |    |    \--- org.scala-lang:scala-library:2.11.1
|    |    |    |    +--- com.fasterxml.jackson.core:jackson-core:2.4.1 -> 2.6.1
|    |    |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.4.1 -> 2.6.1
|    |    |    |    +--- com.fasterxml.jackson.core:jackson-databind:2.4.1.1 -> 2.6.1 (*)
|    |    |    |    +--- com.thoughtworks.paranamer:paranamer:2.6
|    |    |    |    +--- com.google.code.findbugs:jsr305:2.0.1
|    |    |    |    \--- com.google.guava:guava:15.0 -> 18.0
|    |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.4.1 -> 2.6.1
|    |    |    +--- com.fasterxml.jackson.module:jackson-module-jsonSchema:2.4.1
|    |    |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.4.0 -> 2.6.1
|    |    |    |    +--- com.fasterxml.jackson.core:jackson-core:2.4.1 -> 2.6.1
|    |    |    |    \--- com.fasterxml.jackson.core:jackson-databind:2.4.1 -> 2.6.1 (*)
|    |    |    +--- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.4.1 -> 2.5.4 (*)
|    |    |    +--- com.wordnik:swagger-annotations:1.3.12
|    |    |    +--- org.json4s:json4s-ext_2.11:3.2.11
|    |    |    |    +--- org.scala-lang:scala-library:2.11.0 -> 2.11.1
|    |    |    |    +--- joda-time:joda-time:2.3
|    |    |    |    \--- org.joda:joda-convert:1.6
|    |    |    +--- org.json4s:json4s-native_2.11:3.2.11
|    |    |    |    +--- org.scala-lang:scala-library:2.11.0 -> 2.11.1
|    |    |    |    \--- org.json4s:json4s-core_2.11:3.2.11
|    |    |    |         +--- org.scala-lang:scala-library:2.11.0 -> 2.11.1
|    |    |    |         +--- org.json4s:json4s-ast_2.11:3.2.11
|    |    |    |         |    \--- org.scala-lang:scala-library:2.11.0 -> 2.11.1
|    |    |    |         +--- com.thoughtworks.paranamer:paranamer:2.6
|    |    |    |         \--- org.scala-lang:scalap:2.11.0
|    |    |    |              \--- org.scala-lang:scala-compiler:2.11.0
|    |    |    |                   +--- org.scala-lang:scala-library:2.11.0 -> 2.11.1
|    |    |    |                   +--- org.scala-lang:scala-reflect:2.11.0 -> 2.11.1 (*)
|    |    |    |                   +--- org.scala-lang.modules:scala-xml_2.11:1.0.1
|    |    |    |                   |    \--- org.scala-lang:scala-library:2.11.0 -> 2.11.1
|    |    |    |                   \--- org.scala-lang.modules:scala-parser-combinators_2.11:1.0.1
|    |    |    |                        \--- org.scala-lang:scala-library:2.11.0 -> 2.11.1
|    |    |    \--- org.json4s:json4s-jackson_2.11:3.2.11
|    |    |         +--- org.scala-lang:scala-library:2.11.0 -> 2.11.1
|    |    |         +--- org.json4s:json4s-core_2.11:3.2.11 (*)
|    |    |         \--- com.fasterxml.jackson.core:jackson-databind:2.3.1 -> 2.6.1 (*)

@webron
Copy link
Contributor

webron commented Aug 20, 2015

Yes, that's because it's version 1.3.12 which was written in scala, not Java.

The 1.5.x versions are the Java based ones.

@phraktle
Copy link

Thanks @webron! I have missed that update due to the artifact renaming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants