Skip to content

Commit 6749040

Browse files
committed
docs: Add requirements
1 parent e6d0818 commit 6749040

1 file changed

Lines changed: 146 additions & 0 deletions

File tree

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
= Requirements
2+
:toc: left
3+
:toc-title: Contents
4+
:toclevels: 2
5+
6+
Create a Maven archetype named `java-service-archetype` that generates a
7+
structured multi-module Java service project. In addition to the standard Maven
8+
coordinates (`groupId`, `artifactId`, `version`), prompt the user for the
9+
properties below, then produce the module structure described in this document.
10+
11+
== Prompts
12+
13+
=== `package` — base package
14+
15+
Prompt for the base Java package for the application (e.g. `com.example.myapp`).
16+
All module sub-packages are derived from this value as described in
17+
<<source-structure>>.
18+
19+
=== `integrations`
20+
21+
Prompt for a comma-separated list of `type:name` pairs, one per external data
22+
source or system (e.g. `database:users,rest:orders,graphql:catalog`).
23+
24+
* Abbreviate the `database` type to `db` in all generated module and package
25+
names; use all other types as-is.
26+
* Normalize all type and name values to lowercase.
27+
* Silently skip malformed entries (missing colon, blank type or name).
28+
* No default — leave blank to generate a project with no integration modules.
29+
30+
=== `singleService` (default: `y`)
31+
32+
Ask whether the application has a single unnamed service area.
33+
34+
* `y` — generate one module named `service`; ignore `serviceAreas`.
35+
* `n` — use `serviceAreas` to name the service modules.
36+
37+
=== `serviceAreas` (default: empty)
38+
39+
Used when `singleService=n`. Prompt for a comma-separated list of service area
40+
names (e.g. `orders,inventory,notifications`). Generate a `service-{name}`
41+
module for each non-blank name. If no non-blank names are provided, fall back
42+
to a single module named `service`.
43+
44+
=== `presentationTypes` (default: `rest`)
45+
46+
Prompt for a comma-separated list of presentation-tier types
47+
(e.g. `rest,graphql`).
48+
49+
* Normalize all type values to lowercase.
50+
* Leave blank (or provide only blank entries) to generate a project with no
51+
presentation modules.
52+
53+
== Module Structure
54+
55+
Generate all modules as siblings of a `parent/` directory.
56+
Do not create a `pom.xml` at the project root.
57+
58+
=== `parent/`
59+
60+
* `<packaging>pom</packaging>`
61+
* List every sibling module in `<modules>` using `../module` relative paths,
62+
sorted alphabetically.
63+
* List every sibling module in `<dependencyManagement>` pinned to
64+
`${project.version}`, sorted alphabetically by `artifactId`.
65+
* Set the default Java version to 21 via compiler source/target properties.
66+
67+
=== Child module POMs
68+
69+
Every module except `parent/` must declare `parent/pom.xml` as its parent
70+
using `<relativePath>../parent/pom.xml</relativePath>`.
71+
72+
=== `common-domain`
73+
74+
Shared domain classes. No dependencies on other generated modules.
75+
76+
=== `common-testing`
77+
78+
Shared test utilities.
79+
80+
* Dependency: `common-domain`
81+
* No `src/test` source directory.
82+
83+
=== Per integration: `domain-{type}-{name}` and `integration-{type}-{name}`
84+
85+
For each `type:name` integration entry, generate two modules
86+
(e.g. `domain-db-users` and `integration-db-users`):
87+
88+
* `domain-{type}-{name}` — domain classes for this data source.
89+
Dependency: `common-domain`.
90+
* `integration-{type}-{name}` — implementation classes (DAOs, repositories,
91+
clients, etc.).
92+
Dependencies: `common-domain`, `domain-{type}-{name}`.
93+
94+
=== Per service area: `service` or `service-{name}`
95+
96+
Business logic for a service area.
97+
Dependency: `common-domain`.
98+
99+
=== Per presentation tier: `domain-{type}` and `presentation-{type}`
100+
101+
For each presentation type, generate two modules
102+
(e.g. `domain-rest` and `presentation-rest`):
103+
104+
* `domain-{type}` — domain classes for this presentation tier.
105+
Dependency: `common-domain`.
106+
* `presentation-{type}` — request-handling classes (controllers, etc.).
107+
Dependencies: `common-domain`, `domain-{type}`.
108+
109+
=== `app`
110+
111+
Assembles the runnable artifact (e.g. Spring Boot uber jar).
112+
Depend on all generated modules except `acceptance-tests`, `common-testing`,
113+
and `app` itself.
114+
115+
=== `acceptance-tests`
116+
117+
Functional tests that exercise the application end-to-end.
118+
No `src/main` source directory.
119+
120+
* Dependencies: `app`, `common-domain`, all `domain-{type}-{name}` modules,
121+
all `domain-{type}` (presentation) modules.
122+
* Do not depend on service modules or integration implementation modules.
123+
124+
[[source-structure]]
125+
== Source Structure
126+
127+
Each module's source root is the package derived from the base package prompt.
128+
Place a `package-info.java` in each leaf package directory with a Javadoc comment
129+
describing the package's purpose.
130+
The package for each module is:
131+
132+
[cols="1,1"]
133+
|===
134+
|Module |Package
135+
136+
|`common-domain` |`${base.package}.common.domain`
137+
|`common-testing` |`${base.package}.common.testing`
138+
|`domain-{type}-{name}` |`${base.package}.domain.{type}.{name}`
139+
|`integration-{type}-{name}` |`${base.package}.integration.{type}.{name}`
140+
|`service` |`${base.package}.service`
141+
|`service-{name}` |`${base.package}.service.{name}`
142+
|`domain-{type}` |`${base.package}.domain.{type}`
143+
|`presentation-{type}` |`${base.package}.presentation.{type}`
144+
|`app` |`${base.package}.app`
145+
|`acceptance-tests` |`${base.package}.at`
146+
|===

0 commit comments

Comments
 (0)