Sonarqube MyBatis plugin not work

Hi Guys.

I installed the MyBatis plugin on Sonarqube.

I wrote de mapper.xml file with the wrong content:

<mapper namespace="sql1" number="1">

    <select id="select1" parameterType="map" resultType="String">

        SELECT * FROM USERS

        WHERE USER_WRONG TEST

        name LIKE #{name} AND num = #{number}

        AND WRONG SINTAXE TEST

    </select>

</mapper>

When I execute the sonar-scanner the results show me success, but I have errors on sql statement.
Can you help me?

See logs:


PS C:\projetos\plsql-test> sonar-scanner.bat -D"sonar.projectKey=plsql-test" -D"sonar.sources=." -D"sonar.host.url=http://localhost:9000" -D"sonar.login=76b94364ff585156a4e11935161cd0b5d7cf4c93"
INFO: Scanner configuration file: C:\software\sonar-scanner-4.7.0.2747-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.7.0.2747
INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\MasterSupMbi\.sonar\cache
INFO: Scanner configuration file: C:\software\sonar-scanner-4.7.0.2747-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 9.4.0
INFO: Default locale: "pt_BR", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=64ms
INFO: Server id: 243B8A4D-AYCpH4paiJhY1Q15vFad
INFO: User cache: C:\Users\MasterSupMbi\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=43ms
INFO: Load/download plugins (done) | time=139ms
INFO: Process project properties
INFO: Process project properties (done) | time=11ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: plsql-test
INFO: Base dir: C:\projetos\plsql-test
INFO: Working dir: C:\projetos\plsql-test\.scannerwork
INFO: Load project settings for component key: 'plsql-test'
INFO: Load project settings for component key: 'plsql-test' (done) | time=13ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=44ms
INFO: Load active rules
INFO: Load active rules (done) | time=755ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=16ms
INFO: Indexing files...
INFO: Project configuration:
INFO: 2 files indexed
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module plsql-test
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=29ms
INFO: Sensor JQA [jqassistant]
INFO: No jQAssistant report found, skipping.
INFO: Sensor JQA [jqassistant] (done) | time=2ms
INFO: Sensor MyBatisLint Sensor [mybatis]
INFO: stmtIdExcludeList: []
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.dom4j.io.SAXContentHandler (file:/C:/Users/MasterSupMbi/.sonar/cache/b78066c8efea5b98471745ced3106cb1/sonar-mybatis-plugin.jar_unzip/META-INF/lib/dom4j-1.6.1.jar) to method com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser$LocatorProxy.getEncoding()
WARNING: Please consider reporting this to the maintainers of org.dom4j.io.SAXContentHandler
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor MyBatisLint Sensor [mybatis] (done) | time=82ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=4ms
INFO: Sensor CSS Rules [javascript]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=9ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=10ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=2ms
INFO: Sensor XML Sensor [xml]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed
INFO: Sensor XML Sensor [xml] (done) | time=157ms
INFO: Sensor Text Sensor [text]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed
INFO: Sensor Text Sensor [text] (done) | time=6ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=2ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=12ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=1ms
INFO: SCM Publisher is disabled
INFO: CPD Executor Calculating CPD for 0 files
INFO: CPD Executor CPD calculation finished (done) | time=0ms
INFO: Analysis report generated in 58ms, dir size=112.6 kB
INFO: Analysis report compressed in 24ms, zip size=14.0 kB
INFO: Analysis report uploaded in 24ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: http://localhost:9000/dashboard?id=plsql-test
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=AYCuB3i0fYaZjm7Mtuuq
INFO: Analysis total time: 3.406 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 5.369s
INFO: Final Memory: 16M/60M
INFO: ------------------------------------------------------------------------
PS C:\projetos\plsql-test> sonar-scanner.bat -D"sonar.projectKey=plsql-test" -D"sonar.sources=." -D"sonar.host.url=http://localhost:9000" -D"sonar.login=76b94364ff585156a4e11935161cd0b5d7cf4c93"
INFO: Scanner configuration file: C:\software\sonar-scanner-4.7.0.2747-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.7.0.2747
INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\MasterSupMbi\.sonar\cache
INFO: Scanner configuration file: C:\software\sonar-scanner-4.7.0.2747-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 9.4.0
INFO: Default locale: "pt_BR", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=70ms
INFO: Server id: 243B8A4D-AYCpH4paiJhY1Q15vFad
INFO: User cache: C:\Users\MasterSupMbi\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=48ms
INFO: Load/download plugins (done) | time=143ms
INFO: Process project properties
INFO: Process project properties (done) | time=11ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: plsql-test
INFO: Base dir: C:\projetos\plsql-test
INFO: Working dir: C:\projetos\plsql-test\.scannerwork
INFO: Load project settings for component key: 'plsql-test'
INFO: Load project settings for component key: 'plsql-test' (done) | time=18ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=49ms
INFO: Load active rules
INFO: Load active rules (done) | time=738ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=16ms
INFO: Indexing files...
INFO: Project configuration:
INFO: 2 files indexed
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module plsql-test
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=27ms
INFO: Sensor JQA [jqassistant]
INFO: No jQAssistant report found, skipping.
INFO: Sensor JQA [jqassistant] (done) | time=3ms
INFO: Sensor MyBatisLint Sensor [mybatis]
INFO: stmtIdExcludeList: []
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.dom4j.io.SAXContentHandler (file:/C:/Users/MasterSupMbi/.sonar/cache/b78066c8efea5b98471745ced3106cb1/sonar-mybatis-plugin.jar_unzip/META-INF/lib/dom4j-1.6.1.jar) to method com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser$LocatorProxy.getEncoding()
WARNING: Please consider reporting this to the maintainers of org.dom4j.io.SAXContentHandler
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
WARN: org.dom4j.DocumentException: Error on line 5 of document file:///C:/projetos/plsql-test/plsql-test/mapper.xml : As estruturas do documento XML devem começar e terminar com a mesma entidade. Nested exception: As estruturas do documento XML devem começar e terminar com a mesma entidade.
INFO: Sensor MyBatisLint Sensor [mybatis] (done) | time=97ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
INFO: Sensor CSS Rules [javascript]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=1ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=15ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=3ms
INFO: Sensor XML Sensor [xml]
INFO: 1 source file to be analyzed
WARN: Unable to analyse file file:///C:/projetos/plsql-test/plsql-test/mapper.xml;
INFO: 1/1 source file has been analyzed
INFO: Sensor XML Sensor [xml] (done) | time=97ms
INFO: Sensor Text Sensor [text]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed
INFO: Sensor Text Sensor [text] (done) | time=7ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=0ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=17ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=4ms
INFO: SCM Publisher is disabled
INFO: CPD Executor Calculating CPD for 0 files
INFO: CPD Executor CPD calculation finished (done) | time=0ms
INFO: Analysis report generated in 76ms, dir size=112.4 kB
INFO: Analysis report compressed in 20ms, zip size=13.6 kB
INFO: Analysis report uploaded in 26ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: http://localhost:9000/dashboard?id=plsql-test
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=AYCuB-11fYaZjm7Mtuur
INFO: Analysis total time: 3.305 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 5.233s
INFO: Final Memory: 16M/64M
INFO: ------------------------------------------------------------------------

Hi,

Welcome to the community!

The MyBatis plugin is supported by the community. It’s possible its maintainers will see this, but you’ll have more luck creating an issue on that project.

 
HTH,
Ann