Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raphimc/classtokenreplacer
Gradle plugin to replace string tokens in class files during compile time
https://github.com/raphimc/classtokenreplacer
gradle-plugin gradle-plugin-java java-bytecode
Last synced: 2 months ago
JSON representation
Gradle plugin to replace string tokens in class files during compile time
- Host: GitHub
- URL: https://github.com/raphimc/classtokenreplacer
- Owner: RaphiMC
- License: lgpl-3.0
- Created: 2023-09-05T16:49:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-22T17:31:20.000Z (8 months ago)
- Last Synced: 2024-05-22T18:38:28.943Z (8 months ago)
- Topics: gradle-plugin, gradle-plugin-java, java-bytecode
- Language: Java
- Homepage:
- Size: 129 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# ClassTokenReplacer
Gradle plugin to replace string tokens in class files during compile time.ClassTokenReplacer allows you to replace string placeholders in your code with actual values during the building process.
This can be used to replace tokens like ``${version}`` with the actual version of the project.## Releases
### Gradle
To use ClassTokenReplacer in your Gradle project you can follow the instructions on the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/net.raphimc.class-token-replacer).## Usage
The plugin extends all source sets with a new extension called ``classTokenReplacer``. This allows you to specify replacements for your source sets:
```groovy
sourceSets {
main {
classTokenReplacer {
property("\${version}", project.version)
}
}
}
```That's it! Now all compiled class files in the main source set will be scanned for the token ``${version}`` and have it replaced with the value specified in the ``property`` method.
Be careful to choose placeholders in a way where don't accidentally match some other strings in your code.## Contact
If you encounter any issues, please report them on the
[issue tracker](https://github.com/RaphiMC/ClassTokenReplacer/issues).
If you just want to talk or need help implementing ClassTokenReplacer feel free to join my
[Discord](https://discord.gg/dCzT9XHEWu).