Skip to content

feat(arch): Add appName property and expand Spring/testing wiring#10

Merged
jeffjensen merged 1 commit into
mainfrom
feat/appname-module-wiring
Jul 10, 2026
Merged

feat(arch): Add appName property and expand Spring/testing wiring#10
jeffjensen merged 1 commit into
mainfrom
feat/appname-module-wiring

Conversation

@jeffjensen

@jeffjensen jeffjensen commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Implements the java-service-archetype Needed Changes spec: every generated project now needs a human-readable name driving its class/property/prose naming, richer SQL-logging and Spring Boot Admin observability, and shared REST/GraphQL acceptance-test infrastructure, instead of hand-rolling these per project after generation.

  • Add required appName property (no default, prompted first) with class-name, property-value, and prose transform rules
  • Generate package-info.java only under src/main/java (Java rejects two files compiled for the same package); acceptance-tests' lone one now describes the functional tests themselves
  • Add datasource-proxy-spring-boot-starter (SQL logging) to database integration modules and acceptance-tests; add spring-boot-admin-starter-client and make app's web/actuator stack unconditional regardless of presentationTypes
  • Generate shared RestAcceptanceTestBase/GraphQlAcceptanceTestBase in common-testing, and per-project AppRestAcceptanceTestBase/ AppGraphQlAcceptanceTestBase, {appName}AcceptanceTestConfiguration, and logback-spring.xml in acceptance-tests
  • Add appName-derived / and dependency-comment labels (spring/this app/sql logging) across parent, app, service, domain-service, domain-rest/graphql, presentation-graphql, and common-testing poms
  • common-testing now depends on every domain module; no domain module depends on common-testing, keeping the reactor acyclic
  • Update all 16 archetype ITs, the interactive test scripts, and the site docs (requirements/modules/usage/index/building.adoc) plus CLAUDE.md to match

Claude-Session: https://claude.ai/code/session_01P76PdSVUG6SNJeXcGPrhyn

Summary by CodeRabbit

  • New Features

    • Added a required application name prompt used for generated project names, descriptions, class names, properties, and documentation.
    • Enhanced generated Spring projects with servlet initialization, application configuration files, monitoring, admin, validation, and conditional database or GraphQL support.
    • Improved acceptance-test scaffolding with shared REST/GraphQL base classes, configuration, logging, and conditional dependencies.
    • Standardized module dependencies and generated Maven metadata.
  • Bug Fixes

    • Prevented duplicate package-info.java files in test sources and improved dependency wiring across generated modules.
  • Documentation

    • Updated setup, usage, requirements, module, and project-structure guidance for the new generation behavior.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jeffjensen, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: acbf5dcb-7018-4e97-a265-8e1bd157d560

📥 Commits

Reviewing files that changed from the base of the PR and between a2e112a and b402311.

📒 Files selected for processing (41)
  • src/main/resources/META-INF/archetype-post-generate.groovy
  • src/main/resources/META-INF/maven/archetype-metadata.xml
  • src/site/asciidoc/building.adoc
  • src/site/asciidoc/index.adoc
  • src/site/asciidoc/modules.adoc
  • src/site/asciidoc/requirements.adoc
  • src/site/asciidoc/usage.adoc
  • src/test/resources/projects/basic/archetype.properties
  • src/test/resources/projects/basic/verify.groovy
  • src/test/resources/projects/blank-presentation-types/archetype.properties
  • src/test/resources/projects/blank-presentation-types/verify.groovy
  • src/test/resources/projects/blank-service-areas/archetype.properties
  • src/test/resources/projects/blank-service-areas/verify.groovy
  • src/test/resources/projects/full/archetype.properties
  • src/test/resources/projects/full/verify.groovy
  • src/test/resources/projects/malformed-integrations/archetype.properties
  • src/test/resources/projects/malformed-integrations/verify.groovy
  • src/test/resources/projects/minimal/archetype.properties
  • src/test/resources/projects/minimal/verify.groovy
  • src/test/resources/projects/multi-integration/archetype.properties
  • src/test/resources/projects/multi-integration/verify.groovy
  • src/test/resources/projects/multi-service/archetype.properties
  • src/test/resources/projects/multi-service/verify.groovy
  • src/test/resources/projects/no-integrations/archetype.properties
  • src/test/resources/projects/no-integrations/verify.groovy
  • src/test/resources/projects/no-presentation/archetype.properties
  • src/test/resources/projects/no-presentation/verify.groovy
  • src/test/resources/projects/package-differs-from-groupid/archetype.properties
  • src/test/resources/projects/package-differs-from-groupid/verify.groovy
  • src/test/resources/projects/service-integration-match/archetype.properties
  • src/test/resources/projects/service-integration-match/verify.groovy
  • src/test/resources/projects/single-service-fallback/archetype.properties
  • src/test/resources/projects/single-service-fallback/verify.groovy
  • src/test/resources/projects/spring-off/archetype.properties
  • src/test/resources/projects/spring-off/verify.groovy
  • src/test/resources/projects/uppercase-types/archetype.properties
  • src/test/resources/projects/uppercase-types/verify.groovy
  • src/test/resources/projects/whitespace-tolerance/archetype.properties
  • src/test/resources/projects/whitespace-tolerance/verify.groovy
  • test-interactive.ps1
  • test-interactive.sh
📝 Walkthrough

Walkthrough

The archetype now requires appName, derives generated naming and properties from it, changes source and dependency scaffolding, adds Spring and acceptance-test infrastructure, updates documentation, and expands integration verification across project configurations.

Changes

Archetype generation

Layer / File(s) Summary
Generator contracts and POM rendering
src/main/resources/META-INF/archetype-post-generate.groovy
Adds appName helpers, label-aware dependencies, optional module names, conditional Spring dependencies, and managed third-party starters.
Module composition and runtime scaffolding
src/main/resources/META-INF/archetype-post-generate.groovy
Updates module dependencies, main-only package-info generation, app resources, servlet initialization, and REST/GraphQL acceptance-test support.
Archetype input and documented output
src/main/resources/META-INF/maven/archetype-metadata.xml, src/site/asciidoc/*
Requires appName and documents naming, dependency, source-layout, Spring, and acceptance-test behavior.
Generated-project scenario verification
src/test/resources/projects/*
Updates scenario inputs and assertions for generated POM metadata, dependencies, source trees, Spring wiring, and acceptance-test artifacts.
Interactive generation inputs
test-interactive.ps1, test-interactive.sh
Adds the appName response to scripted interactive generation. ⟂

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ArchetypeGenerator
  participant GeneratedProject
  participant IntegrationVerifier
  User->>ArchetypeGenerator: provide appName and project options
  ArchetypeGenerator->>GeneratedProject: generate modules, POMs, source trees, and resources
  IntegrationVerifier->>GeneratedProject: inspect metadata, dependencies, and generated files
  GeneratedProject-->>IntegrationVerifier: expose generated project contents
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: adding the required appName property and expanding Spring/testing wiring.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/appname-module-wiring

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (1)
src/main/resources/META-INF/archetype-post-generate.groovy (1)

962-1020: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

SQL logging and JPA properties are emitted unconditionally.

application.properties includes spring.jpa.*, jdbc.datasource-proxy.enabled, decorator.datasource.*, and logging.level.net.ttddyy.dsproxy.listener=TRACE even when no database integration exists. These are harmless (ignored when the relevant auto-configurations are inactive) but could confuse users into thinking SQL logging is active. Consider gating these property blocks on hasDatabaseIntegration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/resources/META-INF/archetype-post-generate.groovy` around lines 962
- 1020, Conditionally emit the JPA and SQL logging properties in the
application.properties template based on hasDatabaseIntegration. Update the
generation logic around the writeFile template so spring.jpa.*,
jdbc.datasource-proxy.enabled, decorator.datasource.*, and
logging.level.net.ttddyy.dsproxy.listener are included only when database
integration is enabled, while preserving the common properties for all projects.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/resources/META-INF/archetype-post-generate.groovy`:
- Line 176: Guard the appName lookup in the archetype post-generation script
against a missing property before trimming it. Update the appName assignment to
use the same null-safe defaulting pattern as integrations, serviceAreas,
presentationTypes, and includeSpring, while preserving the existing trimmed
value behavior when present.

In `@src/site/asciidoc/building.adoc`:
- Line 47: Update the archetype-specific property documentation to account for
includeSpring from archetype-metadata.xml: either list all five properties,
including appName, integrations, serviceAreas, presentationTypes, and
includeSpring, or explicitly describe the existing four as commonly supplied and
mention includeSpring separately.

In `@src/site/asciidoc/requirements.adoc`:
- Around line 247-254: Update the acceptance-tests sentence in the package-info
guidance to describe the *AT classes under src/test/java as “real test content”
or “the actual acceptance-test classes,” while preserving the distinction that
their package-info Javadoc lives under src/main/java.

In `@src/site/asciidoc/usage.adoc`:
- Line 30: The usage documentation’s property list and prompt order are
inconsistent with the metadata and other interactive documentation. Update the
relevant section near “It then prompts…” to list all five archetype-specific
properties in the actual prompt order, including appName/integrations before
coordinates and includeSpring in its declared position, and document how users
can override includeSpring; keep usage.adoc, index.adoc, test-interactive.ps1,
and test-interactive.sh consistent.

In `@src/test/resources/projects/blank-service-areas/verify.groovy`:
- Around line 95-105: Update the package-info.java existence check list in the
test to include domain-service, using the generated path
domain-service/src/main/java/${p}/domain/service/package-info.java alongside the
other module entries.

In `@src/test/resources/projects/full/verify.groovy`:
- Around line 326-328: Update the module iteration in the
no-direct-Spring-dependency assertion to include both service-orders and
service-notifications, preserving the existing POM check and failure message for
each module.

In `@src/test/resources/projects/uppercase-types/verify.groovy`:
- Around line 99-111: Add the expected
`domain-service/src/main/java/${p}/domain/service/package-info.java` path to the
package-info existence list iterated by `check`, alongside the other generated
module paths, so the fallback single-service scenario is validated.

In `@test-interactive.ps1`:
- Around line 72-79: Update test-interactive.ps1 to preserve Unicode safely on
Windows PowerShell by saving it as UTF-8 with a BOM, or replace all non-ASCII
characters with ASCII equivalents; ensure the existing $answers test data
remains unchanged.

---

Nitpick comments:
In `@src/main/resources/META-INF/archetype-post-generate.groovy`:
- Around line 962-1020: Conditionally emit the JPA and SQL logging properties in
the application.properties template based on hasDatabaseIntegration. Update the
generation logic around the writeFile template so spring.jpa.*,
jdbc.datasource-proxy.enabled, decorator.datasource.*, and
logging.level.net.ttddyy.dsproxy.listener are included only when database
integration is enabled, while preserving the common properties for all projects.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e3f91c6-d4f3-443c-8203-91c2e7589946

📥 Commits

Reviewing files that changed from the base of the PR and between 22a7eed and a2e112a.

📒 Files selected for processing (41)
  • src/main/resources/META-INF/archetype-post-generate.groovy
  • src/main/resources/META-INF/maven/archetype-metadata.xml
  • src/site/asciidoc/building.adoc
  • src/site/asciidoc/index.adoc
  • src/site/asciidoc/modules.adoc
  • src/site/asciidoc/requirements.adoc
  • src/site/asciidoc/usage.adoc
  • src/test/resources/projects/basic/archetype.properties
  • src/test/resources/projects/basic/verify.groovy
  • src/test/resources/projects/blank-presentation-types/archetype.properties
  • src/test/resources/projects/blank-presentation-types/verify.groovy
  • src/test/resources/projects/blank-service-areas/archetype.properties
  • src/test/resources/projects/blank-service-areas/verify.groovy
  • src/test/resources/projects/full/archetype.properties
  • src/test/resources/projects/full/verify.groovy
  • src/test/resources/projects/malformed-integrations/archetype.properties
  • src/test/resources/projects/malformed-integrations/verify.groovy
  • src/test/resources/projects/minimal/archetype.properties
  • src/test/resources/projects/minimal/verify.groovy
  • src/test/resources/projects/multi-integration/archetype.properties
  • src/test/resources/projects/multi-integration/verify.groovy
  • src/test/resources/projects/multi-service/archetype.properties
  • src/test/resources/projects/multi-service/verify.groovy
  • src/test/resources/projects/no-integrations/archetype.properties
  • src/test/resources/projects/no-integrations/verify.groovy
  • src/test/resources/projects/no-presentation/archetype.properties
  • src/test/resources/projects/no-presentation/verify.groovy
  • src/test/resources/projects/package-differs-from-groupid/archetype.properties
  • src/test/resources/projects/package-differs-from-groupid/verify.groovy
  • src/test/resources/projects/service-integration-match/archetype.properties
  • src/test/resources/projects/service-integration-match/verify.groovy
  • src/test/resources/projects/single-service-fallback/archetype.properties
  • src/test/resources/projects/single-service-fallback/verify.groovy
  • src/test/resources/projects/spring-off/archetype.properties
  • src/test/resources/projects/spring-off/verify.groovy
  • src/test/resources/projects/uppercase-types/archetype.properties
  • src/test/resources/projects/uppercase-types/verify.groovy
  • src/test/resources/projects/whitespace-tolerance/archetype.properties
  • src/test/resources/projects/whitespace-tolerance/verify.groovy
  • test-interactive.ps1
  • test-interactive.sh

Comment thread src/main/resources/META-INF/archetype-post-generate.groovy Outdated
Comment thread src/site/asciidoc/building.adoc Outdated
Comment thread src/site/asciidoc/requirements.adoc
Comment thread src/site/asciidoc/usage.adoc Outdated
Comment thread src/test/resources/projects/blank-service-areas/verify.groovy
Comment thread src/test/resources/projects/full/verify.groovy Outdated
Comment thread src/test/resources/projects/uppercase-types/verify.groovy
Comment thread test-interactive.ps1
@jeffjensen

Copy link
Copy Markdown
Owner Author

/agentic_review

@qodo-code-review

qodo-code-review Bot commented Jul 10, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Insecure actuator defaults ✗ Dismissed 🐞 Bug ⛨ Security
Description
The archetype now generates application.properties that exposes all actuator endpoints and always
shows env values, which can leak secrets and unnecessarily expands attack surface in every generated
Spring app by default.
Code

src/main/resources/META-INF/archetype-post-generate.groovy[R968-978]

+## Actuators
+### enable all endpoints
+management.endpoints.web.exposure.include=*
+
+### show health check details
+management.endpoint.health.show-details=always
+management.endpoint.health.show-components=always
+
+#### display env values (only do this in local or dev environments to avoid display secrets)
+management.endpoint.env.show-values=always
+
Evidence
The generator writes these exact actuator properties into the generated application's
application.properties, meaning every generated Spring app will ship with these permissive
defaults unless the user notices and changes them.

src/main/resources/META-INF/archetype-post-generate.groovy[962-978]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The archetype generates insecure actuator configuration by default (`management.endpoints.web.exposure.include=*` and `management.endpoint.env.show-values=always`). This makes all actuator endpoints remotely accessible (including sensitive ones) and can expose secrets from environment-backed properties.

### Issue Context
These lines are written unconditionally into the generated app module’s `app/src/main/resources/application.properties` whenever `includeSpring` is true.

### Fix Focus Areas
- src/main/resources/META-INF/archetype-post-generate.groovy[962-978]

### Proposed fix
- Change default exposure to a minimal safe set (e.g. `health,info` and optionally `prometheus`).
- Remove `management.endpoint.env.show-values=always` from the default file; if needed for local debugging, put it in `application-local.properties` (or `application-dev.properties`) instead.
- Consider disabling/omitting any especially sensitive endpoints from defaults unless explicitly opted-in.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Ungated SQL logging config 🐞 Bug ☼ Reliability
Description
The archetype enables datasource-proxy/SQL logging settings and adds the datasource-proxy starter to
acceptance-tests whenever Spring is enabled, even when no database integration exists, creating
unnecessary dependencies and potentially surprising runtime/test auto-configuration behavior.
Code

src/main/resources/META-INF/archetype-post-generate.groovy[R994-1038]

+### Metrics
+jdbc.datasource-proxy.enabled=true
+spring.jpa.properties.hibernate.generate_statistics=true
+
+## Spring Boot Admin
+spring.boot.admin.client.enabled=true
+spring.boot.admin.client.url=TODO SET ME
+
+## JPA
+spring.jpa.show-sql=false
+spring.jpa.hibernate.ddl-auto=none
+
+## Logging
+logging.include-application-name=false
+logging.level.root=INFO
+logging.file.name=TODO SET ME.log
+logging.pattern.file=%date %-10thread %-5level %-100.100logger %mdc: %marker: %msg%n
+logging.logback.rollingpolicy.max-file-size=10gb
+logging.logback.rollingpolicy.max-history=8
+logging.structured.json.context.prefix=labels
+logging.level.org.springframework.transaction.interceptor=TRACE
+
+### SQL logging
+decorator.datasource.enabled=true
+decorator.datasource.datasource-proxy.format-sql=true
+logging.level.net.ttddyy.dsproxy.listener=TRACE
+""")
+
+['ci', 'dev', 'local', 'prod', 'qa', 'uat'].each { profile ->
+    writeFile(projectDir, "app/src/main/resources/application-${profile}.properties", '')
}
}

// ─── acceptance-tests ─────────────────────────────────────────────────────────

+// TEST: common-testing (+ spring-graphql-test when a graphql presentation needs GraphQL test
+// support). PROD: every internal module it depends on ("this app"), + sql logging support.
+def atModuleDeps = [[module: 'common-testing', scope: 'test', label: 'this app']]
+if (includeSpring && hasGraphqlPresentation) {
+    atModuleDeps << [groupId: 'org.springframework.graphql', artifactId: 'spring-graphql-test',
+                     scope: 'test', label: 'spring']
+}
+atModuleDeps += atDeps
+if (includeSpring) atModuleDeps << (DATASOURCE_PROXY_STARTER + [label: 'sql logging'])
+
Evidence
The generator unconditionally writes SQL logging toggles into the app’s application.properties and
unconditionally adds the datasource-proxy starter to acceptance-tests whenever Spring is enabled,
without checking hasDatabaseIntegration.

src/main/resources/META-INF/archetype-post-generate.groovy[962-1020]
src/main/resources/META-INF/archetype-post-generate.groovy[1029-1038]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
SQL logging configuration is generated as always-on (properties) and datasource-proxy is added to `acceptance-tests` for all Spring-enabled projects, regardless of whether a database integration was selected. This is inconsistent with earlier logic that treats SQL logging as database-specific, and it adds extra classpath/auto-config surface to non-DB projects.

### Issue Context
- App config writes `jdbc.datasource-proxy.enabled=true`, `decorator.datasource.enabled=true`, and dsproxy logging levels without checking `hasDatabaseIntegration`.
- `acceptance-tests` adds `datasource-proxy-spring-boot-starter` whenever `includeSpring` is true.

### Fix Focus Areas
- src/main/resources/META-INF/archetype-post-generate.groovy[962-1020]
- src/main/resources/META-INF/archetype-post-generate.groovy[1029-1038]

### Proposed fix
- Only write SQL-logging-related properties when `hasDatabaseIntegration` is true (or move them into a database-specific profile file).
- Only add `DATASOURCE_PROXY_STARTER` to `acceptance-tests` when `hasDatabaseIntegration` is true.
- If SQL logging is intended to be opt-in, consider defaulting the enabling toggles to false and documenting how to enable them.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Admin client placeholder URL ✗ Dismissed 🐞 Bug ☼ Reliability
Description
The archetype enables Spring Boot Admin client by default but writes
spring.boot.admin.client.url=TODO SET ME, producing a non-functional default configuration that
will trigger failed registration attempts/noisy runtime behavior until manually fixed.
Code

src/main/resources/META-INF/archetype-post-generate.groovy[R998-1001]

+## Spring Boot Admin
+spring.boot.admin.client.enabled=true
+spring.boot.admin.client.url=TODO SET ME
+
Evidence
The generator explicitly writes the Spring Boot Admin client as enabled and assigns a placeholder
URL into the generated config, ensuring the misconfiguration exists in every generated Spring app
unless edited.

src/main/resources/META-INF/archetype-post-generate.groovy[998-1001]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The generated `application.properties` enables the Spring Boot Admin client while providing a placeholder URL value (`TODO SET ME`). This is a configuration footgun: the generated app will attempt (and fail) to register against a meaningless endpoint.

### Issue Context
These properties are written into `app/src/main/resources/application.properties` as part of the archetype post-generate script.

### Fix Focus Areas
- src/main/resources/META-INF/archetype-post-generate.groovy[998-1001]

### Proposed fix
- Default `spring.boot.admin.client.enabled=false` in `application.properties`.
- Provide a commented example URL (or move `enabled=true` + URL into `application-local.properties`) so local/dev users can opt in explicitly.
- Avoid placeholder values that look like real configuration and cause runtime failures.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. Unvalidated appName usage 🐞 Bug ☼ Reliability
Description
The post-generate script calls .trim() on props.getProperty('appName') without null/empty
checks, which can throw a NullPointerException on malformed invocation and can also allow empty
appName values to flow into generated class/config names and POM metadata.
Code

src/main/resources/META-INF/archetype-post-generate.groovy[R176-177]

+def appName = props.getProperty('appName').trim()
+
Evidence
The generator reads appName without a null guard, while metadata marks it required; this
combination means normal flows may be safe, but the script itself is still fragile and will fail
with an unhelpful NPE if invoked with missing properties or empty values slip through.

src/main/resources/META-INF/archetype-post-generate.groovy[173-177]
src/main/resources/META-INF/maven/archetype-metadata.xml[45-49]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`appName` is used as a core naming input, but the generator assumes it is always present and non-empty (`props.getProperty('appName').trim()`). This can NPE if the property is absent and can generate invalid/empty identifiers if the user supplies a blank value.

### Issue Context
`appName` is declared as a required property in archetype metadata, which reduces the likelihood, but the script should still fail fast with a clear error and protect against empty/whitespace values.

### Fix Focus Areas
- src/main/resources/META-INF/archetype-post-generate.groovy[173-181]
- src/main/resources/META-INF/maven/archetype-metadata.xml[45-49]

### Proposed fix
- Read defensively: `(props.getProperty('appName') ?: '').trim()`.
- If blank after trim, throw a clear exception explaining the required format.
- Optionally enforce the documented constraint (capitalized words separated by spaces) before using it to generate Java class names / XML `<name>` values.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread src/main/resources/META-INF/archetype-post-generate.groovy
Comment thread src/main/resources/META-INF/archetype-post-generate.groovy Outdated
Comment thread src/main/resources/META-INF/archetype-post-generate.groovy Outdated
Comment thread src/main/resources/META-INF/archetype-post-generate.groovy Outdated
Implements the java-service-archetype Needed Changes spec: every generated
project now needs a human-readable name driving its class/property/prose
naming, richer SQL-logging and Spring Boot Admin observability, and shared
REST/GraphQL acceptance-test infrastructure, instead of hand-rolling these
per project after generation.

* Add required appName property (no default, prompted first) with class-name,
  property-value, and prose transform rules
* Generate package-info.java only under src/main/java (Java rejects two files
  compiled for the same package); acceptance-tests' lone one now describes the
  functional tests themselves
* Add datasource-proxy-spring-boot-starter (SQL logging) to database integration
  modules and acceptance-tests; add spring-boot-admin-starter-client and make
  app's web/actuator stack unconditional regardless of presentationTypes
* Generate shared RestAcceptanceTestBase/GraphQlAcceptanceTestBase in
  common-testing, and per-project AppRestAcceptanceTestBase/
  AppGraphQlAcceptanceTestBase, {appName}AcceptanceTestConfiguration, and
  logback-spring.xml in acceptance-tests
* Add appName-derived <name>/<description> and dependency-comment labels
  (spring/this app/sql logging) across parent, app, service, domain-service,
  domain-rest/graphql, presentation-graphql, and common-testing poms
* common-testing now depends on every domain module; no domain module depends
  on common-testing, keeping the reactor acyclic
* Update all 16 archetype ITs, the interactive test scripts, and the site docs
  (requirements/modules/usage/index/building.adoc) plus CLAUDE.md to match

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P76PdSVUG6SNJeXcGPrhyn
@jeffjensen jeffjensen force-pushed the feat/appname-module-wiring branch from a2e112a to b402311 Compare July 10, 2026 12:18
@jeffjensen jeffjensen merged commit 8f4c8d3 into main Jul 10, 2026
3 checks passed
@jeffjensen jeffjensen deleted the feat/appname-module-wiring branch July 10, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant