Skip to content

Commit

Permalink
Add module "base"
Browse files Browse the repository at this point in the history
  • Loading branch information
ak-git committed Jun 15, 2024
1 parent 258f275 commit 6653bef
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions base/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plugins {
}
13 changes: 13 additions & 0 deletions base/src/main/java/com/ak/base/BaseUtils.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
4 changes: 4 additions & 0 deletions base/src/main/java/com/ak/base/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ParametersAreNonnullByDefault
package com.ak.base;

import javax.annotation.ParametersAreNonnullByDefault;
6 changes: 6 additions & 0 deletions base/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module com.ak.base {
requires java.logging;
requires jsr305;

exports com.ak.base;
}
11 changes: 11 additions & 0 deletions base/src/test/java/com/ak/base/BaseUtilsTest.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
4 changes: 4 additions & 0 deletions base/src/test/java/com/ak/base/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ParametersAreNonnullByDefault
package com.ak.base;

import javax.annotation.ParametersAreNonnullByDefault;
4 changes: 4 additions & 0 deletions hello/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ sonar {
}
}

dependencies {
implementation project(":base")
}

application {
mainModule = 'com.ak.app'
mainClass = 'com.ak.app.MainApp'
Expand Down
4 changes: 3 additions & 1 deletion hello/src/main/java/com/ak/app/MainApp.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.ak.app;

import com.ak.base.BaseUtils;

import java.util.logging.Logger;

public class MainApp {
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!"));
}
}
2 changes: 2 additions & 0 deletions hello/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
requires java.logging;
requires jsr305;

requires com.ak.base;

exports com.ak.app;
}
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ dependencyResolutionManagement {
}

rootProject.name = 'SimpleApp'
include 'hello'
include 'hello'
include 'base'

0 comments on commit 6653bef

Please sign in to comment.