From d7b5377d91de694213867bbe23e7f4772ab33eca Mon Sep 17 00:00:00 2001 From: tongchenfei Date: Tue, 19 Jan 2021 19:43:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=85=A7=E6=8A=84upload.gradle=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0maven=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- foudations/mogo-httpdns/build.gradle | 4 ++- foudations/mogo-httpdns/gradle.properties | 4 +++ gradle.properties | 8 ++++- gradle/upload.gradle | 43 +++++++++++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 foudations/mogo-httpdns/gradle.properties create mode 100644 gradle/upload.gradle diff --git a/foudations/mogo-httpdns/build.gradle b/foudations/mogo-httpdns/build.gradle index 7617ac7..ecdd4f9 100644 --- a/foudations/mogo-httpdns/build.gradle +++ b/foudations/mogo-httpdns/build.gradle @@ -41,4 +41,6 @@ dependencies { testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' -} \ No newline at end of file +} + +apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() \ No newline at end of file diff --git a/foudations/mogo-httpdns/gradle.properties b/foudations/mogo-httpdns/gradle.properties new file mode 100644 index 0000000..7c0f625 --- /dev/null +++ b/foudations/mogo-httpdns/gradle.properties @@ -0,0 +1,4 @@ +GROUP=com.mogo.httpdns +POM_ARTIFACT_ID=httpdns-helper +VERSION_CODE=1 +VERSION_NAME=1.0.18 \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index c52ac9b..3234342 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,4 +16,10 @@ org.gradle.jvmargs=-Xmx2048m # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true \ No newline at end of file +android.enableJetifier=true + +## maven 配置 +RELEASE_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-releases/ +SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/ +USERNAME=xintai +PASSWORD=xintai2018 \ No newline at end of file diff --git a/gradle/upload.gradle b/gradle/upload.gradle new file mode 100644 index 0000000..affad43 --- /dev/null +++ b/gradle/upload.gradle @@ -0,0 +1,43 @@ +apply plugin: 'maven' +apply plugin: 'maven-publish' + +task loggerSourcesJar(type: Jar) { + classifier = 'sources' + if (plugins.hasPlugin("java-library")) { + from sourceSets.main.java.srcDirs + } else if (plugins.hasPlugin("com.android.library")) { + from android.sourceSets.main.java.sourceFiles + } else if (plugins.hasPlugin('groovy')) { + from sourceSets.main.groovy.srcDirs + } +} + +artifacts { + archives loggerSourcesJar +} + +task loggerUpload(dependsOn: [uploadArchives, loggerSourcesJar]) { +} + +uploadArchives { + repositories { + mavenDeployer { + + println project.name + pom.project { + packaging = 'aar' + groupId = GROUP + artifactId = POM_ARTIFACT_ID + version = VERSION_NAME + } + + repository(url: rootProject.RELEASE_REPOSITORY_URL) { + authentication(userName: rootProject.USERNAME, password: rootProject.PASSWORD) + } + + snapshotRepository(url: rootProject.SNAPSHOT_REPOSITORY_URL) { + authentication(userName: rootProject.USERNAME, password: rootProject.PASSWORD) + } + } + } +}