-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Maven Linter Implementation is Incomplete
Labels: bug, enhancement, pkg/templates
Description
The maven_linter template currently generates a standalone configuration file and a plugin snippet file, but it fails to integrate the Checkstyle plugin into the project's pom.xml. As a result, the linter is not active even after being applied via scbake apply --with maven_linter.
Reproduction
- Create a Spring project:
scbake new my-app --lang spring. - Apply the Maven linter:
scbake apply --with maven_linter. - Check
pom.xml: The<plugin>configuration formaven-checkstyle-pluginis missing from the build section. - Run
mvn checkstyle:check: The command fails or ignores the configuration because it isn't registered in the Project Object Model.
Expected behavior
The linter should automatically register itself within the <build><plugins> section of the existing pom.xml.
Actual behavior
The handler creates checkstyle.xml and maven-checkstyle-plugin.xml. The latter is an orphaned snippet that the user must manually copy-paste into their pom.xml to make the linter work.
Environment
- Go version: 1.22+
- OS/Arch: Linux/amd64 (Mint)
Additional context
The logic in pkg/templates/maven_linter/maven_linter.go uses tasks.CreateTemplateTask which can only create new files. To fix this properly, we will likely need:
- A new
tasktype capable of performing "search and replace" or XML-aware insertions within existing files. - Logic to detect where the
<plugins>block is located inpom.xml.