maven 如何在Artifactory中下载/实现依赖项

bjg7j2ky  于 2023-04-20  发布在  Maven
关注(0)|答案(1)|浏览(197)

我在服务器上安装了Artifactory开源软件,并手动上传了一个Android AAR库。
在gradle文件中,我设置了如下配置。

buildscript {
    
        dependencies { classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release" }
    
        repositories {
            maven {
                credentials {
                    username = artifactory_username
                    password = artifactory_password
                }
                url "https://.../artifactory/libs-release"
            }
        }
    }
    
    allprojects{
            apply plugin: org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
            artifactory {
                resolve {
                    contextUrl = "https://.../artifactory"
                    repoKey = 'libs-global'
                    username = artifactory_username
                    password = artifactory_password
                }
            }
        }
        
    buildscript {
       repositories {
            jcenter()
       }
    
    dependencies {
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
        }
       }
    apply plugin: "com.jfrog.artifactory"

如何在android项目中下载或实现我的AAR库?

示例:

implementation 'com.google.code.gson:gson:2.8.6'
91zkwejq

91zkwejq1#

你需要像这样在build.gradle(project)文件中添加你的URL:

allprojects {
    repositories {
        ...
        maven {
            url("https://your-url.jfrog.com/more/path")
        }

        google()
        jcenter()
        ...
    }
}

然后你只需要在dependencies中添加你的dependency。

相关问题