Which sonar-maven-plugin version to use?

匿名 (未验证) 提交于 2019-12-03 01:18:02

问题:

I am wondering which sonar-maven-plugin in which version I should use. As far as I know there is a org.codehaus.mojo version and two org.codehaus.sonar versions (sonar-maven3-plugin, sonar-maven-plugin).

As far as I understand the sonar-maven3-plugin is now deprecated and the org.codehaus.sonar:sonar-maven-plugin should be used instead. However those org.codehaus.sonar version are tied to a certain version of the sonar server, therefore it makes probably no sense to use them directly. To be able to deal with this there is the org.codehaus.mojo:sonar-maven-plugin which checks which sonar version the server has and from there checks which org.codehaus.sonar:sonar-maven-plugin to use.

So in order to have a maven pom that is independent of the Sonar Server Version one should probably use the org.sonar.mojo:sonar-maven-plugin:RELEASE version to be safe.

Did I get this right?

Any further things to consider?

Thanks

回答1:

As described in the documentation page (see "Project analyzed with Maven 3"), the plugin you have to use is org.codehaus.mojo:sonar-maven-plugin, not the internal one(s).



回答2:

When we were using sonarserver ver 3.7.1 we used to have org.codehaus.sonar:sonar-maven-plugin. Once we migrated from Sonar Server to SonarQube server 4.5+ onwards, we need to use org.codehaus.mojo:sonar-maven-plugin. Currently in our project , we need to compile our code with jdk 6(as it is old project) and run the sonarqube server ver 4.5.7 analysis with java 7 so with java 6 we run the command mvn clean org.jacoco:jacoco-maven-plugin:0.7.4.201502262128:prepare-agent install and while running the sonar analysis we change the jvm to java 7 and execute the command mvn org.codehaus.mojo:sonar-maven-plugin:2.4:sonar -Dsonar -Dsonar.host.url=http://localhost:9000 -Dsonar.dynamicAnalysis=true



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!