安装
下载
wget -P /usr/local http://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.6.0-02-unix.tar.gz
安装
# cd /usr/local
# mkdir nexus
# tar -zxvf nexus-3.6.0-02-unix.tar.gz -C nexus //解压缩到nexus文件夹(其中包含nexus-3.6.0-02和sonatype-work)
# cd nexus
# mv nexus-3.6.0-02/ nexus
配置
自定义配置虚拟机可打开 nexus.vmoptions 文件进行配置(如果Linux硬件配置比较低的话,建议修改为合适的大小,否则会出现运行崩溃的现象):
vim nexus/config/nexus.vmoptions
修改端口号
application-host=<vps 的ip>
启动
/usr/local/nexus/nexus/bin/nexus start
配置
打开 http://ip:端口/nexus/ ,初始账号 admin 密码 admin123
添加自己的仓库
增加 user
android studio 打包上传
新建一个测试 Android library moudle
peoject gradle 增加maven 仓库地址
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
repositories {
maven { url 'http://xxx.xxx.1xx.3xxx:xxxx/nexus/content/repositories/testRep/' }
}
}
}
library build.gradle 增加
apply plugin: 'maven'
apply plugin: 'signing'
def SNAPSHOT_REPOSITORY_URL = 'http://108.160.133.31:20014/nexus/content/repositories/testRep-snapshot/'
def RELEASE_REPOSITORY_URL = 'http://108.160.133.31:20014//nexus/content/repositories/testRep/'
uploadArchives {
repositories {
mavenDeployer {
pom.groupId = 'io.github.xuyushi'
pom.artifactId = 'test'
pom.version = '1.0.3'
repository(url: RELEASE_REPOSITORY_URL) {
authentication(userName:'xxxx', password: '*****')
}
snapshotRepository(url: SNAPSHOT_REPOSITORY_URL) {
authentication(userName:'xxxx', password: '****')
}
}
}
}
编译上传
../gradlw upload