diff --git a/.idea/gradle.xml b/.idea/gradle.xml index e29fddb..5711749 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -10,6 +10,7 @@ diff --git a/base/build.gradle b/base/build.gradle new file mode 100644 index 0000000..d18c3d3 --- /dev/null +++ b/base/build.gradle @@ -0,0 +1,2 @@ +plugins { +} \ No newline at end of file diff --git a/base/src/main/java/com/ak/base/BaseUtils.java b/base/src/main/java/com/ak/base/BaseUtils.java new file mode 100644 index 0000000..f516d5f --- /dev/null +++ b/base/src/main/java/com/ak/base/BaseUtils.java @@ -0,0 +1,13 @@ +package com.ak.base; + +import java.util.logging.Logger; + +public class BaseUtils { + private BaseUtils() { + } + + public static String calc(String s) { + Logger.getLogger(BaseUtils.class.getName()).info(() -> s); + return s.toUpperCase(); + } +} diff --git a/base/src/main/java/com/ak/base/package-info.java b/base/src/main/java/com/ak/base/package-info.java new file mode 100644 index 0000000..b8a3f6c --- /dev/null +++ b/base/src/main/java/com/ak/base/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package com.ak.base; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/base/src/main/java/module-info.java b/base/src/main/java/module-info.java new file mode 100644 index 0000000..69310df --- /dev/null +++ b/base/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module com.ak.base { + requires java.logging; + requires jsr305; + + exports com.ak.base; +} \ No newline at end of file diff --git a/base/src/test/java/com/ak/base/BaseUtilsTest.java b/base/src/test/java/com/ak/base/BaseUtilsTest.java new file mode 100644 index 0000000..3ac678c --- /dev/null +++ b/base/src/test/java/com/ak/base/BaseUtilsTest.java @@ -0,0 +1,11 @@ +package com.ak.base; + +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +class BaseUtilsTest { + @Test + void testCalc() { + Assertions.assertThat(BaseUtils.calc("aBc")).isEqualTo("ABC"); + } +} \ No newline at end of file diff --git a/base/src/test/java/com/ak/base/package-info.java b/base/src/test/java/com/ak/base/package-info.java new file mode 100644 index 0000000..b8a3f6c --- /dev/null +++ b/base/src/test/java/com/ak/base/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package com.ak.base; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/hello/build.gradle b/hello/build.gradle index 4d1cc33..19903c5 100644 --- a/hello/build.gradle +++ b/hello/build.gradle @@ -13,6 +13,10 @@ sonar { } } +dependencies { + implementation project(":base") +} + application { mainModule = 'com.ak.app' mainClass = 'com.ak.app.MainApp' diff --git a/hello/src/main/java/com/ak/app/MainApp.java b/hello/src/main/java/com/ak/app/MainApp.java index 777d6ac..802901d 100644 --- a/hello/src/main/java/com/ak/app/MainApp.java +++ b/hello/src/main/java/com/ak/app/MainApp.java @@ -1,5 +1,7 @@ package com.ak.app; +import com.ak.base.BaseUtils; + import java.util.logging.Logger; public class MainApp { @@ -7,6 +9,6 @@ private MainApp() { } public static void main(String[] args) { - Logger.getLogger(MainApp.class.getName()).info(() -> "Hello word 2024.06.12!"); + Logger.getLogger(MainApp.class.getName()).info(() -> BaseUtils.calc("Hello word 2024.06.12!")); } } diff --git a/hello/src/main/java/module-info.java b/hello/src/main/java/module-info.java index 653f402..008c3ac 100644 --- a/hello/src/main/java/module-info.java +++ b/hello/src/main/java/module-info.java @@ -2,5 +2,7 @@ requires java.logging; requires jsr305; + requires com.ak.base; + exports com.ak.app; } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index e194d25..cf6fa85 100644 --- a/settings.gradle +++ b/settings.gradle @@ -22,4 +22,5 @@ dependencyResolutionManagement { } rootProject.name = 'SimpleApp' -include 'hello' \ No newline at end of file +include 'hello' +include 'base'