0
点赞
收藏
分享

微信扫一扫

Android jcenter 转到 maven 、Nexus公有库


目录

​​背景 ​​

​​目的​​

​​配置​​

​​成果​​

​​教程开始​​

​​配置​​

首先给大家一篇值得借鉴的配置git

​​https://github.com/KVNR/appnexus_adserver_android/blob/4bf9cd5b7f7d0362dff92edfcde8e1d10b28ac2e/sdk/build.gradle​​

然后再给大家一个值得借鉴的博客


上述东西看看就行了。真学技术还得看看你安哥哥的。。。

背景 

Jcenter倒闭。之前的Jcenter项目转移到Nexus

目的

将库发布到:​​Nexus Repository Manager​​

配置

首先要进行一些上面博得常规配置。虽然不知道有用没用。别人博客整了。。我也整了

成果

//这就上传到了临时仓库。。没用完成真的上传不过对我而言已经很不错了。。。

父级别  build.gradle下面 的buildscript 中和 allprojects-》repositories

引用

maven {
url "https://oss.sonatype.org/service/local/repositories/comanguomob-1000/content/"
}

 app module的 build.gradle中引用

implementation 'com.anguomob:total:4.0.7'

教程开始

配置

父目录新建文件 

maven-publish-snatype.gradle

内容如下

apply plugin: "maven"

def username = 【https://oss.sonatype.org login username】
def pwd = 【https://oss.sonatype.org login pwd】
def nexusRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"

def VERSION_NAME = '4.0.7'
def ARTIFACT_ID = 'total'
def GROUP_ID = 'com.anguomob'

//仓库位置 https://oss.sonatype.org/index.html#view-repositories;comanguomob-1000~browsestorage~com.
uploadArchives {
repositories {
mavenDeployer {
repository(url: nexusRepositoryUrl) {
authentication(userName: username, password: pwd)
}
pom.project {
artifactId ARTIFACT_ID
version VERSION_NAME
groupId GROUP_ID
packaging 'aar'
description '多语言'
name "Total"
url "https://wiki.appnexus.com/display/sdk/Mobile+SDKs?src=search#MobileSDKs-Android"
scm {
connection "scm:git:git@github.com:appnexus/mobile-sdk-android.git"
developerConnection "scm:git:git@github.com:appnexus/mobile-sdk-android.git"
url "git@github.com:appnexus/mobile-sdk-android.git"
}
licenses {
license {
name "The Apache License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
name "anguo"
email "anguomob@163.com"
organizationUrl "https://www.anguomob.com/"
}
}
}
}
}
}

def username = 【https://oss.sonatype.org login username】
def pwd = 【https://oss.sonatype.org login pwd】
def nexusRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"

def VERSION_NAME = '4.0.7'
def ARTIFACT_ID = 'total'
def GROUP_ID = 'com.anguomob'

username 和pwd要配置好了哦  不好可不行。nexusRepositoryUrl 我配置的都是别人的仓库。。我也不明白为啥就上传好了。下面的很多配置也都是用的别人的 可能校验没有那么严格吧

引用上面文件

apply from: '../maven-publish-snatype.gradle'

Android jcenter 转到 maven 、Nexus公有库_maven

 然后在侧边栏执行gradle脚本双击即可执行

Android jcenter 转到 maven 、Nexus公有库_github_02

然后点击这里就行了

点击后你会发现。。哎还需要进后台点一个东西

后台地址:​​Nexus Repository Manager​​

登录后点击这里

Android jcenter 转到 maven 、Nexus公有库_android_03

选中后点击close即可 没错就是选中关闭。。。然后会给你发送一个邮件说你代码没有bug什么的

Android jcenter 转到 maven 、Nexus公有库_git_04

到此就配置结束了。非常简单

这只是配置到临时仓库。。还没到真正的仓库上。不过如果是自己们用也完全足够了嗷呜

举报

相关推荐

0 条评论