My gradle project is down because it has some dependencies on bitbucket repo and the bitbucket v1 api was deprecated.
I've googled a lot about how to migrate to v2 but doesn't find a good solution.
The v1 api in gradle is like this:
repositories {
maven {
credentials {
username "$mavenUser"
password "$mavenPassword"
}
url "https://api.bitbucket.org/1.0/repositories/<Team>/<repo>/raw/<branch>"
}
}
repositories {
maven {
credentials {
username "$mavenUser"
password "$mavenPassword"
}
url "https://api.bitbucket.org/2.0/repositories/<Team>/<repo>/src/<branch>"
}
}
According to v2 API reference, I updated the url, and with curl -u username:password https://api.bitbucket.org/2.0/repositories/<Team>/<repo>/src/<branch>/<path>
I can get raw data, but gradle still not works and always Received status code 403 from server: Forbidden
After specify basic
authentication explicitly, gradle works as expected
repositories {
maven {
credentials {
username "$mavenUser"
password "$mavenPassword"
}
authentication {
basic(BasicAuthentication)
}
url "https://api.bitbucket.org/2.0/repositories/<Team>/<repo>/src/<branch>"
}
}
Below is gradle documentation
If no authentication schemes have been assigned to this repository, a default set of authentication schemes are used based on the repository's transport scheme.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With