I am trying to integrate SonarQube runner in my build process. My build steps consists of an ant build and sonar-runner task. I have attached the Screenshots later. I am getting an error stating "
Unable to determine database dialect to use within sonar with dialect
null jdbc url localhost
Build step 'Invoke Standalone SonarQube Analysis' marked build as failure
"-
[MyProject] $ /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Default-SonarQube-Runner/bin/sonar-runner -X -e -Dsonar.jdbc.url=localhost ******** ******** -Dsonar.host.url=http://qa.MyProject.com:9000 ******** ******** -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject -Dproject.settings=/var/lib/jenkins/workspace/MyProject/sonar-project.properties
SonarQube Runner 2.4
Java 1.7.0_95 Oracle Corporation (64-bit)
Linux 3.13.0-48-generic amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Default-SonarQube-Runner/conf/sonar-runner.properties
INFO: Project configuration file: /var/lib/jenkins/workspace/MyProject/sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /var/lib/jenkins/workspace/MyProject/.sonar
INFO: SonarQube Server 5.1
07:06:34.641 INFO - Load global repositories
07:06:34.651 DEBUG - Download: http://qa.MyProject.com:9000/batch/global (no proxy)
07:06:34.744 INFO - Load global repositories (done) | time=105ms
07:06:34.745 INFO - Server id: 20160304110723
07:06:34.747 INFO - User cache: /var/lib/jenkins/.sonar/cache
07:06:34.755 INFO - Install plugins
07:06:34.755 DEBUG - Download index of plugins
07:06:34.755 DEBUG - Download: http://qa.MyProject.com:9000/deploy/plugins/index.txt (no proxy)
07:06:34.841 DEBUG - Loaded 2196 properties from l10n bundles
07:06:34.842 INFO - Install JDBC driver
07:06:34.842 DEBUG - Download index of jdbc-driver
07:06:34.842 DEBUG - Download: http://qa.MyProject.com:9000/deploy/jdbc-driver.txt (no proxy)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.681s
Final Memory: 3M/59M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: Unable to determine database dialect to use within sonar with dialect null jdbc url localhost
Build step 'Invoke Standalone SonarQube Analysis' marked build as failure
Finished: FAILURE
Inside my Jenkins->Manage Jenkins->Configure System , I have configured the sonar qube section as shown in the screenshot below-
Here is the screenshot of my build config-
I am not getting the clue on how to debug ? Any suggestion ?
Here are the version details-
SonarQube Runner 2.4
Sonar Version 5.1
Can you double check if you are specifying the correct JDBC URL. In the screenshot attached, SonarQube is configured with datasource URL as 'localhost'.
The stacktrace again says you do not have a database dialect specified. This can be specified in the sonar properties file.
I realised, what was wrong here. I had added incorrect database dialect in my jenkins configuration (Jenkins->Manage Jenkins->Configure System). See the screenshot. Earlier i had used
localhost
instead of
jdbc:mysql://localhost:3306/sonar?autoReconnect=true&useUnicode=true&characterEncoding=utf8
Related
I am trying to analyze my project with sonarqube scanner in Jenkins. However when I'm building job it's always reporting some kind of an error, more exactly:
INFO: Option -e/--errors is no longer supported and will be ignored
INFO: Scanner configuration file: /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarScanner1/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_151 Oracle Corporation (64-bit)
INFO: Linux 4.9.60-linuxkit-aufs amd64
INFO: User cache: /var/jenkins_home/.sonar/cache
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=232ms
INFO: Server id: AWEptYvpPRWpK4xbT0G4
INFO: User cache: /var/jenkins_home/.sonar/cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=124ms
INFO: SonarQube server 6.7.1
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Process project properties
ERROR: Invalid value of sonar.sources for test
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 3.218s
INFO: Final Memory: 42M/114M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: The folder 'polacpat/Documents/Jenkins2/workspace/SonarScanningTestProject/src/test' does not exist for 'test' (base directory = /var/jenkins_home/workspace/SonarScanningTestProject)
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE
Those are my Sonarqube analysis properties
AnalysisProperties
This is location of my project, it's automatically created because code is from gitlab...
Project Location
Now I don't really understand how does this work and how should I configure it. I have added the same name to a new sonarqube project and also sonarqube project key I have created within a sonarqube which is connected with a jenkins to those analyse properties in here, I don't understand how exactly does this works...
Updated folder:
Wrong Folder Being Analysed
Updated second error log after trying to set: sonar.sources=./src or
sonar.sources=./src/main
11:19:28.650 ERROR: Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property
at org.sonar.java.JavaClasspath.init(JavaClasspath.java:59)
at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:281)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:141)
at org.sonar.java.JavaSquid.<init>(JavaSquid.java:83)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:83)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:111)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
11:19:28.651 DEBUG: Execution getVersion
11:19:28.656 DEBUG: Execution stop
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE
"Invalid value of sonar.sources for test"
sonar.sources must be relative to worskspace
sonar.sources=./src/test
And
Please provide compiled classes of your project with sonar.java.binaries property
means you need set sonar.java.binaries pointing to binaries
sonar.java.binaries=target/classes
See sonar paramenters
I'm trying to use Tycho Maven to build an RCP application in Jenkins. The build works fine from the command line and even in Jenkins (when I use the appropriated settings.xml file to resolve the artifacts using my Artifactory server) but as soon as I enable the Artifactory plugin in the job configuration I get the following error:
Checking out Revision 6e23fe54a2fef24e13e4c08551c132c7932392a9 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 6e23fe54a2fef24e13e4c08551c132c7932392a9
First time build. Skipping changelog.
Jenkins Artifactory Plugin version: 2.8.2
Artifactory integration is enabled
[ConsolePOMlss] $ /var/lib/jenkins/tools/hudson.model.JDK/JDK1.8/bin/java -classpath /usr/share/maven/boot/plexus-classworlds-2.x.jar -Dmaven.home=/usr/share/maven -DbuildInfoConfig.propertiesFile=/tmp/buildInfo1521811850289716273.properties -Dm3plugin.lib=/var/lib/jenkins/cache/artifactory-plugin/2.8.2 -Dclassworlds.conf=/tmp/classworlds2157837551391886905conf -Dmaven.multiModuleProjectDirectory=/var/lib/jenkins/workspace/BigItem/ConsolePOMlss org.codehaus.plexus.classworlds.launcher.Launcher clean verify
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
/var/lib/jenkins/workspace/BigItem/ConsolePOMlss/bundles/com.acme.jdom/.polyglot.build.properties
/var/lib/jenkins/workspace/BigItem/ConsolePOMlss/bundles/com.acme.clientserverkit/.polyglot.build.properties
/var/lib/jenkins/workspace/BigItem/ConsolePOMlss/bundles/com.acme.items.datastoreclasses/.polyglot.build.properties
/var/lib/jenkins/workspace/BigItem/ConsolePOMlss/bundles/com.acme.ui.utilities/.polyglot.build.properties
/var/lib/jenkins/workspace/BigItem/ConsolePOMlss/bundles/com.acme.ui.debug/.polyglot.build.properties
/var/lib/jenkins/workspace/BigItem/ConsolePOMlss/bundles/com.acme.items.console/.polyglot.build.properties
[main] ERROR org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener - Failed while enforcing Artifactory artifact resolver
org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
role: org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseArtifactResolver
roleHint:
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:243)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:237)
at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener.enforceArtifactoryResolver(ArtifactoryEclipseRepositoryListener.java:71)
at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener.contextualize(ArtifactoryEclipseRepositoryListener.java:258)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.contextualize(PlexusLifecycleManager.java:282)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.activate(PlexusLifecycleManager.java:203)
at org.eclipse.sisu.bean.BeanScheduler$Pending.activate(BeanScheduler.java:156)
at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:185)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
at org.eclipse.sisu.wire.EntrySetAdapter$ValueIterator.next(EntrySetAdapter.java:102)
at org.eclipse.aether.internal.impl.DefaultRepositoryEventDispatcher.dispatch(DefaultRepositoryEventDispatcher.java:91)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.artifactResolving(DefaultArtifactResolver.java:662)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:276)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:267)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:198)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:202)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveInternal(DefaultPluginDependenciesResolver.java:202)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:149)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.resolveExtensionArtifacts(DefaultMavenPluginManager.java:908)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupExtensionsRealm(DefaultMavenPluginManager.java:839)
at org.apache.maven.project.DefaultProjectBuildingHelper.createProjectRealm(DefaultProjectBuildingHelper.java:196)
at org.apache.maven.project.DefaultModelBuildingListener.buildExtensionsAssembled(DefaultModelBuildingListener.java:99)
at org.apache.maven.model.building.ModelBuildingEventCatapult$1.fire(ModelBuildingEventCatapult.java:44)
at org.apache.maven.model.building.DefaultModelBuilder.fireEvent(DefaultModelBuilder.java:1295)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:441)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:421)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:620)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:411)
at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.util.NoSuchElementException
at java.util.Collections$EmptyIterator.next(Collections.java:4189)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
... 61 more
I'm using:
Jenkins 2.32.1
Artifactory Plig-in 2.8.2
Tycho 0.26.0
maven 3.3.9
Some more information ... This is the point where my build in Jenkins with Maven-3-Artifactory enabled an the build with Maven-3-Artifactory differ. It seems that it doesn't have to do with my sources but a bug in the plugin.
With Maven-3-Artifactory Integration enabled:
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
[main] DEBUG org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener - Enforcing Artifactory artifact resolver
[main] ERROR org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener - Failed while enforcing Artifactory artifact resolver
org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
role: org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseArtifactResolver
roleHint:
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:243)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:237)
at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener.enforceArtifactoryResolver(ArtifactoryEclipseRepositoryListener.java:71)
at org.jfrog.build.extractor.maven.resolver.ArtifactoryEclipseRepositoryListener.contextualize(ArtifactoryEclipseRepositoryListener.java:258)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.contextualize(PlexusLifecycleManager.java:282)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.activate(PlexusLifecycleManager.java:203)
at org.eclipse.sisu.bean.BeanScheduler$Pending.activate(BeanScheduler.java:156)
at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:185)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
And with Maven-3-Artifactory Integration disabled:
[INFO] Scanning for projects...
/home/jmorcate/bundles/com.acme.packageA/.polyglot.build.properties
/home/jmorcate/bundles/com.acme.packageB/.polyglot.build.properties
/home/jmorcate/bundles/com.acme.utilities/.polyglot.build.properties
/home/jmorcate/bundles/com.acme.ui.debug/.polyglot.build.properties
/home/jmorcate/bundles/nato.ncia.sssb.cloud22.console/.polyglot.build.properties
/home/jmorcate/features/com.acme.feature/.polyglot.build.properties
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=81, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=40, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=4, ConflictResolver.conflictItemCount=80, DefaultDependencyCollector.collectTime=178, DefaultDependencyCollector.transformTime=5}
We got the same issue due to takari extentions in "${project.basedir}/.mvn/extensions.xml" folder. Everything works after extensions were disabled.
Despite you did not specify that i am sure that you use it.
I have added a SonarQube Scanner analysis step to my Jenkins build, but the step fails:
[Test_gitlab] $ /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/http_INTERNAL_DOCKER_IP_ADDRESS_9000/bin/sonar-scanner -e -Dsonar.host.url=SERVER_IP_ADDRESS:9000 ******** -Dsonar.projectBaseDir=/var/jenkins_home/workspace/Test_gitlab
INFO: Option -e/--errors is no longer supported and will be ignored
INFO: Scanner configuration file: /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/http_INTERNAL_DOCKER_IP_ADDRESS_9000/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.8
INFO: Java 1.8.0_102 Oracle Corporation (64-bit)
INFO: Linux 3.10.0-327.10.1.el7.x86_64 amd64
INFO: User cache: /var/jenkins_home/.sonar/cache
ERROR: SonarQube server [SERVER_IP_ADDRESS:9000] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.214s
INFO: Final Memory: 4M/209M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:93)
at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
... 8 more
Caused by: java.lang.IllegalArgumentException: unexpected url: SERVER_IP_ADDRESS:9000/batch_bootstrap/index
at org.sonarsource.scanner.api.internal.shaded.okhttp.Request$Builder.url(Request.java:141)
at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:109)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
at org.sonarsource.scanner.api.internal.Jars.downloadFiles(Jars.java:78)
... 11 more
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE
My SonarQube Scanner is declared in Jenkins Global Tool Configuration. The name used is "http://SERVER_IP_ADDRESS:9000". This is the same address as the server base URL that I have set within SonarQube General Settings.
I'm using Docker: Jenkins is in a Docker container, and so does SonarQube.
The "unexpected url" mentioned in the stacktrace SERVER_IP_ADDRESS:9000/batch_bootstrap/index can be opened in a browser,
which displays sonar-scanner-engine-shaded-6.1.jar|SOME_LETTERS_AND_NUMBERS.
So why can't Jenkins reach the server?
I've also tried with Docker internal IP address, that can be found with:
docker inspect SONARQUBE_CONTAINER_ID | grep IP
Find place where you define the "unexpected url" mentioned in the stacktrace (parameter sonar.host.url of SonarQube Scanner) and prefix it with http://.
URLs must start with a scheme - see Wikipedia. Browser simply adds http:// by default.
I will need your help please.
This is the context, I'm trying to set up a Continous Integration plateform, for specifc needs, and this is my Configuration, all in the same machine(Windows 7 ):
SonarQube 5.1 (I tried both internal and external databases)
SonarQube runner 2.4
PHP plugin for Sonar
Jenkins 1.6
SonarQube plugin for Jenkins (I'have already done all of the Sonarqube config in Jenkins)
I created a specific Job for PHP (Which is a local folder in my file system)(I configured the build section of Jenkins bu adding Standalone SonarQube Analysis, with the specific Path to projeetc proporties which point to my sonar-project.properties behind )
sonar.projectKey=my:project
sonar.projectName=PHP project analyzed with the SonarQube Runner reusing PHPUnit reports
sonar.projectVersion=1.0
sonar.sources=userthing,test sonar.tests=test sonar.language=php sonar.sourceEncoding=UTF-8 # Reusing PHPUnit reports #sonar.php.coverage.reportPath=reports/phpunit.coverage.xml #sonar.php.tests.reportPath=reports/phpunit.xml
When I launch a build from Jenkins I have this error :
NFO: Work directory: C:\Users\user\.jenkins\jobs\test projet\workspace\.sonar
INFO: SonarQube Server 5.1.2
14:13:10.295 INFO - Load global repositories
14:13:10.372 INFO - Load global repositories (done) | time=78ms
14:13:10.374 INFO - Server id: 20151028133512
14:13:10.374 INFO - User cache: C:\Users\user\.sonar\cache
14:13:10.379 INFO - Install plugins
14:13:10.706 INFO - Install JDBC driver
14:13:10.710 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
14:13:11.247 INFO - Initializing Hibernate
14:13:12.106 ERROR - Invalid value of sonar.tests for my:project
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 2.131s
Final Memory: 6M/20M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: The folder 'test' does not exist for 'my:project' (base directory = C:\Users\user\.jenkins\jobs\test projet\workspace)
at org.sonar.batch.scan.ProjectReactorBuilder.checkExistenceOfPaths(ProjectReactorBuilder.java:427)
at org.sonar.batch.scan.ProjectReactorBuilder.validateDirectories(ProjectReactorBuilder.java:334)
at org.sonar.batch.scan.ProjectReactorBuilder.defineRootProject(ProjectReactorBuilder.java:163)
at org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:110)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:86)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Lancer une analyse SonarQube autonome' marked build as failure
Finished: FAILURE
I follow those steps to identify the root concern:
I created manually sonar-project.properties.
Lunch sonar-runner.bat directly from my php folder, => then it works perfectly I have all the metric.
I'm sure that the root cause is Jenkins, but I don't know exactly what I'm missing.
Even if some times everything seems to work fine, I got this message from stacktrace
0 file indexed
:
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\DevTools\sonar-runner-2.4\conf\sonar-runner.properties
INFO: Project configuration file: C:\Users\user\Desktop\Exemple de projet PHPUNIT\sonar-project.properties
INFO: Default locale: "fr_FR", source code encoding: "UTF-8"
INFO: Work directory: C:\Users\user\.jenkins\jobs\projet\workspace\.sonar
INFO: SonarQube Server 5.1.2
14:55:20.977 INFO - Load global repositories
14:55:21.040 INFO - Load global repositories (done) | time=63ms
14:55:21.040 INFO - Server id: 20151028133512
14:55:21.040 INFO - User cache: C:\Users\user\.sonar\cache
14:55:21.040 INFO - Install plugins
14:55:21.390 INFO - Install JDBC driver
14:55:21.390 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
14:55:21.918 INFO - Initializing Hibernate
14:55:22.858 INFO - Load project repositories
14:55:23.030 INFO - Load project repositories (done) | time=172ms
14:55:23.030 INFO - Load project settings
14:55:23.326 INFO - Load technical debt model
14:55:23.358 INFO - Apply project exclusions
14:55:23.498 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
14:55:23.498 INFO - ------------- Scan My Sonar Analyses for PHP project
14:55:23.498 INFO - Load module settings
14:55:23.576 INFO - Language is forced to php
14:55:23.576 INFO - Load rules
14:55:23.864 INFO - Base dir: C:\Users\user\.jenkins\jobs\projet\workspace
14:55:23.864 INFO - Working dir: C:\Users\user\.jenkins\jobs\projet\workspace\.sonar
14:55:23.864 INFO - Source paths: .
14:55:23.864 INFO - Source encoding: UTF-8, default locale: fr_FR
14:55:23.864 INFO - Index files
14:55:23.866 INFO - **0 files indexed******************************
14:55:23.866 INFO - Quality profile for php: Sonar way
14:55:24.095 INFO - Sensor Lines Sensor
14:55:24.095 INFO - Sensor Lines Sensor (done) | time=0ms
14:55:24.095 INFO - Sensor QProfileSensor
14:55:24.105 INFO - Sensor QProfileSensor (done) | time=10ms
14:55:24.105 INFO - Sensor InitialOpenIssuesSensor
14:55:24.120 INFO - Sensor InitialOpenIssuesSensor (done) | time=15ms
14:55:24.120 INFO - Sensor ProjectLinksSensor
14:55:24.128 INFO - Sensor ProjectLinksSensor (done) | time=8ms
14:55:24.128 INFO - Sensor VersionEventsSensor
14:55:24.133 INFO - Sensor VersionEventsSensor (done) | time=5ms
14:55:24.133 INFO - Sensor SCM Sensor
14:55:24.133 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
14:55:24.133 INFO - Sensor SCM Sensor (done) | time=0ms
14:55:24.133 INFO - Sensor CPD Sensor
14:55:24.133 INFO - DefaultCpdEngine is used for php
14:55:24.133 INFO - Sensor CPD Sensor (done) | time=0ms
14:55:24.133 INFO - No quality gate is configured.
14:55:24.163 INFO - Compare to previous analysis (2015-10-28)
14:55:24.165 INFO - Compare over 30 days (2015-09-28, analysis of Wed Oct 28 14:39:55 CET 2015)
14:55:24.267 INFO - Execute decorators...
14:55:24.372 INFO - Store results in database
14:55:24.425 INFO - Analysis reports generated in 35ms, dir size=2 KB
14:55:24.435 INFO - Analysis reports compressed in 10ms, zip size=2 KB
14:55:24.459 INFO - Analysis reports sent to server in 23ms
14:55:24.460 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/projet
14:55:24.460 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 3.851s
Final Memory: 13M/113M
INFO: ------------------------------------------------------------------------
Finished: SUCCESS
It seems like his enable to index files that I have in my php folder.
Thanks in advance for your help!
I found the root cause, as I suggested in my last comment Jenkis is the root concern, because, I wasn't aware how Jenkins, build non source Controle Projects.
In fact you have to follow those steps in order to copy your projet into Jenkis workspace:
Build the Project at least once, (it will fail), but Jenkins will
create the structure jenkins/workspace/PROJECTNAME/
Copy the project files to jenkins/workspace/PROJECTNAME/
Build again and configure appropriately
For more information in the subject, I will suggest that you look jenkins docs:Builds for Non-Source Control Projects
I installed Sonar and I have already used sonarrunner by command line and It worked fine, but when I tried to integrate with Jenkins, the autommated process failed with the following error, anyone knows how to solve this?
[default] $ C:\sonarqube-4.0\sonar-runner-2.3\bin\sonar-runner.bat -Dsonar.jdbc.driver=org.postgresql.Driver -Dsonar.jdbc.url=sonar.jdbc.url=jdbc:postgresql://10.2.1.5/sonarqube ******** ******** -Dsonar.host.url=http://localhost:9000 ******** ******** "-Dsonar.projectBaseDir=C:\Program Files (x86)\Jenkins\jobs\Project\workspace\default"
C:\sonarqube-4.0\sonar-runner-2.3
SonarQube Runner 2.3
Java 1.7.0_25 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
INFO: Runner configuration file: C:\sonarqube-4.0\sonar-runner-2.3\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "pt_BR", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: C:\Program Files (x86)\Jenkins\jobs\Project\workspace\default\.sonar
INFO: SonarQube Server 4.0
16:21:06.107 INFO - Load batch settings
16:21:08.700 INFO - User cache: C:\.sonar\cache
16:21:08.734 INFO - Install plugins
16:21:13.244 INFO - Install JDBC driver
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 34.683s
Final Memory: 2M/59M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Unable to determine database dialect to use within sonar with dialect null jdbc url sonar.jdbc.url=jdbc:postgresql://10.2.1.5/sonarqube
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
Finished: FAILURE
There is a typo in your property definitions: -Dsonar.jdbc.url=sonar.jdbc.url=jdbc:postgresql://10.2.1.5/sonarqube should read -Dsonar.jdbc.url=jdbc:postgresql://10.2.1.5/sonarqube