Commit 424aa9d3 authored by 王韦's avatar 王韦

[new] 引入maven

parent 88a3f81b
...@@ -19,6 +19,9 @@ allprojects { ...@@ -19,6 +19,9 @@ allprojects {
repositories { repositories {
google() google()
jcenter() jcenter()
maven {
url 'https://hub.zmcms.cn/repository/maven-public/'
}
} }
} }
......
...@@ -19,3 +19,13 @@ android.useAndroidX=true ...@@ -19,3 +19,13 @@ android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete": # Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official kotlin.code.style=official
#-----
GROUP=com.qmai.android.sdk
POM_ARTIFACT_ID=widget
VERSION_NAME=1.1.1
SNAPSHOT_REPOSITORY_URL=https://hub.zmcms.cn/repository/maven-snapshots/
RELEASE_REPOSITORY_URL=https://hub.zmcms.cn/repository/maven-releases/
PUBLIC_REPOSITORY_URL=https://hub.zmcms.cn/repository/maven-public/
NEXUS_USERNAME=wangwei
NEXUS_PASSWORD=caihong520
\ No newline at end of file
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion 29 compileSdkVersion 29
......
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android { android {
compileSdkVersion 29 compileSdkVersion 29
...@@ -40,3 +41,69 @@ dependencies { ...@@ -40,3 +41,69 @@ dependencies {
repositories { repositories {
mavenCentral() mavenCentral()
} }
apply plugin: 'maven'
def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}
def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = VERSION_NAME
repositories {
repository {
name = 'artifactory'
url = 'https://hub.zmcms.cn/repository/maven-public/'
snapshots {
enabled = 'false'
updatePolicy = 'interval:2'
}
releases{
enabled = 'true'
updatePolicy = 'interval:2'
}
}
}
}
repository(url: RELEASE_REPOSITORY_URL) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: SNAPSHOT_REPOSITORY_URL) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
}
}
}
}
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
failOnError false
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archives androidSourcesJar
// archives androidJavadocsJar
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment