How to run mvn jqassistant:report via pom.xml?

73 Views Asked by At

I am trying to configure jqassistant-maven-plugin version 2.0.7 in my pom.xml. Specifically, I want to create the report generated by the command mvn jqassistant:report. I thought I could simply add a goal, like so:

<plugin>
  <groupId>com.buschmais.jqassistant</groupId>
  <artifactId>jqassistant-maven-plugin</artifactId>
  <version>2.0.7</version>
  <executions>
     <execution>
       <id>default</id>
       <goals>
          <goal>scan</goal>
          <goal>analyze</goal>
          <goal>report</goal> <!-- doesn't generate a report -->
       </goals>
     </execution>
  </executions>
</plugin>

To clarify, I am looking to have the site folder generated. It is only there because I executed the command manually.

File structure

I also have a config file jqassistant.yml located in .jqassistant at top-level. Any idea what I have to do, I couldn't find anything in the documentation.

As a side question, before upgrading the pom.xml also had the following config which I don't know how to migrate, if necessary at all:

<configuration>
  <xmlReportFile>${project.build.directory}/jqassistant/report.xml</xmlReportFile>
</configuration>

As mentioned, to trigger the report-generation I simply tried adding the <goal>report<goal>. For the xmlReportFile I tried adding in the yml-config with no success like outlined in the comments:

jqassistant:
  plugins:
    - group-id: org.jqassistant.contrib.plugin
      artifact-id: jqassistant-java-ddd-plugin
      version: 1.8.1
  analyze:
    groups:
      - java-ddd:Default
      - java-ddd:Strict
    report:
      fail-on-severity:
        - MAJOR
#      xml-report-file:
#        - ${project.build.directory}/jqassistant/jqassistant-report.xml
#      properties:
#        xml-report-file:
#          - ${project.build.directory}/jqassistant/jqassistant-report.xml
#  report:
#    xml-report-file:
#      - ${project.build.directory}/jqassistant/jqassistant-report.xml
#    properties:
#      xml-report-file:
#        - ${project.build.directory}/jqassistant/jqassistant-report.xml
1

There are 1 best solutions below

1
Dirk Mahler On

The jqassistant:report goal by default is bound to the lifecycle phase site. So if you want to have this goal executed for "mvn install" then you'll need to specify a separate execution for it with a lifecycle phase "verify" or "install".