Skip to content

4.x: Archetype improvements #7884

@romain-grecourt

Description

@romain-grecourt

Archetype improvements

Updated layout

Re-think the layout convention to improve read-ability and maintenance.

Goals:

  • Split inputs and output in different scripts
  • Incorporate features into the layout
  • Reduce inlined template logic, favor standalone templates

Example of a new layout:

|- inputs.xml
|- output.xml
|- includes
  |- sources.xml
  \- common.xml
|- features
  |- docker
    |- inputs.xml
    |- output.xml
    \- files
      |- README.md
      \- Dockerfile
  |- native-image
    |- inputs.xml
    |- output.xml
    \- files
      |- README.md.native
      \- Dockerfile.native
  |- media
    |- inputs.xml
    \- output.xml
|- mp
  |- features
  |- health
    |- inputs.xml
    |- output.xml
    \- files
  |- database
    |- inputs.xml
    |- output.xml
    \- files
\- se
  |- features
    |- health
      |- inputs.xml
      |- output.xml
      \- files
    |- database
      |- inputs.xml
      |- output.xml
      \- files

Features intersection

Fix intersecting features.

E.g.

  • Database + media
  • Database + health
  • Database + metrics
  • Database + tracing

Note that splitting outputs in different scripts allows for scripts to reference all inputs, thus the intersections can be implemented inside each output.xml.

E.g. se/database/output.xml implements intersections with media, health, metrics and tracing.


Rules for Helidon features

  • Must have an HTTP endpoint to exercise the feature (no generic path like 'api' or 'endpoint')
  • Must have a unit test class
  • Must have README documentation

Improved unit testing

Use TestContainers to implement unit test instead of using no-op implementations or embedded "providers".

E.g.

  • Drop the usage of H2 as the database used in unit tests, instead simply use TestContainers.
  • Use zipkin/jaeger containers to test tracing

Include mvnw (Maven Wrapper)

Update the archetype to include mvnw (and required files).


Integration testing

Maven life-cycle and unit tests are not enough to fully test each permutation:

  • Test application startup (JPMS or class-path)
  • Test Dockerfile(s)
  • Test Native image build

We can use exit.on.started system property to test the application startup.
Some of these items will require pipeline improvements (we don't want to increase the overall build time exponentially)

Kotlin DSL

XML schemas provide "some" IDE support, however it is limited as there is no navigation between files.
Investigate using Kotlin DSL to improve the IDE experience / maintenance.

Issues

  • 4.x - Archetype: Create new archetype layout #8811
  • 4.x - Archetype: Fix metrics permutations
  • 4.x - Archetype: Fix features intersections (Database application)
  • 4.x - Archetype: Implement features rules
  • 4.x - Archetype: Add mvnw (Maven Wrapper)
  • 4.x - Archetype: Introduce TestContainers (Database, Tracing ...)
  • 4.x - Archetype: Improve integration tests (JPMS, Docker, native-image)
  • 4.x - Archetype: Investigate Kotlin DSL to improve IDE UX.
  • 4.x - Archetype: .helidon should display the exact permutation used no matter what

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Legendary

Relationships

None yet

Development

No branches or pull requests

Issue actions