0

I fail to find out how to set up jqassistant-maven-plugin to verify the rules in the java plugin on a multi-module maven project.

There is not a lot in the jqassistant documentation about how to configure a plugin. Also I do not see what goal I have to run in order to see some report with the result of the java rules analysis.

I added this to my root pom.xml

        <plugin>
            <groupId>com.buschmais.jqassistant</groupId>
            <artifactId>jqassistant-maven-plugin</artifactId>
            <version>1.9.0</version>
            <configuration>
                <useExecutionRootAsProjectRoot>true</useExecutionRootAsProjectRoot>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.buschmais.jqassistant.plugin</groupId>
                    <artifactId>java</artifactId>
                    <version>1.9.0</version>
                </dependency>
            </dependencies>
        </plugin>

When I execute

  1. mvn clean install
  2. mvn jqassistant:scan
  3. mvn jqassistant:analyze

Never do I see anything that looks like some output from jqassistant, except for a xml file that does not contain anything usefull:

<?xml version="1.0" encoding="UTF-8"?>
<jqassistant-report xmlns="http://schema.jqassistant.org/report/v1.8"></jqassistant-report>

When I run mvn jqassistant:effective-rules it always gives the following result:

[INFO] Groups [0]
[INFO] Constraints [0]
[INFO] Concepts [0]

Anyone who has a working example?

Marc
  • 83
  • 7

1 Answers1

2

jQAssistant comes with a very limited set of rules that can be applied out-of-the-box for verifying common mistakes (i.e. constraints). As of that the Java plugin mainly provides concepts that may be used if creating your own constraints.

There's one exception to it and that's the Spring plugin. It comes with a set of constraints to enforce best practices if working with the Spring Framework. Nevertheless the constraints need to be activated, the best way to do it is to activate one of the groups spring-boot:Default or spring-boot:Strict:

<plugin>
    <groupId>com.buschmais.jqassistant</groupId>
    <artifactId>jqassistant-maven-plugin</artifactId>
    <version>1.9.0</version>
    <executions>
        <execution>
            <id>default-cli</id>
            <goals>
                <goal>scan</goal>
                <goal>analyze</goal>
            </goals>
            <configuration>
                <groups>
                    <group>spring-boot:Strict</group>
                    <!--
                    <group>spring-boot:Default</group>
                    -->
                    <group>Default</group>
                </groups>
            </configuration>
        </execution>
    </executions>
</plugin>

(see https://101.jqassistant.org/getting-started-spring-boot-maven/)

Dirk Mahler
  • 1,186
  • 1
  • 6
  • 7
  • Is there any configuration that outputs the results from the Spring plugin into a HTML report (rule, file, line, etc.)? The console output after `mvn install` executions works, but is a little bit limited to work with. Or is it intended that we create the HTML templates ourself? – Sp0tlight May 09 '21 at 14:28
  • You can use another Maven goal that is used for generating sites: `mvn jqassistant:report `. It transforms the XML report into an HTML page containing all results, it will is stored in the target/site folder of the according Maven module – Dirk Mahler May 09 '21 at 18:17