Gradle
Buildkite Packages provides repository support for Gradle-based packages for Java using the Maven Publish Plugin.
Once your Java (Gradle) package repository has been created, you can upload packages (generated from your application's build) to this repository by configuring your application's relevant build.gradle
file presented on your Java (Gradle) package repository's details page.
To view and copy the required build.gradle
configurations:
- Select Packages in the global navigation to access the Repositories page.
- Select your Java (Gradle) package repository on this page.
- Expand Publishing a package section and in the Using Gradle with maven-publish plugin section, use the copy icon at the top-right of the code box to copy the Gradle code snippet and paste it into the appropriate area/s of your
build.gradle
file.
These build.gradle
file configurations contain the Maven coordinates for your package (which you will need to manually configure yourself), the URL for your specific Java (Gradle) package repository in Buildkite, and authentication credentials (generated by Buildkite Packages) required to upload the package to this repository.
Publish a package
The following steps describe the process above:
-
Copy, paste and modify the following Gradle snippet in your
gradle.build
file:// You require these plugins // "java": To publish java libraries // "maven-publish": To publish to Maven repositories ["java", "maven-publish"].each { apply plugin : it } // Donwload standard plugins, e.g., maven-publish from GradlePluginPortal repositories { gradlePluginPortal() } // Define Maven repository to publish to publishing { publications { maven(MavenPublication) { // MODIFY: Define your Maven coordinates of your package groupId = "com.your_domain_name" artifactId = "your_package_name" version = "your_package_version" // Tell gradle to publish project's jar archive from components.java } } repositories { maven { // Define the Buildkite repository to publish to url "https://buildkitepackages.com/{org.slug}/{java.gradle.package.repository.name}/java/maven2/" credentials { username = "java-gradle-package-repository-credentials" password = "" } } } }
-
Publish your package:
gradle publish