Commit 934c658eed7674a0a65c2f37e1a57bdbacc680ca

Authored by 韩亚云
1 parent e76116ff

Ar提交2

settings.gradle
1 include ':app', ':syar' 1 include ':app', ':syar'
  2 +gradle.ext {
  3 + // maven config
  4 + mavenUrl = "http://cnlive.online:8081/repository/cnlive/"
  5 + mavenDevUrl = "http://cnlive.online:8081/repository/cnlivedev/"
  6 + mavenUserName = "Granzon"
  7 + mavenPwd = "Passw0rd"
  8 +}
syar/build.gradle
1 apply plugin: 'com.android.library' 1 apply plugin: 'com.android.library'
  2 +apply from: './maven_push.gradle'
2 3
3 android { 4 android {
4 compileSdkVersion 27 5 compileSdkVersion 27
@@ -33,3 +34,8 @@ dependencies { @@ -33,3 +34,8 @@ dependencies {
33 androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 34 androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
34 compile files('libs/SyAR.jar') 35 compile files('libs/SyAR.jar')
35 } 36 }
  37 +
  38 +
  39 +
  40 +
  41 +
syar/maven_push.gradle 0 → 100644
  1 +apply plugin: 'maven'
  2 +
  3 +uploadArchives() {
  4 + repositories {
  5 + mavenDeployer {
  6 + def debug = true
  7 +
  8 + android.defaultPublishConfig debug ? "debug" : "release"
  9 +
  10 + repository(url: gradle.mavenUrl) {
  11 + authentication(userName: gradle.mavenUserName, password: gradle.mavenPwd)
  12 + }
  13 +
  14 + pom.project {
  15 + groupId 'cn.syar.demo' //包名
  16 + artifactId 'syar' //库名
  17 + version = "1.0.2"
  18 + }
  19 +
  20 + pom.whenConfigured { pom ->
  21 + //TODO POM文件目前无法区分 compile 和 implementation
  22 + List list = new ArrayList()
  23 +
  24 + pom.dependencies.findAll {
  25 + dep ->
  26 + dep.groupId == rootProject.name ||
  27 + dep.groupId == "com.android.support" ||
  28 + dep.groupId == "com.android.databinding" ||
  29 + dep.groupId == "com.android.support.constraint"
  30 + }.collect { dep -> list.add(dep) }
  31 +
  32 + pom.dependencies.removeAll(list)
  33 + }
  34 +
  35 + }
  36 + }
  37 +}
0 \ No newline at end of file 38 \ No newline at end of file