sonar jenkins run intenta conectarse a h2

I have installed SonarQube 4.2 -
it is running against Oracle XE am running Jenkins on Tomcat 6.x

I have sonar configured with Jenkins ( NOT Sonar runner )

am trying to run a Jenkins job and then invoke Sonar through : "Invoke top level maven targets"

Here I am invoking the command:

-e clean install sonar:sonar -Dsonar.dynamicAnalysis=reuseReports -Dsonar.projectVersion=ABC-${BUILD_NUMBER} -Dsonar.forceAnalysis=true

The issue is that the job fails with the following exception:

INFO: SonarQube Server 4.2

[INFO] [16:10:29.258] Load batch settings

[INFO] [16:10:30.038] User cache: C:\Users\xyz\.sonar\cache
[INFO] [16:10:30.053] Install plugins
[INFO] [16:10:30.381] Install JDBC driver
[WARN] [16:10:30.381] H2 database should be used for evaluation purpose only
[INFO] [16:10:30.381] Create JDBC datasource for jdbc:h2:tcp://localhost/sonar

[ERROR] Fail to connect to database
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Fail to connect to database

Connection refused: connect
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Fail to connect to database

I have checked and it is configured to work with OracleXE

My project that is executed has the following entry in its pom ( maven2 ) <plugin> <groupId>org.codehaus.sonar</groupId> <artifactId>sonar-maven-plugin</artifactId> <version>4.2</version> </plugin>

Muchas Gracias

preguntado el 28 de mayo de 14 a las 12:05

1 Respuestas

You need to configure maven to actually use the correct database when you use the maven goal. This is done in your settings.xml archivo.

Please refer to the documentation for how to configure it:

contestado el 28 de mayo de 14 a las 12:05

Thanks @benzonico - but I do not think that this is needed if I am invoking maven through jenkins and in jenkins I am configuring sonar credentials including database details - and I am positive I have had it work this way some months back without having the need to configure database in settings.xml - Akila

got it to work-the link on so helped : [link]… I did not have sonar runner installed - was confused Jenkins was providing sonar-runner and sonar - so for those who are confused - visit the link - has the details My problem was idiotic - I was trying to run sonar through Post Steps Invoke Top level Maven targets and when I changed it to **Post-build actions Sonar' it worked for me - hope that this is useful to others and yes you do not need to configure database in settings.xml in this case - Akila

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.