donhui / sonar-mybatis

MyBatis Plugin for SonarQube: Rules to check SQL statements in MyBatis Mapper XML files
Other
74 stars 21 forks source link

java.lang.IllegalArgumentException : Mapped Statements collection already contains value #13

Closed radboud-asselman closed 5 years ago

radboud-asselman commented 5 years ago

We are tring to run a Sonar scan via Maven an dJenkins. In Sonar we activated the Sonar-mybatis plugin. The following error occurs:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.1.1688:sonar (default-cli) on project xxx: Error parsing Mapper XML. The XML location is 'file [D:\jenkins_home\jobs\xxx\workspace\xxx\xxx.logic\src\nl\xxx\xxx\logic\additionalinformation\persistence\mapper\AdditionalInformationMapper.xml-reduced.xml-reduced.xml]'. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for nl.xxx.xxx.logic.additionalinformation.persistence.mapper.AdditionalInformationMapper.getClientAdditionalInformation. please check file [D:\jenkins_home\jobs\xxx\workspace\xxx\xxx.logic\src\nl\xxx\xxx\logic\additionalinformation\persistence\mapper\AdditionalInformationMapper.xml-reduced.xml] and file [D:\jenkins_home\jobs\xxx\workspace\xxx\xxx.logic\src\nl\xxx\xxx\logic\additionalinformation\persistence\mapper\AdditionalInformationMapper.xml-reduced.xml-reduced.xml] -> [Help 1]

Can anyone help me?

donhui commented 5 years ago

We are tring to run a Sonar scan via Maven an dJenkins. In Sonar we activated the Sonar-mybatis plugin. The following error occurs:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.1.1688:sonar (default-cli) on project xxx: Error parsing Mapper XML. The XML location is 'file [D:\jenkins_home\jobs\xxx\workspace\xxx\xxx.logic\src\nl\xxx\xxx\logic\additionalinformation\persistence\mapper\AdditionalInformationMapper.xml-reduced.xml-reduced.xml]'. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for nl.xxx.xxx.logic.additionalinformation.persistence.mapper.AdditionalInformationMapper.getClientAdditionalInformation. please check file [D:\jenkins_home\jobs\xxx\workspace\xxx\xxx.logic\src\nl\xxx\xxx\logic\additionalinformation\persistence\mapper\AdditionalInformationMapper.xml-reduced.xml] and file [D:\jenkins_home\jobs\xxx\workspace\xxx\xxx.logic\src\nl\xxx\xxx\logic\additionalinformation\persistence\mapper\AdditionalInformationMapper.xml-reduced.xml-reduced.xml] -> [Help 1]

Can anyone help me?

The plugin will generate some temp xml files which suffix are -reduced.xml, and will remove them if the maven task executes successfully. But if failed, the temp file will not be removed. Please make sure your sonar-mybatis plugin version is latest(now is 1.0.4). And then running the Jenkins Job with a clean workspace. If it still has exception, please provide the message again.

radboud-asselman commented 5 years ago

That's it. Temp file is not removed. Only the sonar scan returns other error. I will create a new issue.