Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit b2fe9b2

Browse files
tag.20201208
1 parent 2ab7228 commit b2fe9b2

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@
1111
5. 在项目根目录下执行 `./gradlew build -x test`
1212
6. 在项目根目录下执行 `./gradlew test`
1313
7. 删除 [core](./core) 下的模板代码
14+
8. 修改 [module-info.java](./core/src/main/java/module-info.java) 中的配置
1415

1516
## 更新日志
1617

18+
- **20201208**
19+
- 新增 Java 9 模块化支持
20+
- 修复在使用`maven-publish`打包时未对源码打包的问题
21+
1722
- **20201125**
1823
- 更改项目名称为 `GradleKotlinTemplate`
1924
- 添加 `maven-publish` 插件,现在可以使用 `gradlew publishToMavenLocal`

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
group = "com.github.openEDGN"
1+
group = "com.github.OpenEDGN.GradleKotlinTemplate"
22
// 你可以修改此为自己的组织地址
3-
version = "1.0"
3+
version = "last"
44
// 你可以指定此为项目 版本号
55

66
buildscript {

core/build.gradle.kts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ val compileKotlin: KotlinCompile by tasks
1010
val compileJava: JavaCompile by tasks
1111
compileJava.destinationDir = compileKotlin.destinationDir
1212

13+
java {
14+
modularity.inferModulePath.set(true)
15+
}
1316

1417
dependencies {
1518
implementation(kotlin("reflect"))
@@ -28,14 +31,18 @@ tasks.test {
2831
tasks.withType<KotlinCompile>().configureEach {
2932
kotlinOptions.jvmTarget = "11"
3033
}
31-
34+
val sourcesJar by tasks.registering(Jar::class) {
35+
archiveClassifier.set("sources")
36+
from(sourceSets.main.get().allSource)
37+
}
3238
publishing {
3339
publications {
3440
create<MavenPublication>("maven") {
3541
groupId = rootProject.group.toString()
3642
artifactId = project.name
3743
version = rootProject.version.toString()
3844
from(components["java"])
45+
artifact(sourcesJar.get())
3946
}
4047
}
4148
repositories {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module gradle.kotlin.template {
2+
requires kotlin.reflect;
3+
requires kotlin.stdlib;
4+
opens com.github.template;
5+
exports com.github.template;
6+
}

0 commit comments

Comments
 (0)