https://github.com/gianttreelp/proguard-services-mapper
A solution to fix obfuscated Java services after ProGuard has run.
https://github.com/gianttreelp/proguard-services-mapper
cli gradle-plugin java kotlin maven-plugin obfuscation proguard
Last synced: about 1 year ago
JSON representation
A solution to fix obfuscated Java services after ProGuard has run.
- Host: GitHub
- URL: https://github.com/gianttreelp/proguard-services-mapper
- Owner: GiantTreeLP
- License: mit
- Created: 2021-12-22T17:56:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-21T01:15:22.000Z (about 1 year ago)
- Last Synced: 2025-03-21T15:10:59.011Z (about 1 year ago)
- Topics: cli, gradle-plugin, java, kotlin, maven-plugin, obfuscation, proguard
- Language: Kotlin
- Homepage:
- Size: 305 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ProGuard Service Mapper
[](https://github.com/GiantTreeLP/proguard-services-mapper/blob/main/LICENSE)
[](https://github.com/GiantTreeLP/proguard-services-mapper/actions/workflows/maven-publish.yml)
[](https://search.maven.org/artifact/com.github.gianttreelp.proguardservicesmapper/proguard-services-mapper-common)
[](https://oss.sonatype.org/content/repositories/snapshots/com/github/gianttreelp/proguardservicesmapper/)
[](https://github.com/GiantTreeLP/proguard-services-mapper/stargazers)
This is a service mapper for the [ProGuard](https://proguard.sourceforge.io/)
Java bytecode obfuscator.
It fixes the issue that files in the `META-INF/services` directory are not renamed or adapted to the new class names.
It replaces the original Jar file with a new one that contains the renamed services.
It consists of the following modules:
* [`proguard-service-mapper`](#proguard-service-mapper):
The service mapper itself.
* [`proguard-service-mapper-cli`](#proguard-service-mapper-cli):
The command line interface.
* [`proguard-service-mapper-maven`](#proguard-service-mapper-maven):
The Maven plugin.
* [`proguard-service-mapper-gradle`](#proguard-service-mapper-gradle):
The Gradle plugin.
## ProGuard Service Mapper CLI
For convenience, the service mapper can be run from the command line. Withouth any additional arguments, it will print
help information.
### Usage
```shell
$ java -jar proguard-service-mapper-cli-.jar -i -m
```
## ProGuard Service Mapper Maven
This plugin is intended to be integrated into your Maven build process and run after
the [ProGuard Maven plugin](https://wvengen.github.io/proguard-maven-plugin/).
### Usage in Maven
```xml
com.github.gianttreelp.proguardservicesmapper
proguard-service-mapper-maven-plugin
1.2-SNAPSHOT
package
map-proguard
```
## ProGuard Service Mapper Gradle
This plugin is intended to be integrated into your Gradle build process and run after
the [ProGuard Gradle plugin](https://github.com/Guardsquare/proguard).
### Example usage in Gradle with the ProGuard Gradle plugin and the Shadow plugin
```kotlin
buildscript {
dependencies {
classpath("com.github.gianttreelp.proguardservicesmapper:proguard-services-mapper-gradle:1.2-SNAPSHOT")
}
}
register("mapServices") {
this.dependsOn("proguard")
val shadowTask = project.tasks.shadowJar.orNull ?: throw IllegalStateException("No shadow jar task found")
this.mappingFile.set(project.buildDir.resolve("mapping.txt"))
this.inputFile.set(shadowTask.outputs.files.files.single().let {
File(it.path.substringBeforeLast('.') + "-obf." + it.path.substringAfterLast('.'))
})
}
```