enhancement
major
minor
defect
critical
major
minor
major
#30107
tl-maven-plugin: If generating a layout fails during application build, the build remains green
Error
When building an application (the "Goal app " of the tl-maven-plugin, "Packaging tl-app," or "Parent tl-parent-app"), LayoutCreator merges the layout overlays of all modules and writes the final layouts to the application. If a layout cannot be generated (e.g., invalid layout XML, a missing template, or an unknown parameter), the error is only logged, and the build ends with BUILD SUCCESS. The layout is then missing from the deployed application or is not generated in advance, without the build flagging this issue. Since the deployed WAR file combines the modules’ overlays into a single file, this merging cannot be performed at runtime.
Cause
- LayoutCreator.createLayout catches every exception (including those from log.checkErrors()), logs “Creating layout failed: <layout>,” and returns null; mergeLayout then does not write the layout.
- LayoutCreator.createLayoutsForTheme catches the IOException thrown by mergeLayout and logs only “Merging of layout <layout> failed.”
- Similarly, errors in ` startXMLProperties ` and ` startLayoutDependantModules ` are only logged.
- LayoutStorage.readLayouts() only logs an unreadable overlay; the layout is then generated without that overlay.
Solution
Generating the layouts is a step that builds part of the application, not a validation check: If it fails, the built WAR is faulty, so the build fails (as with the view overlays, #30103). A test that generates all layouts does not replace this: Tests do not run by default, application projects usually do not have such a test, and it does not cover errors in the build step itself.
- LayoutCreator.createLayouts reports all errors to a common Protocol: Layouts that cannot be generated or written for a theme (including layout, theme, and cause), unreadable overlays (LayoutStorage.readLayouts(Protocol)), errors loading the configuration and starting the required modules, as well as the view overlays from #30103.
- The remaining layouts are still generated so that a single run lists all faulty layouts. Afterward, `checkErrors()` aborts; TLAppWar causes the build to fail with the actual cause (instead of the ` InvocationTargetException`), e.g.:
[ERROR] Failed to execute goal com.top-logic:tl-maven-plugin:8.0.0-SNAPSHOT:app (build-app) on project tl-demo: Cannot create app WAR: Could not create layouts for the application WAR: com.top_logic.basic.AbortExecutionException: Aborting due to previous errors: Creating layout 'test30107/broken.layout.xml' for theme 'coreSidebarCondensed' failed: No definition for test30107/noSuch.template.xml found. [ERROR] Creating layout 'test30107/broken.layout.xml' for theme 'coreCondensed' failed: No definition found for test30107/noSuch.template.xml. ...
- The engine's applications (tl-demo, tl-demo-react, tl-ai-demo, tl-demo-deploy, tl-doc-app, tl-factory-app, tl-kafka-demo, the archetype applications) continue to build without errors; none of their layouts have been found to contain unnoticed errors so far.
- Test TestLayoutCreator: A layout with a missing template and one with an ill-formed overlay are reported with the layout and cause and are not written; the valid layouts are written.