Sagacify / sonar-scala

Sonarqube plugin for scala analysis
GNU Lesser General Public License v3.0
58 stars 32 forks source link

does this work with gitlab plugin? #24

Open evbo opened 6 years ago

evbo commented 6 years ago

I downloaded sonar-scala-plugin-0.0.3.jar into sonarqube-6.6/extensions/plugins and try to run it from gitlab using the gitlab sonar plugin with:

mvn --batch-mode verify sonar:sonar -Dsonar.projectKey=myproject -Dsonar.host.url=$SONAR_URL

But I'm not seeing my scala project in sonar. Is there a step I'm missing? Here's the logs from sonar:

[INFO] Project key: myproject
[INFO] -------------  Scan compiler-templates
[INFO] Load server rules
[INFO] Load server rules (done) | time=19ms
[INFO] Base dir: /home/memqa/builds/d6cac072/0/dev/myproject
[INFO] Working dir: /home/projects/builds/d6cac072/0/dev/myproject/target/sonar
[INFO] Source paths: pom.xml
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] 1 file indexed
[INFO] Quality profile for xml: Sonar way
[INFO] Sensor SonarJavaXmlFileSensor [java]
[INFO] 1 source files to be analyzed
[INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=333ms
[INFO] 1/1 source files have been analyzed
[INFO] Sensor XML Sensor [xml]
[INFO] Sensor XML Sensor [xml] (done) | time=75ms
[INFO] Sensor Analyzer for "php.ini" files [php]
[INFO] Sensor Analyzer for "php.ini" files [php] (done) | time=2ms
[INFO] Performing issue tracking
[INFO] 3/3 components tracked
[INFO] ANALYSIS SUCCESSFUL
[INFO] Executing post-job GitLab Commit Issue Publisher
[INFO] Report status=success, desc=SonarQube reported no issues
[INFO] Task total time: 2.420 s

it only sees a source path of pom.xml...?

BalmungSan commented 6 years ago

Hello @evbo, this project seems dead, you should take a look to mwz/sonar-scala which is a recent fork of this project and by the moment is actively maintained.

If the problem persist, open an issue in that repo and @mwz and I will be happy to see what is happening.

evbo commented 6 years ago

Thanks but im using maven so I'm not able to run this I dont think.

BalmungSan commented 6 years ago

I don't see why using maven would stop you from using the other plugin ?

mwz commented 6 years ago

I've never used gitlab plugin, but it looks like you can still submit your analysis using sonar-scanner and the plugin will take care of the rest in the background, just like the github plugin. I'd probably suggest you to try doing that first to check if the issue is related in any way to running the analysis via mvn.

It may sound silly, but is your project a Scala project? I can see some references to Java and PHP in your logs, but I don't actually recognise any output from sonar-scala plugin? Did you restart your sonar instance after installing the plugin?

evbo commented 6 years ago

@BalmungSan maybe im losing my mind but when I clicked on the link in your comment earlier it took me to "mwz/sbt-sonar". Now that it links to sonar-scala I'll look into it. Thanks.

@mwz my project is actually entirely consisting of apache velocity templates, but I am using scala to unit test them. So, it's a bit awkward, but still technically scala. Oh, and yes I did a restart.

mwz commented 6 years ago

No worries @evbo. As @BalmungSan said, we're more than happy to help, so if you're still experiencing any issues with the latest release, feel free to give us a shout.

evbo commented 6 years ago

Thanks, I tried that mwz/sonar-scala plugin but unfortunately I am running sonar 6.6 and it seems to not run for that (as documented, it is intended for 6.7). When I find the time to upgrade, I'll try again unless you think it should work for 6.6. Here's it failing for 6.6:

sonarqube-6.6/bin/linux-x86-64 % ./sonar.sh console
Running SonarQube...
wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    | 
jvm 1    | 2018.02.23 10:15:14 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory .../sonar/sonarqube-6.6/temp
jvm 1    | 2018.02.23 10:15:14 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001
jvm 1    | 2018.02.23 10:15:15 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [.../sonar/sonarqube-6.6/elasticsearch]: .../sonar/sonarqube-6.6/elasticsearch/bin/elasticsearch -Epath.conf=.../sonar/sonarqube-6.6/temp/conf/es
jvm 1    | 2018.02.23 10:15:15 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
jvm 1    | 2018.02.23 10:15:15 INFO  app[][o.e.p.PluginsService] no modules loaded
jvm 1    | 2018.02.23 10:15:15 INFO  app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
jvm 1    | 2018.02.23 10:15:22 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
jvm 1    | 2018.02.23 10:15:22 INFO  app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [.../sonar/sonarqube-6.6]: .../jdk1.8.0_121/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=.../sonarqube-6.6/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -cp ./lib/common/*:./lib/server/*:.../sonar/sonarqube-6.6/lib/jdbc/postgresql/postgresql-42.1.1.jar org.sonar.server.app.WebServer .../sonar/sonarqube-6.6/temp/sq-process5788734099358693107properties
jvm 1    | 2018.02.23 10:15:25 INFO  app[][o.s.a.SchedulerImpl] Process [web] is stopped
jvm 1    | 2018.02.23 10:15:26 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
jvm 1    | 2018.02.23 10:15:26 WARN  app[][o.s.a.p.AbstractProcessMonitor] Process exited with exit value [es]: 143
jvm 1    | 2018.02.23 10:15:26 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

removing the sonar-scala plugin from my /extensions/plugins directory and restarting sonar did not have this issue.

mwz commented 6 years ago

6.7.1 is the current LTS release, so it's highly recommended upgrading to this version.

BalmungSan commented 6 years ago

Also the log is saying that the problem was that the es (Elasticsearch) process exited abruptly, the plugin should no affect es, so that is weird. In any case If you want open a issue in mwz/sonar-scala and paste the output of the es.log file. :+1: