jqa-maven-plugin icon indicating copy to clipboard operation
jqa-maven-plugin copied to clipboard

.jqassistant.yml of a maven module not or only partially applied

Open bragern opened this issue 1 year ago • 1 comments

See example in my github: https://github.com/bragern/jqa-groups-test/tree/main/jqa-groups-test (sorry, already had it written in my format but it translates well to yours)

Two Issues observed there

1) Not recognizing groups configured in '.jqassistant.yml' of a maven module when building parent

steps to recreate

  • execute 'mvn clean install' on 'jqa-groups-test/jqa-groups-test-module/'
  • execute 'mvn clean install' on 'jqa-groups-test/'
  • compare build logs

observed

  • On 'jqa-groups-test-module/' analysis happens in 'jqassistant-maven-plugin:2.0.8:analyze':

    • [INFO] --- jqassistant-maven-plugin:2.0.8:analyze (default-cli) @ jqa-groups-test-module ---
    • [INFO] Rules directory 'C:\MyFiles\projects\jqa-groups-test\jqa-groups-test\jqa-groups-test-module\jqassistant' does not exist, skipping.
    • [INFO] Executing analysis for 'jqa-groups-test-module'.
    • ...
  • On 'jqa-groups-test/' nothing happens in 'jqassistant-maven-plugin:2.0.8:analyze':

    • [INFO] --- jqassistant-maven-plugin:2.0.8:analyze (default-cli) @ jqa-groups-test-module ---
    • [INFO]
    • [INFO] --- maven-install-plugin:2.4:install (default-install) @ jqa-groups-test-module ---

expected

No matter if the build is started from parent or module, the configured group in '.jqassistant.yml' of the module should be used for jqa analysis.

As you can see in issue 2) the '.jqassistant.yml' is definitely used in both cases but the configured groups seem to be ignored.

2) Not recognizing '.jqassistant.yml' of a maven module at all when building parent

steps to recreate

  • remove 'configurationLocation' from 'jqa-groups-test/jqa-groups-test-module/.jqassistant.yml'
  • execute 'mvn clean install' on 'jqa-groups-test/jqa-groups-test-module/'
  • execute 'mvn clean install' on 'jqa-groups-test/'
  • compare build logs

observed

  • On 'jqa-groups-test-module/' right before 'jqassistant-maven-plugin:2.0.8:analyze' 'src/main' is entered
    • '[INFO] Entering src/main'
  • On 'jqa-groups-test/' right before 'jqassistant-maven-plugin:2.0.8:analyze' 'src/main' is not entered

I also observed other parameters not to be used from the yml so it seems the entire yml is not loaded at all.

expected

No matter if the build is started from parent or module, the '.jqassistant.yml' of the module should be used during module build

bragern avatar Nov 14 '23 12:11 bragern

The implementation has been extended such that .jQAssistant.yml files are evaluated from the reactor execution root as well as from the current module. This allows for project-wide configs as well as module specific configs, e.g. additional includes for the scanner. Note that some settings (e.g. store) are always applied globally.

DirkMahler avatar Apr 22 '24 17:04 DirkMahler

@DirkMahler Second issue looking good now. Unfortunately though I still experience the first issue:

Child module build

\jqa-groups-test\jqa-groups-test-module> mvn clean install [INFO] --- jqassistant-maven-plugin:2.3.0:analyze (default-cli) @ jqa-groups-test-module --- [INFO] Loading configuration from file '\jqa-groups-test\jqa-groups-test-module.jqassistant.yml'. [INFO] Rules directory '\jqa-groups-test\jqa-groups-test-module\jqassistant' does not exist, skipping. [INFO] Executing analysis for 'jqa-groups-test-module'.

=> Configuration is loaded, analysis is started - all good ✅.

Parent build

\jqa-groups-test> mvn clean install [INFO] --- jqassistant-maven-plugin:2.3.0:analyze (default-cli) @ jqa-groups-test-module --- [INFO] Loading configuration from file '\jqa-groups-test\jqa-groups-test-module.jqassistant.yml'. [INFO] Loading configuration from file '\jqa-groups-test\jqa-groups-test-module.jqassistant.yml'. [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ jqa-groups-test-module ---

=> Configuration is loaded twice (sketchy already), analysis is not started, next build step is commenced - not good ❌

I updated my github-example with the new version for easy recreation: https://github.com/bragern/jqa-groups-test

bragern avatar Jul 02 '24 10:07 bragern