Skip to content

Shadow jar copies whole springframework and javax in web module #491

@gavlyukovskiy

Description

@gavlyukovskiy

I tried to build web module from sources and found out that the jar contains whole springframework and javax which leads to class collision and makes it impossible to run on newer versions of spring and/or javax - there is NoSuchField or NoSuchMethod and application don't start.

Please reconsider your usage of repackaging libraries, while it gives some benefits for mostly utility libraries that may break backward compatibility (e.g. Guava), it just won't work if you try to expose some of the code to the user. For example repackaging javax.annotations into com.microsoft.applicationinsights.core.dependencies.javaxannotation in core module is meaningless because usage of com.microsoft.applicationinsights.core.dependencies.javaxannotation.PostConstruct is not the same as javax.annotation.PostConstruct, it is not specified and won't be taken into account by any application server. Same applies on extending javax.servlet.Filter - if you do repackage of javax this filter won't be longer accepted by servlet engine.

As well it is very unusual (correct me if I'm wrong) to use shadow jar in libraries. Thus I'd recommend to reduce (or even remove) usage of shadow jar and include only libraries for which it is strongly justified. Personally I wouldn't repackage apache commons/httpclient because they cares about backward compatibility. As well sometimes we enable debug logging for package org.apache.http.client to see all outgoing request information and it would be an interesting finding that we also had to enable debug logging for com.microsoft.applicationinsights.core.dependencies.http.client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions