Skip to content

template-backend-java: doesn't use the documented {{TOKEN}} placeholders, relies on fragile exact-text replacements #92

Description

@marioserrano09

Problem

The CLI README (platform/packages/cli/README.md, "Template author conventions" section) documents that templates should use placeholders {{GROUP_ID}}, {{ARTIFACT_ID}}, {{PROJECT_VERSION}}, {{DYNAMIA_VERSION}}, {{SPRING_BOOT_VERSION}}, etc.

But dynamiatools/template-backend-java doesn't use them. Its pom.xml has literal values (com.example, demo, 0.0.1-SNAPSHOT, 4.0.5, 26.4.1), and renameJavaPackages (platform/packages/cli/src/utils/replace.ts) replaces them via hardcoded exact-text matches:

replacements['<groupId>com.example</groupId>'] = ...
replacements['<version>4.0.5</version>'] = ...
replacements['<dynamia.version>26.4.1</dynamia.version>'] = ...

This is fragile: if anyone edits the template pom.xml's formatting (spacing, attribute order), or bumps the Spring Boot/Dynamia version without coordinating with the CLI, the replacement silently stops matching and the generated project ends up with wrong values, with no visible error.

Proposed fix

Migrate template-backend-java/pom.xml (and application.yaml where applicable) to use the real {{...}} placeholders, and simplify/remove the exact-text fallbacks in replace.ts once migrated (or keep them only as a documented safety net, not the primary mechanism).

Other hygiene gaps found in the same repo

  • pom.xml has empty <url/>, <licenses><license/></licenses>, <developers><developer/></developers>, <scm>... — stay empty in every generated project.
  • README.md is a single line; doesn't document how to run the generated project (./mvnw spring-boot:run, profiles, etc.) or explain that it's a template consumed by the CLI.
  • No GitHub Actions to validate the template builds (mvn verify) on every push — a broken pom.xml isn't caught until a user runs dynamia new.
  • No application-dev.yaml/application-prod.yaml profiles or datasource example, which is expected for a starter that already ships domain-jpa + hsqldb.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions