Gradle plugin that provides a task for changing the base package of your project, including updating the package declarations in your project's files.
- Java: 17 or higher
Add the plugin to any Gradle project in which you need to change the base package.
plugins {
id("io.github.pawgli.basepackage") version "0.1.5"
}
In your project's build.gradle.kts
file, assign the current base package to the basePackage
property within the basePackagePlugin
block.
basePackagePlugin {
basePackage = "io.github.pawgli"
}
Define any exclusions using glob patterns.
basePackagePlugin {
basePackage = "io.github.pawgli"
exclude("**/excludeddir/**", "**/excluded-file.txt")
}
Use the changeBasePackage
task provided by the plugin to change the package. Pass the new package as a parameter.
./gradlew :yourproject:changeBasePackage -PnewPackage=your.new.package
Alternatively, you can specify the new base package directly in your project's build.gradle.kts file
, eliminating the need to pass it as a parameter to the task.
basePackagePlugin {
basePackage = "io.github.pawgli"
newPackage = "your.new.package"
}
Feel free to experiment with the plugin in the included sample app.