https://github.com/bytemechanics/copysource-maven-plugin
Maven plugin to copy certain java sources into generated sources in order to reduce undesired dependencies
https://github.com/bytemechanics/copysource-maven-plugin
copy java maven plugin repackage
Last synced: about 2 months ago
JSON representation
Maven plugin to copy certain java sources into generated sources in order to reduce undesired dependencies
- Host: GitHub
- URL: https://github.com/bytemechanics/copysource-maven-plugin
- Owner: bytemechanics
- License: apache-2.0
- Created: 2018-02-11T21:22:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-08-15T17:45:38.000Z (almost 3 years ago)
- Last Synced: 2025-04-06T00:16:37.618Z (about 1 year ago)
- Topics: copy, java, maven, plugin, repackage
- Language: Java
- Homepage: https://copysource-maven-plugin.bytemechanics.org
- Size: 235 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Copy Sources maven plugin
[](https://maven-badges.herokuapp.com/maven-central/org.bytemechanics.maven/copysource-maven-plugin/badge.svg)
[](https://sonarcloud.io/dashboard/index/org.bytemechanics.maven%3Acopysource-maven-plugin)
[](https://sonarcloud.io/dashboard/index/org.bytemechanics.maven%3Acopysource-maven-plugin)
[](https://opensource.org/licenses/Apache-2.0)
Maven pluguin 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**_
## Motivation
To keep the dependency hell away from your projects its important to reduce at minimum the dependencies of each library. But at te same time this can break the code reutilization 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.
## Goals
Available goals:
* copy-classes: Copy classes to generated-sources
* copy-test-classes: Copy classes to generated-test-sources
## Quick start
_**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**_
1. Add the pluguin to your pom
```xml
(...)
(...)
org.bytemechanics.maven
copysource-maven-plugin
X.X.X
(...)
(...)
```
2. Define the execution goal "copy-classes" (the phase it's not necessary, by default uses "generate-sources")
```xml
(...)
(...)
org.bytemechanics.maven
copysource-maven-plugin
X.X.X
copy-classes
(...)
(...)
```
3. Configure it with the copies that you want to do:
```xml
(...)
(...)
org.bytemechanics.maven
copysource-maven-plugin
X.X.X
copy-classes
[source-groupId]:[source-artifactId]:[source-version]
[cannonical-name-of-origin-source. Example:org.bytemechanics.commons.functional.LambdaUnchecker]
(...)
[package-segment-to-replace. Example: org.bytemechanics.commons]
[package-segment-to-replace. Example: org.bytemechanics.standalone.ignite.internal.commons]
(...)
(...)
```
(Please read our [Javadoc](https://copysource-maven-plugin/javadoc/index.html) for further information)