Open megaurko opened 5 years ago
I'll try and provide a detailed answer in case someone else gets across this issue.
The authentication flow has changed requiring an username and app password to be passed. You can do it either using pre-emptive or with http headers.
I don't know your setup but I prefer using an init.gradle file in my .gradle user folder. Which means you don't include any information in your project to accidentally commit. So inside the build.gradle file I only need to have the dependency as if it was from the public maven.
The following two examples I used @ to describe user input. Using pre-emptive:
allprojects {
repositories {
mavenLocal()
maven {
url 'https://api.bitbucket.org/2.0/repositories/@bitbucket-username@/@repository-name@/src/releases'
credentials {
username "@username@"
password "@app-password@"
}
authentication {
basic(BasicAuthentication)
}
}
}
}
I personally like to encode it beforehand, using header authentication.
allprojects {
repositories {
mavenLocal()
maven {
url "https://api.bitbucket.org/2.0/repositories/@bitbucket-username@/@repository-name@/src/releases"
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = "Basic @EncodedUsernameAndAppPassword@"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
excuse me Is this problem solved?
Hey guys look this tuto.. I fixed with this in a private repo
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() }
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.36"
}
}
Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream())
def USERNAME = properties.getProperty('USERNAME') def PASSWORD = properties.getProperty('PASSWORD')
allprojects { repositories { google() mavenCentral()
maven {
url "https://api.bitbucket.org/2.0/repositories/" + COMPANY + "/" + REPOSITORY_NAME + "/src/releases"
credentials {
username USERNAME
password PASSWORD
}
authentication {
basic(BasicAuthentication)
}
}
}
}
task clean(type: Delete) { delete rootProject.buildDir }
I have a private bitbucket repository which I'm deploying artifacts to with wagon-git. When I'm trying to consume the artifact in my android project I get this:
I have tried using both v1 and v2 bitbucket API URL format but no luck.