To resolve jar conflicts in my application, I use the shaded plugin's relocation feature. It works for me, but i feel it is a hack. I would like to understand the downsides of using the relocation feature if any.
相关问题
- How to resolve Maven exec plugin: classpath too lo
- Is there a maven plugin that can diff files and ou
- Maven2: How to be sure Maven build is using a spec
- Is there a Gradle plugin equivalent of “mvn depend
- How to solve Maven Invoker API warning: Maven will
相关文章
- Liquibase - generate script without applying chang
- How can I configure the maven shade plugin to incl
- “Can not set org.eclipse.aether.spi.log.Logger” wi
- Is there still no solution for ignoring setter/get
- Maven: Read property file and copy resources
- maven-shade-plugin - Cannot find 'resource'
- Using maven 3, how to use project classpath in a p
- How to stop maven-shade-plugin from blocking java.
The main issue is that it can fail in cases where the package name is directly defined (not just imported). For example, if you are using reflection and instantiating the a class by its name (including the package name) it will generate the wrong one. Similar problems can occur when the the package is defined in a manifest (there is a transformer for that). See the plugin info for more information.
Another place where this could be an issue is with a third party dependency which uses the same dependency. Consider for example package A which is provided. If package A depends on the relocated package it will in the run time use the provided instance instead of the relocated one. This can lead to unforeseen effects.
An additional issue is that in some cases, the package may contain some initialized/static information (e.g. it downloads some info once or has some big static table). In these cases it is important to understand that there are now TWO completely separate instances of the package.