Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.vkuzel:Quantum-Leap-Gradle-Plugin:2.5.6-1'
}
dependencies {
implementation("com.github.vkuzel:Quantum-Leap-Gradle-Plugin:2.5.6-1")
}
<dependency>
<groupId>com.github.vkuzel</groupId>
<artifactId>Quantum-Leap-Gradle-Plugin</artifactId>
<version>2.5.6-1</version>
</dependency>
libraryDependencies += "com.github.vkuzel" % "Quantum-Leap-Gradle-Plugin" % "2.5.6-1"
:dependencies [[com.github.vkuzel/Quantum-Leap-Gradle-Plugin "2.5.6-1"]]
Gradle build plugin for the Quantum Leap project, so the project's build scripts can be smaller and cleaner. Probably its not useful for anything else except for Quantum Leap, but you can check it out and get some inspiration from it.
Quantum Leap is a project template for building Java multi-module web applications backed by Spring Boot, jOOQ, Thymeleaf and PostgreSQL. The plugin expects following project structure.
root project <-- Here's applied the plugin
|
+--- core module <-- Module that contains main class annotated by @SpringBootProject annotation. Name of the module has to be "core".
|
\--- some other modules
generateJooqDomainObjects task, generates jOOQ domain objects to src/generated/java directories.
CREATE SCHEMA statement from scripts in src/resources/db/scripts and domain objects are generated into the module.db/jooq-generator-configuration.xml file located in resources of modules.config/application-default.properties properties file, also located in resources.
Following properties are recognized:
discoverProjectDependencies task. It discovers dependencies between project's modules and serializes this structure into projectDependencies.ser files and puts those into resources directory of every module.
Structure is used in Quantum Leap project to sort resources loaded from various modules, etc.The plugin uses new Gradle plugins DSL to avoid some problems connected to a Kotlin build scripts, and an old way of apply plugins.
Add the plugin repository to your project's settings.gradle.kts file.
pluginManagement {
repositories {
mavenCentral()
maven(url = "https://jitpack.io")
}
}
Apply the plugin to your root module build.gradle.kts.
plugins {
id("com.github.vkuzel.Quantum-Leap-Gradle-Plugin") version "2.5.6-1"
}
Optionally specify location of a main class in a module that contains it.
ext {
// Parameter mainClass allows you to set Spring Boot's main class
// explicitly and to suppress *MainClassName tasks. Usually should be set
// in the module where @SpringBootApplication is located.
mainClass = "your.class.Name"
}
In the root project run the generateModuleDependencies task to generate and store module dependencies to resources files.
gradle generateModuleDependencies
Run the generateJooqDomainObjects task to generate domain objects from the database schema. Generated classes will be stored in src/generated/java directory.
gradle generateJooqDomainObjects
Start the application.
gradle bootRun
Build the plugin into your local Maven repository.
./gradlew publishToMavenLocal
Configure your project to use the plugin located in the local Maven repository.
// settings.gradle.kts
pluginManagement {
repositories {
mavenLocal()
}
}
// build.gradle.kts
plugins {
id("com.github.vkuzel.Quantum-Leap-Gradle-Plugin") version "correct version"
}