Maven
Buildkite Packages provides repository support for Maven-based packages for Java.
Once your Java (Maven) package repository has been created, you can upload packages (generated from your application's build) to this repository by configuring your ~/.m2/settings.xml
and application's relevant pom.xml
files with the XML snippets presented on your Java (Maven) package repository's details page.
To view and copy the required ~/.m2/settings.xml
and pom.xml
configurations:
- Select Packages in the global navigation to access the Repositories page.
- Select your Java (Maven) package repository on this page.
- Expand Publishing a package section and in the Using Maven section, use the copy icon at the top-right of each respective code box to copy the relevant XML snippets and paste them into their respective files.
These file configurations contain the following:
-
~/.m2/settings.xml
: the ID for your specific Java (Maven) package repository in Buildkite and authentication credentials (generated by Buildkite Packages) required to upload the package to this repository -
pom.xml
: the reference to the required Maven plugin (to upload the package), along with the ID and URL for your specific Java (Maven) package repository in Buildkite.
Publish a package
The following steps describe the process above:
-
Copy, paste and modify the following XML snippet in your
~/.m2/settings.xml
file:// Add to '~/.m2/settings.xml' under 'settings' xml tag <servers> <server> <id>org-slug-java-maven-package-repository-name</id> <password>java-maven-package-repository-credentials</password> </server> </servers>
-
Copy, paste and modify the following XML snippet in your
pom.xml
configuration file:// pluginsRepository: maven uses this plugin to push to repository <pluginRepositories> <pluginRepository> <id>computology-maven-packagecloud-wagon</id> <url>https://packagecloud.io/computology/maven-packagecloud-wagon/maven2</url> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> // distributionManagement: 'maven deploy' pushes to this repository <distributionManagement> <repository> <id>org-slug-java-maven-package-repository-name</id> <url>https://buildkitepackages.com/{org.slug}/{java.maven.package.repository.name}</url> </repository> <snapshotRepository> <id>org-slug-java-maven-package-repository-name</id> <url>https://buildkitepackages.com/{org.slug}/{java.maven.package.repository.name}</url> </snapshotRepository> </distributionManagement>
-
Publish your package:
mvn deploy