Use Dropbox to Host a Maven Repository

There are many Maven repository hosts that offer a free service if the project is open source software (OSS) such as Sonatype Nexus and JFrog Bintray.

There are times where privacy is required, such as commercial or experimental code, however the price to host such projects is not viable.

This is a guide to setup Maven public hosting of dependencies from a Dropbox account.

WARNING: This will not make the Maven repository private, but it can only be accessed if the URL is known.

1. Download the Dropbox desktop client.

2. Create a new directory in the Public folder that will store the Maven artifacts, e.g. dropbox-mvn-repo.

NOTE: Replace all instances of REPOSITORY with the Maven repository folder name on Dropbox.

3. Perform a Maven Deploy from the command-line.

mvn deploy -DskipTests=true -DaltDeploymentRepository=dropbox::default::file:///C:/Dropbox/Public/REPOSITORY

or add the distributionManagement into pom.xml file.

<distributionManagement>
    <repository>
        <id>dropbox-mvn-repo</id>
        <url>file:///C:/Dropbox/Public/REPOSITORY</url>
    </repository>
</distributionManagement>

4. Navigate to Dropbox online and view the repository folder, click the Share button to view the Public URL address.

https://www.dropbox.com/sh/3jytlz6txqpqw9v/EFETRxY-t2KLud1w29tyheATRS?dl=0

5. Copy the URL into the pom.xml of the project that requires this dependency. Ensure that the id, name and url are updated as necessary.

<repositories>
    <repository>
        <id>dropbox-mvn-repo</id>
        <name>My Dropbox Repository</name>
        <url>
            https://www.dropbox.com/sh/3jytlz6txq...
        </url>
    </repository>
</repositories>

6. Perform a Maven Install to verify if the repository is working correctly.

References