Page Contents

Overview

Bintray is a fully-fledged Maven repository and works seamlessly with both the Maven and Gradle clients. Bintray adds packages as an additional layer compared to traditional Maven repositories. A package is a container for managing metadata about your Maven project and its versions and may contain a collection of artifacts with different group IDs.

You can use different clients to do the following directly with Bintray:

Tip
Use the Set Me Up button to obtain the corresponding code snippets you need to work with any of these clients.

Uploading Files

Distributing files via Bintray includes three steps: creating a version, uploading the files and publishing the files as follows:

  1. Creating a Version: Uploaded files are associated with a specific version of a package. In some cases, the upload process creates the version automatically; in other cases you need to create a target version through the Bintray UI or using the REST API.

  2. Uploading: You can upload (or deploy) your files using Maven, Gradle or cURL as described below. After uploading your files, the files have a status of "un-published". This means that in the Bintray UI they are only visible to you and can only be downloaded with your username and API Key. While your uploaded files are still "un-published", you can still discard them before anyone sees or downloads them. The Bintray UI indicates files that are un-published and provides links to publish or discard them.

  3. Publishing: Once you are ready to expose your uploaded files, you can publish them and make them visible and available to all Bintray users. Files can be published via the Bintray UI, or via the REST API, both as part of the upload, or separately. In some cases, uploading the files publishes them automatically, so you can skip this step.

Working with Maven

You can resolve artifacts from and deploy them to Bintray directly using the Maven client.

Resolving Artifacts

You can configure your Maven settings.xml file to resolve artifacts through Bintray. The example below shows a settings file that is generated by Bintray.

 <?xml version='1.0' encoding='UTF-8'?>
 <settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd' xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
 <profiles>
 	<profile>
 		<repositories>
 			<repository>
 				<snapshots>
 					<enabled>false</enabled>
 				</snapshots>
 				<id>bintray-<username>-maven</id>
 				<name>bintray</name>
 				<url>https://dl.bintray.com/jaycroaker/maven</url>
 			</repository>
 		</repositories>
 		<pluginRepositories>
 			<pluginRepository>
 				<snapshots>
 					<enabled>false</enabled>
 				</snapshots>
 				<id>bintray-<username>-maven</id>
 				<name>bintray-plugins</name>
 				<url>https://dl.bintray.com/jaycroaker/maven</url>
 			</pluginRepository>
 		</pluginRepositories>
 		<id>bintray</id>
 	</profile>
 </profiles>
 <activeProfiles>
 	<activeProfile>bintray</activeProfile>
 </activeProfiles>
 </settings>

Deploying Artifacts

To deploy artifacts using the Maven client, you first need to declare your Bintray credentials in the settings.xml file using your API key as your password (not your Bintray login password).

 <server>
     <id>bintray-[YOUR_USERNAME]-<REPOSITORY_NAME></id>
     <username>[YOUR_USERNAME]</username>
     <password>**********</password>
 </server>

Then, add the the following Distribution Management section to your project’s pom.xml file to tell Maven to deploy into this package using the credentials you configured in the previous step.

 <distributionManagement>
    <repository>
       <id>bintray-[YOUR_USERNAME]-<REPOSITORY_NAME></id>
       <name>[YOUR_USERNAME]-<REPOSITORY_NAME></name>
       <url>https://api.bintray.com/maven/[YOUR_USERNAME]/<REPOSITORY_NAME>/[PACKAGE_NAME]/;publish=1</url>
    </repository>
 </distributionManagement>

Working with Gradle

You can resolve artifacts from and deploy them to Bintray directly using Gradle.

Resolving Artifacts

To resolve Maven artifacts from your Maven repository in Bintray use the following snippet in your Gradle configuration:

 repositories {
     maven {
         url  "https://dl.bintray.com/[YOUR_USERNAME]/<REPOSITORY_NAME>"
     }
 }

Deploying Artifacts

To deploy artifacts using Gradle you need to use the Gradle Bintray Plugin. For detailed instructions, please refer to the Gradle Bintray Plugin readme file on GitHub.

Working with cURL

You can download a file directly using the following command:

 curl -L "https://dl.bintray.com/<USERNAME>/<REPOSITORY_NAME>/<FILE_PATH>" -o <FILE.EXT>

To upload a file directly use the following command:

 curl -T <FILE.EXT> -ujaycroaker:<API_KEY> https://api.bintray.com/content/<USERNAME>/<REPOSITORY_NAME>/<PACKAGE_NAME>/<VERSION_NAME>/<FILE_TARGET_PATH>

JCenter

JCenter is a one-stop-shop for Maven artifacts in Bintray. It is a large, popular, Maven repository that is managed by Bintray and is publicly available to all Bintray users.

As a Bintray user, you are able to include your public Maven packages in JCenter. As one of the most popular repositories in Bintray, this will expose your packages to many users and make them easier to find. Nevertheless, you retain ownership over your packages and are the only one who may update or modify them, and any changes you make are automatically updated in JCenter. Note that you cannot include any private packages (i.e., those hosted in a private repository) in JCenter because since all packages in JCenter must remain publicly available.

Working with JFrog Artifactory

JFrog Artifactory is also a fully-fledged Maven repository offering some unique features to optimize development with Maven. You can configure a remote repository in JFrog Artifactory to proxy any public Maven repository on Bintray as follows:

  1. From the Artifactory UI, create a remote repository and give it a name such as "maven-remote".

  2. Specify the following as the URL for your remote repository in Artifactory:
    https://dl.bintray.com/<USERNAME>/<REPOSITORY_NAME>

  3. Make sure that Handle Releases is checked and Handle Snapshots is not checked.

  4. As a best practice, we recommend including your remote repository in a virtual repository in Artifactory.

Working with Nexus

You can configure a remote repository in Nexus to proxy any public Maven repository on Bintray as follows:

  1. From the Nexus UI, create a new remote repository and give it a name such as "maven-remote".

  2. Specify the following as the "remote storage location" for your remote repository in Nexus:
    https://dl.bintray.com/<USERNAME>/<REPOSITORY_NAME>

  3. Make sure that "Repository Policy" is set to "Release".

  4. As a best practice, we recommend including your remote repository in a repository group.