本文会介绍三种开发中可用的仓库配置
1.配置需要生成仓库的module
|
|
2.发布
|
|
3.使用
经过第二个步骤会在指定的目录下生成仓库,上面我们指定了项目的根目录下的maven1234567 //这里是插件编写的使用方式 如果是module.参考第二种或者第三种使用方法【project/build.gradle】 classpath 'com.rolan.eventplugin:eventplugin:1.0.0' 【app/build.gradle】apply plugin: com.rolan.eventplugin.EventStonePlugin//需要写包名+类名
二、局域网仓库
下载Nexus3
12https://www.sonatype.com/download-oss-sonatype选择系统对应版本的maven管理运行
123456789mac:nexus.properties:配置相关属性./nexus-2.11.3-01/bin/nexus start 启动服务Windows:1.解压,选择不同操作系统对应的目录,如:nexus-2.14.8-01-bundle\nexus-2.14.8-01\bin\jsw\windows-x86-642.点击console-nexus.bat启动nexus管理
|
|
- 发布
|
|
- 使用12345678910allprojects {repositories {jcenter()maven {url 'http://localhost:8081/nexus/content/repositories/releases/'}}}implementation 'com.rolan.eventplugin:eventplugin:1.0.0'
二、发布到JCenter
注册账号
1https://bintray.com 这里要注册开发者账号 不要注册企业账号创建组织(create organizations)
|
|
创建maven仓库
12name:maven 写死maven仓库类型选择mavenadd new package
12name:eventplugin 对应后面publish里面的artifactIdversion control: 0.0.1项目配置
123456789101112classpath 'com.novoda:bintray-release:0.9'apply plugin: 'com.novoda.bintray-release'publish {userOrg = '组织ID'groupId = 'com.rolan.eventplugin'artifactId = 'eventplugin' //项目名称 上面add new package中的namepublishVersion = '1.0.2' //版本号desc = ''website = '' //项目主页,可以不写}使用
12345678910allprojects {repositories {google()jcenter()maven { url ' https://dl.bintray.com/jyblife/maven' }}}implementation 'com.rolan.eventplugin:eventplugin:1.0.0'常见错误
12341.HTTP/1.1 404 Not Found这个一般是 add new package中的name和publish中的artifactId不一致2.按build提示关掉 lint