From c302175f039f22edb59bb1f266da91210adbefc2 Mon Sep 17 00:00:00 2001 From: yangzhaohan Date: Mon, 22 Jun 2026 15:50:44 +0800 Subject: [PATCH] first commit --- .gitignore | 1 + README.md | 15 ++++++++++ ai/conventions.md | 30 +++++++++++++++++++ ai/module.yaml | 10 +++++++ manifest.yaml | 22 ++++++++++++++ pom.xml | 30 +++++++++++++++++++ .../com/synoth/brick/core/BrickConstants.java | 12 ++++++++ .../java/com/synoth/brick/core/model/R.java | 14 +++++++++ template/pom.xml | 30 +++++++++++++++++++ .../{{basePkgPath}}/core/BrickConstants.java | 12 ++++++++ 10 files changed, 176 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 ai/conventions.md create mode 100644 ai/module.yaml create mode 100644 manifest.yaml create mode 100644 pom.xml create mode 100644 src/main/java/com/synoth/brick/core/BrickConstants.java create mode 100644 src/main/java/com/synoth/brick/core/model/R.java create mode 100644 template/pom.xml create mode 100644 template/src/main/java/{{basePkgPath}}/core/BrickConstants.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f97022 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e176f5 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# brick-common-core + +核心基础模块 —— 提供项目级常量与公共基类,所有其他 `brick-common-*` 模块均依赖此模块。 + +## 变体 + +| 分支 | 说明 | +|------|------| +| `master` | 主分支 | + +## 使用 + +```bash +brick add core +``` diff --git a/ai/conventions.md b/ai/conventions.md new file mode 100644 index 0000000..574ae08 --- /dev/null +++ b/ai/conventions.md @@ -0,0 +1,30 @@ +# brick-common-core 编码规范 + +## 职责边界 + +core 模块是项目的「底座」,提供所有模块共享的基础设施: + +- 项目级常量(`BrickConstants`) +- 公共异常基类 +- 通用工具类 + +core 模块**不包含**业务逻辑,不依赖其他业务模块。 + +## 使用准则 + +- 需要全项目共享的常量、工具,放在 core 模块。 +- 不要将仅单个模块使用的类放在 core——应放在对应模块内。 + +## 正例 + +```java +// 通过 BrickConstants 引用公共常量 +String charset = BrickConstants.DEFAULT_CHARSET; +``` + +## 反例 + +```java +// 魔法字符串散落在各处 +byte[] bytes = str.getBytes("UTF-8"); +``` diff --git a/ai/module.yaml b/ai/module.yaml new file mode 100644 index 0000000..daaae80 --- /dev/null +++ b/ai/module.yaml @@ -0,0 +1,10 @@ +module: core +summary: 核心基础模块,提供项目级常量与公共基类,所有其他模块均依赖此模块。 +dos: + - 项目级常量统一通过 BrickConstants 访问,避免魔法值散落。 + - 公共基类、工具类放在 core 模块,供其他模块复用。 +donts: + - 不要在 core 模块中引入具体业务逻辑。 +examples: + - path: src/main/java/{{basePkgPath}}/core/BrickConstants.java + note: 常量定义入口。 diff --git a/manifest.yaml b/manifest.yaml new file mode 100644 index 0000000..14013d6 --- /dev/null +++ b/manifest.yaml @@ -0,0 +1,22 @@ +name: brick-common-core +version: 0.0.0 +description: 核心基础模块,提供项目级常量与公共基类 +language: java +defaultBranch: master +module: core + +variants: + - branch: master + label: master + +variables: + - name: basePackage + required: true + - name: projectName + required: true + - name: javaVersion + required: true + - name: groupId + required: true + +dependsOn: [] diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a4e870b --- /dev/null +++ b/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + com.synoth.brick + brick-common-core + 0.0.0-SNAPSHOT + jar + + + org.springframework.boot + spring-boot-starter-parent + 3.4.0 + + + + + 17 + + + + + org.springframework.boot + spring-boot-starter + + + + diff --git a/src/main/java/com/synoth/brick/core/BrickConstants.java b/src/main/java/com/synoth/brick/core/BrickConstants.java new file mode 100644 index 0000000..80ab78d --- /dev/null +++ b/src/main/java/com/synoth/brick/core/BrickConstants.java @@ -0,0 +1,12 @@ +package com.synoth.brick.core; + +/** + * 项目级常量定义。 + */ +public final class BrickConstants { + + private BrickConstants() { + } + + // TODO: 添加通用常量(如默认编码、日期格式等) +} diff --git a/src/main/java/com/synoth/brick/core/model/R.java b/src/main/java/com/synoth/brick/core/model/R.java new file mode 100644 index 0000000..871d912 --- /dev/null +++ b/src/main/java/com/synoth/brick/core/model/R.java @@ -0,0 +1,14 @@ +package com.synoth.brick.core.model; + +/** + *

标题:

+ *

描述:

+ *

版权:Copyright (c) 2026

+ *

公司:智业软件

+ * + * @author yangzhaohan + * @date 2026/6/22 + */ +public class R { + +} diff --git a/template/pom.xml b/template/pom.xml new file mode 100644 index 0000000..33cf3ea --- /dev/null +++ b/template/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + {{groupId}} + {{projectName}}-common-core + 0.0.0 + jar + + + org.springframework.boot + spring-boot-starter-parent + 3.4.0 + + + + + {{javaVersion}} + + + + + org.springframework.boot + spring-boot-starter + + + + diff --git a/template/src/main/java/{{basePkgPath}}/core/BrickConstants.java b/template/src/main/java/{{basePkgPath}}/core/BrickConstants.java new file mode 100644 index 0000000..581cb53 --- /dev/null +++ b/template/src/main/java/{{basePkgPath}}/core/BrickConstants.java @@ -0,0 +1,12 @@ +package {{basePackage}}.core; + +/** + * 项目级常量定义。 + */ +public final class BrickConstants { + + private BrickConstants() { + } + + // TODO: 添加通用常量(如默认编码、日期格式等) +}