修改maven仓库地址
allprojects {
repositories {
google()
jcenter()
// maven {
// 自定义的仓库Url
// url uri('repo') //本地
// url uri('http://192.168.12.15:8081/repository/maven-releases/')
// }
}
}
上传到maven
apply plugin: 'maven'
uploadArchives {
repositories.mavenDeployer {
//本地文件夹作为仓库
//repository(url: uri('../repo'))
//虚拟机作为仓库
repository(url: uri('http://192.168.178.128:8081/repository/maven-releases/'))
{
//账号密码
authentication(userName: "admin", password: "admin")
}
// 唯一标识
pom.groupId = "com.chow"
// 项目名称
pom.artifactId = "android.plugin"
// 版本号
pom.version = "1.0.0"
}
}
上传plugin到bintray
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
//gradlew bintrayUpload
/*library版本*/
version = "1.0.0"
///*github上的项目主页以及git仓库地址*/
def siteUrl = 'https://github.com/xxxx/chow-plugin'
def gitUrl = 'https://github.com/xxxx/chow-plugin.git'
///*maven group ID 这个gruop很重要,参考 compile 'groupId:artifactId:version' groupId就是这个,artifactId就是包名,version就是顶部那个*/
group = "com.xxxx.android"
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'jar'
/*项目描述*/
name 'a test'
url siteUrl
/*设置证书s*/
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'xxx'
name 'xxx'
email 'xxx@qq.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
//对应bintray账号上的仓库名称;发布到Bintray的那个仓库,即你在bintray网站建立的仓库名,若该仓库不存在,会报错。
name = "xxxx-plugin" //发布到JCenter仓库下的项目名字
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}
//如果需要发布,要上传源码并进行审核
//上传源码
//tasks.withType(Javadoc) {//防止编码问题
// options.addStringOption('Xdoclint:none', '-quiet')
// options.addStringOption('encoding', 'UTF-8')
// options.addStringOption('charSet', 'UTF-8')
//}
//
//task sourcesJar(type: Jar) {
// classifier = 'sources'
// from sourceSets.main.allSource
//}
//
//
//task javadocJar(type: Jar, dependsOn: javadoc) {
// classifier = 'javadoc'
// from javadoc.destinationDir
//}
//
//artifacts {
// archives javadocJar
// archives sourcesJar
//}
上传arr到bintray
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
/*library版本*/
version = "1.0.0"
/*github上的项目主页以及git仓库地址*/
def siteUrl = 'https://github.com/xxx/xxxx-sdk'
def gitUrl = 'https://github.com/xxx/xxxx-sdk.git'
/*maven group ID 这个gruop很重要,参考 compile 'groupId:artifactId:version' groupId就是这个,artifactId就是包名,version就是顶部那个*/
group = "com.chow.android"
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
/*项目描述*/
name 'xxx arr'
url siteUrl
/*设置证书s*/
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'xxxx'
name 'xxxxx'
email 'xxx@qq.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
//对应bintray账号上的仓库名称;发布到Bintray的那个仓库,即你在bintray网站建立的仓库名,若该仓库不存在,会报错。
name = "xxx-xxxx" //发布到JCenter仓库下的项目名字
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}
//上传源码
//tasks.withType(Javadoc) {//防止编码问题
// options.addStringOption('Xdoclint:none', '-quiet')
// options.addStringOption('encoding', 'UTF-8')
// options.addStringOption('charSet', 'UTF-8')
//}
//
//task sourcesJar(type: Jar) {
// from android.sourceSets.main.java.srcDirs
// classifier = 'sources'
//}
//
//task javadoc(type: Javadoc) {
// source = android.sourceSets.main.java.srcDirs
// classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
//}
//
//task javadocJar(type: Jar, dependsOn: javadoc) {
// classifier = 'javadoc'
// from javadoc.destinationDir
//}
//
//artifacts {
// archives javadocJar
// archives sourcesJar
//}
先Install,后bintrayUpload