环境: gradle版本:8.7
在项目的setting.gradle中配置我们的Maven地址
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven {
url = uri("http://xxxxxxxx/repository/maven-releases/")
credentials {
username = "xxxx"
password = "xxx"
}
isAllowInsecureProtocol = true
}
}
由于我们的Maven服务器是http,而gradle7.0以后默认不支持http,只支持https请求,所以需要单独给我们的Maven配置一下,允许http请求,对应配置项:
isAllowInsecureProtocol = true
如果我们的Maven项目没有配置账号密码,那么上述配置中的credentials则不需要,否则需要配置为你的Nexus上的账号密码。
URL从Nexus下方获取:
注意在module或APP中引入时候,要显示的指定文件的类型,否则可能会出现找不到文件的问题。如下方那个指定了aar
implementation("com.xxx.common:thirdpart.sss:2.6.1@aar")