Gradle plugins that help manage Knot.x modules builds.
Distribution Plugin identifies good practices on how to create a custom Knot.x distribution. This is a set of tasks that you can use when starting a new project, regardless of whereter it is Docker-based or not.
Declare the plugins section in your build script
plugins {
id("io.knotx.distribution")
}Then point to the root directory with the Knot.x configuration, setting the knotx.conf property in gradle.properties. E.g:
knotx.conf=src/main/packaging
Now you can configure clean and build tasks with Knot.x Distribution Plugin tasks (see their descriptions below):
tasks.named("build") { finalizedBy("assembleCustomDistribution") }
tasks.named("clean") { dependsOn("cleanDistribution") }
All your custom modules can be easily configured with the dist configuration, e.g:
dependencies {
subprojects.forEach { "dist"(project(":${it.name}")) }
}
overwriteCustomFiles- copies/replaces files from the directory specified in theknotx.confproperty tobuild/out/knotx. In addition, all dependencies formdistare copied tobuild/out/lib.downloadBaseDistribution- downloads the Knot.x Stack and extracts it into thebuild/outdirectoryassembleCustomDistribution- combines the two above tasks and creates a fullKnot.xdistribution with all your custom dependencies. Distribution available in thebuild/distributiondirectory
Check the Getting Started with Knot.x Stack example project as a reference.
Check Knot.x Starter Kit as a reference.
In order to properly develop and test new version of this plugin, you will need a working project on which tests will be carried out.
When you have it prepared, add the following snippet at the beginning of the target project's settings.gradle.kts file:
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}After that, you can push the new version of knotx-gradle-plugins to your local Maven repository (via Gradle's publishToMavenLocal task),
and verify that the added functionality works as expected.