I have my maven repository with my aar file that is located there https://cloudbuild.myompany.com/nexus/content/repositories/test_kirill/com/myompany/myompany-core/2.0.0/
By the way it is private repository so when I'm logging in I should use credentials.
When I'm trying to add this to my dependencies gradle gives me error Failed to resolve
.
apply plugin: 'com.android.application'
repositories {
mavenCentral()
maven {
credentials {
username 'admin'
password '*******'
}
url 'https://cloudbuild.myompany.com/nexus/content/repositories/test_kirill/'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "ko.com.myapplication"
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile group: 'com.myompany', name: 'myompany-core', version: '2.0.0'
}
Also there is my POM file from 2.2.0 folder
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myompany</groupId>
<artifactId>myompany-core</artifactId>
<version>2.0.0</version>
<packaging>gradle</packaging>
<description>POM was created by Sonatype Nexus</description>
</project>
Gradle can consume dependencies available in the local Maven repository. Declaring this repository is beneficial for teams that publish to the local Maven repository with one project and consume the artifacts by Gradle in another project.
Short answer: yes. There's no conflict between having two independent build scripts for the same project, one in Maven and one in Gradle.
You may want to try this:
repositories {
mavenCentral()
maven {
credentials {
username 'admin'
password '*******'
}
url 'https://cloudbuild.livegenic.com/nexus/content/repositories/test_kirill/'
authentication {
basic(BasicAuthentication)
}
}
}
See this discussion for more detail: https://discuss.gradle.org/t/maven-username-password-only-works-when-embedded-in-url-for-some-servers/2542/13
The official documentation addresses this here:
https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:maven_repo
The official docs include both Groovy/Kotlin syntax and cover a range of options.
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