java - why sonar:sonar needs mvn install before? -
official documentation http://docs.sonarqube.org/display/sonar/analyzing+with+maven says proper way of invoking sonar is:
mvn clean install -dskiptests=true mvn sonar:sonar
but doesn't why. how sonar work? need compiled classes? why not mvn clean compile
? or need jar file? why not mvn clean package
? sonar plugin?
you can run sonarqube part of single maven command if meet requirements:
- as mithfindel mentions, sonarqube plugins need analyze .class files. , if run unit tests outside of sonarqube, of course testing plugins must read output
test
phase. - got integration tests? need run after
integration-test
phase. - if want run sonarqube true quality gate absolutely must run before
deploy
phase.
one solution attach sonarqube run after package
phase. can full build simple clean install
or clean deploy
. people not because sonarqube time-consuming, incremental mode added in 4.0 , improved in upcoming 4.2 solves this.
as far official documentation goes, it's lot easier "build , run sonar:sonar
" say, "open pom, add build
element sonar-maven-plugin, attach verify
, etc".
one caveat. sonarqube requires java 6, if you're building against jdk 1.5 (still common in large organizations), analysis have happen in separate maven invocation newer jdk selected. solved issue custom maven build wrapper.
Comments
Post a Comment