@@ -14,17 +14,30 @@ MIS主要解决的问题是如何在一个模块内维护其对外暴露的接
14
14
buildscript {
15
15
dependencies {
16
16
...
17
- classpath 'com.eastwood.tools.plugins:mis:1.5.1 '
17
+ classpath 'com.eastwood.tools.plugins:mis:2.0.0 '
18
18
}
19
19
}
20
20
```
21
21
22
- 在模块的build.gradle中添加 ** mis插件 ** :
22
+ 在根项目的build.gradle中添加mis插件的 ** 相关配置 ** :
23
23
```
24
24
...
25
- // 需位于android和kotlin相关插件之后
25
+
26
26
apply plugin: 'mis'
27
+
28
+ mis {
29
+
30
+ compileSdkVersion 27
31
+
32
+ compileOptions {
33
+ sourceCompatibility JavaVersion.VERSION_1_8
34
+ targetCompatibility JavaVersion.VERSION_1_8
35
+ }
36
+
37
+ }
27
38
```
39
+ * compileSdkVersion 同 android { compileSdkVersion ... }
40
+ * compileOptions 同 android { compileOptions { ... } }
28
41
29
42
#### 创建 mis 目录
30
43
@@ -38,7 +51,9 @@ apply plugin: 'mis'
38
51
39
52
<img src =' https://github.com/EastWoodYang/Mis/blob/master/picture/1.png ' />
40
53
41
- #### 配置mis相对应的publication
54
+ #### 在模块目录内,创建单独的mis.gradle文件, 并在内声明mis对应的publication
55
+
56
+ mis.gradle:
42
57
```
43
58
mis {
44
59
publications {
@@ -62,17 +77,13 @@ mis {
62
77
63
78
* 在` dependencies ` 中可声明该mis Publication编译和运行时需用到的第三方库,仅支持` compileOnly ` 和` implementation ` 。如果mis文件夹下的类使用了kotlin语法,需要添加kotlin相关的依赖,比如'org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version'。
64
79
65
- #### 发布至Maven
80
+ #### 发布mis publication 至 Maven
81
+ 在根项目的build.gradle中添加mis插件的** repositories配置** :
66
82
```
67
83
mis {
68
- publications {
69
- main {
70
- groupId 'com.eastwood.demo'
71
- artifactId 'library-sdk'
72
- version '1.0.0-SNAPSHOT'
73
- ...
74
- }
75
- }
84
+
85
+ compileSdkVersion 27
86
+ ...
76
87
77
88
repositories {
78
89
maven {
86
97
...
87
98
}
88
99
```
89
- * 发布时需设置` version ` 。
90
100
91
- * 发布时内部用到的插件是 ` maven-publish ` ,其中` repositories ` 相关设置请查阅[ # Maven Publish Plugin] ( https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:repositories )
101
+ * 发布用到的插件是 ` maven-publish ` ,其中` repositories ` 相关设置请查阅[ # Maven Publish Plugin] ( https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:repositories )
92
102
93
103
** Gradle Sync** 后,打开Gradle Tasks View,选择** publishMis[ ...] PublicationToMavenRepository** 执行发布任务。
94
104
0 commit comments