How to configure jQAssistant to exclude specific directories from the scan?

36 views Asked by At

I'm using jqassistant-commandline-neo4jv4-2.1.0 and I would like to configure .jqassistant.yml to exclude specific dir(s) when scanning.

I have tried the following:

jqassistant:
  scan:
    include:
        files:
        - "!/BOOT-INF/lib/**"
        - "!**/lib/**"

but it did not work, I'm still seeing the follwing log when I run the scan:

2024-03-21 15:04:56.867 [main] INFO AbstractContainerScannerPlugin - Entering /BOOT-INF/lib/spring-boot-starter-data-mongodb-2.0.3.RELEASE.jar
2024-03-21 15:04:56.868 [main] INFO AbstractContainerScannerPlugin - Leaving /BOOT-INF/lib/spring-boot-starter-data-mongodb-2.0.3.RELEASE.jar (3 entries, 0 ms)
2024-03-21 15:04:56.869 [main] INFO AbstractContainerScannerPlugin - Entering /BOOT-INF/lib/spring-boot-starter-2.0.3.RELEASE.jar
2024-03-21 15:04:56.869 [main] INFO AbstractContainerScannerPlugin - Leaving /BOOT-INF/lib/spring-boot-starter-2.0.3.RELEASE.jar (3 entries, 0 ms)
2024-03-21 15:04:56.883 [main] INFO AbstractContainerScannerPlugin - Entering /BOOT-INF/lib/spring-boot-2.0.3.RELEASE.jar
....
.....
....

Also, the answer reported here: How can I exclude libraries in a WAR during jQAssistant scan? does not work, since the jqassistant-commandline-neo4jv4-2.1.0 does not have "-p" which I tried to replace with -C but still did not work with the following in the scan.properties: file.include=!/BOOT-INF/lib/,!/lib/ and file.exclude=/BOOT-INF/lib/,/lib/

2

There are 2 answers

2
Dirk Mahler On

As of jQAssistant 2.x the parameter -p has been replaced by a configuration property in .jqassistant.yml, thus you can apply the solution from the referenced SO question:

jqassistant:
  scan:
    properties:
      file.include: "*.war,*.jar,/org/springframework/**"

You can as well specify a property file.exlude that is applied after evaluating file.include.

1
Dirk Mahler On

Here's a working setup, tested on a Spring Boot generated JAR-File:

jqassistant:
  scan:
    include:
      files:
        - hexagonal-1.0.0-SNAPSHOT.jar
    properties:
      file.exclude: /BOOT-INF/lib/**