Skip to content

Maven Linter Implementation is Incomplete #1

@Emin-ACIKGOZ

Description

@Emin-ACIKGOZ

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

  1. Create a Spring project: scbake new my-app --lang spring.
  2. Apply the Maven linter: scbake apply --with maven_linter.
  3. Check pom.xml: The <plugin> configuration for maven-checkstyle-plugin is missing from the build section.
  4. 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:

  1. A new task type capable of performing "search and replace" or XML-aware insertions within existing files.
  2. Logic to detect where the <plugins> block is located in pom.xml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions