khalilou88 / jnxplus

Nx plugins that adds Java/Kotlin monorepo support to Nx workspace using Gradle and Maven
MIT License
65 stars 16 forks source link

How to use maven-checkstyle-plugin? #509

Open khalilou88 opened 1 year ago

khalilou88 commented 1 year ago

To lint a project, we can use run-task from nx-maven.

Based on : https://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html

khalilou88 commented 10 months ago

1- Create a lib for checkstyle linting: build-tools-checkstyle

2- add maven-checkstyle-plugin to root pom.xml

3- add target config to nx.json

    "maven-checkstyle-lint": {
      "cache": true,
      "dependsOn": [
        {
          "projects": ["build-tools-checkstyle"], 
          "target": "build"
        }
      ]
    }

4- add target to project.json

    "maven-checkstyle-lint": {
      "executor": "@jnxplus/nx-maven:run-task",
      "options": {
        "task": "checkstyle:check"
      }
    }
khalilou88 commented 10 months ago

code is here https://github.com/khalilou88/jnxplus-examples