From d2111b7c6c5d1772cbabe0641bbe89a486370452 Mon Sep 17 00:00:00 2001 From: alice52 Date: Tue, 31 Jan 2023 12:09:57 +0800 Subject: [PATCH] feat(custom/test): add kotlin module --- custom-test/custom-kotlin/pom.xml | 135 ++++++++++++++++++ .../main/java/common/kotlin/JavaUsage.java | 16 +++ .../main/java/common/kotlin/ManualPojo.java | 21 +++ .../src/main/java/common/kotlin/SomeData.java | 11 ++ .../java/common/kotlin/SomeKotlinClass.kt | 24 ++++ .../src/main/java/common/kotlin/SomePojo.java | 18 +++ .../src/main/resources/logback-spring.xml | 2 +- custom-test/pom.xml | 1 + pom.xml | 42 +++++- 9 files changed, 268 insertions(+), 2 deletions(-) create mode 100644 custom-test/custom-kotlin/pom.xml create mode 100644 custom-test/custom-kotlin/src/main/java/common/kotlin/JavaUsage.java create mode 100644 custom-test/custom-kotlin/src/main/java/common/kotlin/ManualPojo.java create mode 100644 custom-test/custom-kotlin/src/main/java/common/kotlin/SomeData.java create mode 100644 custom-test/custom-kotlin/src/main/java/common/kotlin/SomeKotlinClass.kt create mode 100644 custom-test/custom-kotlin/src/main/java/common/kotlin/SomePojo.java diff --git a/custom-test/custom-kotlin/pom.xml b/custom-test/custom-kotlin/pom.xml new file mode 100644 index 0000000..83752a5 --- /dev/null +++ b/custom-test/custom-kotlin/pom.xml @@ -0,0 +1,135 @@ + + + + + custom-test + io.github.alice52 + 0.0.1 + + 4.0.0 + + custom-kotlin + + + + false + 1.8 + 1.8.0 + official + + + + + mavenCentral + https://repo1.maven.org/maven2/ + + + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-test-junit + ${kotlin.version} + test + + + + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + lombok + + + + + compile + + compile + + + + src/main/kotlin + src/main/java + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + + + + + org.jetbrains.kotlin + kotlin-maven-lombok + ${kotlin.version} + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + default-compile + none + + + + default-testCompile + none + + + java-compile + compile + + compile + + + + java-test-compile + test-compile + + testCompile + + + + + + + + + diff --git a/custom-test/custom-kotlin/src/main/java/common/kotlin/JavaUsage.java b/custom-test/custom-kotlin/src/main/java/common/kotlin/JavaUsage.java new file mode 100644 index 0000000..4d447cf --- /dev/null +++ b/custom-test/custom-kotlin/src/main/java/common/kotlin/JavaUsage.java @@ -0,0 +1,16 @@ +package common.kotlin; + +public class JavaUsage { + + public static void main(String[] args) { + SomePojo obj = new SomePojo(); + obj.setAge(12); + boolean v = obj.isHuman(); + obj.setHuman(!v); + System.out.println(obj); + } + + public static void cycleUsage() { + new SomeKotlinClass().call(); + } +} diff --git a/custom-test/custom-kotlin/src/main/java/common/kotlin/ManualPojo.java b/custom-test/custom-kotlin/src/main/java/common/kotlin/ManualPojo.java new file mode 100644 index 0000000..67cc6c6 --- /dev/null +++ b/custom-test/custom-kotlin/src/main/java/common/kotlin/ManualPojo.java @@ -0,0 +1,21 @@ +package common.kotlin; + +import org.codehaus.commons.nullanalysis.NotNull; +import org.springframework.lang.Nullable; + +public class ManualPojo { + private Integer age; + public String getFoo() { + return null; + } + + @NotNull + public String getBar() { + return "234"; + } + + @Nullable + public Object someMethod() { + return null; + } +} diff --git a/custom-test/custom-kotlin/src/main/java/common/kotlin/SomeData.java b/custom-test/custom-kotlin/src/main/java/common/kotlin/SomeData.java new file mode 100644 index 0000000..327950f --- /dev/null +++ b/custom-test/custom-kotlin/src/main/java/common/kotlin/SomeData.java @@ -0,0 +1,11 @@ +package common.kotlin; + + +import lombok.Data; + +@Data +public class SomeData { + private String name; + private int age; + private boolean human; +} \ No newline at end of file diff --git a/custom-test/custom-kotlin/src/main/java/common/kotlin/SomeKotlinClass.kt b/custom-test/custom-kotlin/src/main/java/common/kotlin/SomeKotlinClass.kt new file mode 100644 index 0000000..ae04017 --- /dev/null +++ b/custom-test/custom-kotlin/src/main/java/common/kotlin/SomeKotlinClass.kt @@ -0,0 +1,24 @@ +package common.kotlin + +class SomeKotlinClass { + fun call() { + val ddd = SomeData() + ddd.age = 12 + println(ddd) + } + + fun main() { + println("something") + val obj = SomePojo() + obj.name = "test" + val s: String = obj.name + obj.age = 12 + val v = obj.isHuman + obj.isHuman = !v + println(obj) + + val ddd = SomeData() + + JavaUsage.cycleUsage() + } +} \ No newline at end of file diff --git a/custom-test/custom-kotlin/src/main/java/common/kotlin/SomePojo.java b/custom-test/custom-kotlin/src/main/java/common/kotlin/SomePojo.java new file mode 100644 index 0000000..8ce2f20 --- /dev/null +++ b/custom-test/custom-kotlin/src/main/java/common/kotlin/SomePojo.java @@ -0,0 +1,18 @@ +package common.kotlin; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.extern.slf4j.Slf4j; +import org.springframework.lang.NonNull; + +@Getter +@Setter +@ToString +public class SomePojo { + + @NonNull private String name; + private int age; + + private boolean human; +} diff --git a/custom-test/custom-test-log/src/main/resources/logback-spring.xml b/custom-test/custom-test-log/src/main/resources/logback-spring.xml index 2428760..4826ad4 100644 --- a/custom-test/custom-test-log/src/main/resources/logback-spring.xml +++ b/custom-test/custom-test-log/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ - + diff --git a/custom-test/pom.xml b/custom-test/pom.xml index ebed616..6caee27 100644 --- a/custom-test/pom.xml +++ b/custom-test/pom.xml @@ -23,6 +23,7 @@ custom-test-mq custom-test-log custom-test-crypt + custom-kotlin diff --git a/pom.xml b/pom.xml index 3a0364c..096bd54 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.sonatype.oss oss-parent - 7 + 9 io.github.alice52 @@ -484,6 +484,46 @@ + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring.boot.version} + + + + repackage + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin} + + ${maven.compiler.source} + ${maven.compiler.target} + + -parameters + + + + org.projectlombok + lombok + ${lombok.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + + +