gpt4 book ai didi

android - 如何将自定义maven存储库添加到gradle

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:35:31 34 4
gpt4 key购买 nike

我的 Maven 存储库和我的 aar 文件位于那里 https://cloudbuild.myompany.com/nexus/content/repositories/test_kirill/com/myompany/myompany-core/2.0.0/

顺便说一句,它是私有(private)存储库,所以当我登录时,我应该使用凭据。

当我试图将它添加到我的依赖项时,gradle 给我错误 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'
}

还有我的 2.2.0 文件夹中的 POM 文件

<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>

最佳答案

你可能想试试这个:

repositories {
mavenCentral()

maven {
credentials {
username 'admin'
password '*******'
}
url 'https://cloudbuild.livegenic.com/nexus/content/repositories/test_kirill/'
authentication {
basic(BasicAuthentication)
}
}
}

有关详细信息,请参阅此讨论: https://discuss.gradle.org/t/maven-username-password-only-works-when-embedded-in-url-for-some-servers/2542/13

关于android - 如何将自定义maven存储库添加到gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36282168/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com