porscheinformatik / sonarqube-licensecheck

SonarQube Licensecheck Plugin
Apache License 2.0
156 stars 58 forks source link

How to use the plugin with maven #216

Closed ibarrancos closed 3 years ago

ibarrancos commented 3 years ago

I'm trying to use the plugin with sonarqube community 8.4.2 (build 36762). I installed the plugin on the server, and the options shows as written in README.md.

Sonar01

Sonar02

Then run maven,

mvn clean -DfailOnError=false \
          -Dformats=ALL \
          org.jacoco:jacoco-maven-plugin:prepare-agent \
          verify \
          org.jacoco:jacoco-maven-plugin:report \
          org.owasp:dependency-check-maven:6.0.5:aggregate \
          org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar \
          -Dsonar.dependencyCheck.summarize=true \
          -Dsonar.host.url=https://sonarqube-pru.carm.es \
          -Dsonar.gitlab.project_id=glpi \
          -Dsonar.java.coveragePlugin=jacoco \
          -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml \
          -Dsonar.coverage.exclusions=**/*.html,**/*.css,**/*.png,**/*.jpg,**/*.JPG \
          -Dsonar.junit.reportsPath=target/dependency-check-junit.xml \
          -Dsonar.login=$AUTH_USER_LOGIN \
          -Dsonar.password=$AUTH_USER_PASS  \
          -Dsonar.verbose=true \
          -Dsonar.sourceEncoding=UTF-8

It runs without errors, but does not write any reports with the licenses: find -iname "*licen*" ...it's empty. In the server console, the section also appears empty

Sonar03

I am using Java 11 and maven 3.6.1 on Linux. Also, i have tried sonar-maven-plugin version 3.7.0.1746, and run install instead of verify, but with the same result.

How can I force the plugin to run locally and post the report to the server?

derkoe commented 3 years ago

Did you enable the two rules in the quality profile for the project (https://github.com/porscheinformatik/sonarqube-licensecheck#installation)?

ibarrancos commented 3 years ago

@derkoe thanks for your reply :)

That was the problem, Great!... Thank you so much.

1) I create a new Quality Profile that extends from SonarWay, and configure as default

Pantallazo-01

2) The differences between two Quality Profiles are the license-check rules

Pantallazo-02

3) Then, I run maven and now it does publish the report :)

Pantallazo-03