Hi!
I use sonar-maven-plugin for analyzing my PL/SQL project (it is Oracle Database procedural language). I have coverage and execution reports and want to send them to Sonar using sonar-maven-plugin. I have to provide db username/password to help scanner retrieve data dictionary information. I decided to keep it in servers
block in my settings.xml
file. For getting information from servers
block I use servers-maven-extension
. But unfortunately sonar-maven-plugin fails to connect to DB when I provide username and password in ${servers...}
format. See my sonar properties from pom.xml
:
<sonar.login>${spdb-beholder.sonar.login}</sonar.login>
<sonar.host.url>${spdb-beholder.sonar.host}</sonar.host.url>
<sonar.plsql.jdbc.url>${liquibase.url}</sonar.plsql.jdbc.url>
<sonar.plsql.jdbc.user>${settings.servers.db-dev.username}</sonar.plsql.jdbc.user>
<sonar.plsql.jdbc.password>${settings.servers.db-dev.password}</sonar.plsql.jdbc.password>
<sonar.plsql.jdbc.defaultSchema>${liquibase.user.owner}</sonar.plsql.jdbc.defaultSchema>
<sonar.projectName>spdb-beholder</sonar.projectName>
<sonar.projectKey>spdb-beholder</sonar.projectKey>
<sonar.plsql.file.suffixes>sql,vw,pkb</sonar.plsql.file.suffixes>
<sonar.sources>src/main/resources/migration/compiled</sonar.sources>
<sonar.tests>src/main/resources/migration/tests</sonar.tests>
<sonar.plsql.jdbc.driver>${liquibase.driver}</sonar.plsql.jdbc.driver>
<sonar.plsql.jdbc.driver.path>${project.build.directory}/lib/ojdbc8-12.2.0.1.jar</sonar.plsql.jdbc.driver.path>
<sonar.plsql.jdbc.driver.class>oracle.jdbc.OracleDriver</sonar.plsql.jdbc.driver.class>
<sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
<sonar.language>plsql</sonar.language>
<sonar.coverageReportPaths>${project.build.directory}/coverage-sonar-reporter.xml</sonar.coverageReportPaths>
<sonar.testExecutionReportPaths>${project.build.directory}/sonar-test-reporter.xml</sonar.testExecutionReportPaths>
I noticed that another plugins that have ${servers...}
references in configuration
block under plugin
section work well. But I didn’t manage to make sonar-maven-plugin to work with ${servers...}
references.
I found this article about encrypting passwords for Sonar but I’d rather like to keep it like password
tag of server
.
Are there any other approaches to keep a db password for Sonar Scanner?