mapbox-java
mapbox-java copied to clipboard
Unable to download from private repository with Maven
Trying to consume the latest Mapbox Java API with Maven 3.8.6 fails due to missing authorization:
[DEBUG] Repositories (dependencies): [central (https://repo1.maven.org/maven2/, default, releases+snapshots), mapbox (https://api.mapbox.com/downloads/v2/releases/maven, default, releases+snapshots)]
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://api.mapbox.com/downloads/v2/releases/maven with username=mapbox, password=***
[ERROR] Failed to execute goal on project test: Could not resolve dependencies for project test:test:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.mapbox.mapboxsdk:mapbox-sdk-services:jar:6.4.0: Failed to read artifact descriptor for com.mapbox.mapboxsdk:mapbox-sdk-services:jar:6.4.0: Could not transfer artifact com.mapbox.mapboxsdk:mapbox-sdk-services:pom:6.4.0 from/to mapbox (https://api.mapbox.com/downloads/v2/releases/maven): authentication failed for https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-sdk-services/6.4.0/mapbox-sdk-services-6.4.0.pom, status: 401 Unauthorized -> [Help 1]
I've tried to match the steps outlined for Gradle: https://docs.mapbox.com/android/maps/guides/install/
- Added the repository in the POM:
<repositories> [...] <repository> <id>mapbox</id> <name>Mapbox</name> <url>https://api.mapbox.com/downloads/v2/releases/maven</url> </repository> </repositories> - Created a private token with
Download:READpermission - Provided the token through the
~/.m2/settings.xmlfile:<settings> <servers> <server> <id>mapbox</id> <username>mapbox</username> <password>TOKEN</password> </server> </servers> </settings>
Is this a known problem with Maven? Any workaround?