-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Maven plugin to copy and repackage sources to reduce library dependencies
IMPORTANT NOTE: We strongly recommends to use this plugin only for libraries, for final projects if you want to build a uber-jar Maven already has it's shade plugin that works perfectly
Available goals:
- copy-classes: Copy classes to generated-sources (See Getting Started)
- copy-test-classes: Copy classes to generated-test-sources (See How to: Copy classes for test only)
Copy-source works repackaging source classes and adding as generated-sources, this approach simplifies the plugin source and allow to see the source classes to the developer, but at the same time has some drawbacks:
- Can not import classes from libraries that doesn't publish the source-code
- Can not import classes from libraries that uses classifiers (source code is stored in Maven repository with "source" classifier, therefore it's if classifier is used by library it's impossible to know which version correspond the source)
To keep the dependency hell away from your projects its important to reduce at minimum the dependencies of each library. But at the same time this can break the code re-utilization principle, to avoid this flag the solution comes by copying the source code and repackaging in order to avoid collisions. But this is only necessary when you need ONLY some specific classes, if you need the full library then you should add it as dependency.