I was using sonar-maven-plugin to scan my test project and send the issues to sonarQube I have already configured, the problem is the issues was only sended at the first time I run mvn sonar:sonar command, when I add some ‘smell code’ to the project and run mvn clean install, mvn sonar:sonar again, I find the issues in sunarQube did not changed.
- My maven and sonar plugin version:
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: D:\program\maven\apache-maven-3.5.4\bin\..
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: D:\program\jdk\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
sonar-maven-plugin:3.5.0.1254:sonar (default-cli)
sonarQube version is 7.3(build 15553).
- One of the code smell issue in sonarQube by first sonar scan:
public interface IssuesMapper {
// int deleteByPrimaryKey(Long id);
//
// int insert(Issues record);
//
// int insertSelective(Issues record);
Issues selectByPrimaryKey(Long id);
}
This block of commented-out lines of code should be removed.
- After that, I add a new java file just copy the smell code:
public interface TestMapper {
// int deleteByPrimaryKey(Long id);
//
// int insert(Issues record);
//
// int insertSelective(Issues record);
Issues selectByPrimaryKey(Long id);
}
- And run the maven command again:
Mvn clean
Mvn -X sonar:sonar -Dsonar.host.url=http://host:port -Dsonar.login=name -Dsonar.password=password -Dsonar.analysis.mode=preview
But there are no more new smell code issue.
It’s there any mistake I made in code scan? How can I scan and send the new issues when I edit my code?
Thanks!