Nexus3配合Gradle搭建私有仓库
来源:互联网 发布:linux怎么打开found 编辑:程序博客网 时间:2024/05/19 04:29
- 0x00 Nexus3配合Gradle搭建私有仓库
- 0x01 Nexus配置
- docker
- nexus3
- 0x02 Android Library
- 0x03 Android Demo
- 0xFF 参考
0x00 Nexus3配合Gradle搭建私有仓库
场景:将自己的代码通过gradle上传到使用nexus3搭建的私有仓库。
0x01 Nexus配置
docker
- 安装
docker
和kitmatic
安装
nexus3
kitematic
搜索nexus3
,选择Sonatype nexus3(Sonatype Nexus Repository Manager3)
配置
- 配置端口号
- 配置存储目录
nexus3
- 默认管理员:admin:admin123
修改管理员密码
依次点击:
右上角admin
>Change password
关闭匿名用户访问权限
依次点击:
顶部设置
>Administration
>Security
>Anonymous
>Allow anonymous users to access the server
创建仓库
Administration
>Repository
>Repositories
>Create repository
>maven2(hosted)
>ttdevs-releases
group
,hosted
,proxy
创建角色
Administration
>Security
>Roles
>Nexus role
uploader
nx-repository-admin-maven2-ttdevs-release-*
nx-repository-view-maven2-ttdevs-release-*
reader
nx-repository-admin-maven2-ttdevs-release-browse
nx-repository-admin-maven2-ttdevs-release-read
nx-repository-view-maven2-ttdevs-release-browse
nx-repository-view-maven2-ttdevs-release-read
创建用户
Administration
>Security
>Users
>Create user
Uploader
赋予上步创建的
uploader
权限Reader
赋予上步创建的
reader
权限
0x02 Android Library
- 创建Project:
AndroidLibrary
创建Module:
log
,编写业务和测试代码如果此处有引用第三方代码,建议不要在后面添加
@aar
!!!创建
config.gradle
ext { nexusConfig = [ repository: 'http://ttdevs.vicp.cc:9020/repository/ttdevs-releases/' ]}
修改
gradle.properties
nexusUploader=UploadernexusUploaderPwd=your_password
为了安全起见,上传的权限不放入git仓库
修改
build.gradle
,添加apply from: 'config.gradle'
创建
publish.gradle
apply plugin: 'maven'uploadArchives { configuration = configurations.archives repositories { mavenDeployer { // snapshotRepository repository(url: nexusConfig.repository) { authentication(userName: nexusUploader, password: nexusUploaderPwd) } pom.project { version project.version artifactId project.name groupId 'com.ttdevs.lib' packaging 'aar' description project.description } } } task androidSourcesJar(type: Jar) { classifier = 'sources' from android.sourceSets.main.java.sourceFiles } artifacts { archives androidSourcesJar }}
修改
log/build.gradle
ext { project.version = '0.1.0' project.description = 'ttdevs log'}apply from: getRootDir().getAbsolutePath() + '/publish.gradle'
上传
./gradlew :log:uploadArchives
➜ AndroidLibrary ./gradlew :log:uploadArchivesCould not find metadata com.ttdevs.lib:log/maven-metadata.xml in remote (http://ttdevs.vicp.cc:9020/repository/ttdevs-releases/)BUILD SUCCESSFUL in 3s26 actionable tasks: 1 executed, 25 up-to-date➜ AndroidLibrary
0x03 Android Demo
- 创建Project:
AndroidDemo
- 修改
AndroidDemo/build.gradle
...allprojects { repositories { jcenter() maven { url "http://ttdevs.vicp.cc:9020/repository/ttdevs-releases/" credentials { username 'Reader' password 'ttdevs' } } }}...
添加引用
修改
app/build.gradle
添加引用:implementation 'com.ttdevs.lib:log:0.1.0'
0xFF 参考
- 搭建私有-Sonatype-仓库
- Nexus3配合Gradle搭建私有仓库
- 使用nexus3搭建私有仓库
- 【Maven】Nexus3搭建Maven私有仓库及使用
- maven私有仓库nexus3.5搭建与使用
- Nexus3搭建Docker私有仓库并push镜像
- 使用Gradle和Sonatype Nexus 搭建私有maven仓库
- 使用Gradle和Sonatype Nexus 搭建私有maven仓库
- Nexus3搭建Maven私有库(一)
- Nexus3搭建Maven私有库(二)
- Nexus3搭建Maven私有库(三)
- Nexus3搭建Maven私有库(四)
- Nexus3搭建Maven私有库(五)
- nexus3创建maven私有仓库(安装windows版)
- nexus3创建maven私有仓库——安装windows版
- nexus3创建maven私有仓库(安装windows版)
- 私有仓库搭建
- Docker搭建私有仓库
- Docker私有仓库搭建
- Java中的String类
- 浅谈C++作用域运算符::
- ViewPager
- 哈夫曼编码效果最优的原因
- Kingdom Roadmap UVA
- Nexus3配合Gradle搭建私有仓库
- 第二章 变量和基本类型
- 手把手教你配置mac下最牛X的命令行工具:iTerm2+oh-my-zsh(2018年)
- 蓝桥杯 算法提高 分分钟的碎碎念
- 启明星第二周学习总结
- windows下如何安装和启动MySQL
- 接口自动化测试系列之PHPUnit介绍和环境搭建
- NOIP专题复习(三) 状压DP学习笔记
- C和C++区别(三)