Not able to execute java-custom-rules plugin in SonarQube - java

I am a newbie to SonarQube and I am working on creating a new Metrics for SOnarQube.
As a part of learning am trying the examples in the SonarQube site.
I was trying the example given here
I used maven clean and maven build in eclipse and created the jar file. I placed the jar file in the "extension/plugins" directory in the SonarQube server (I have locally installed the server in my Win 7 machine).
Then I used SonarQube Runner to link my project with SonarQube. How ever am getting this error:
C:\xxx\Desktop\Workspace\sonar-test>sonar-runner -e
C:\sonar-runner-2.4
SonarQube Runner 2.4
Java 1.6.0_21 Sun Microsystems Inc. (32-bit)
Windows 7 6.1 x86
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\sonar-runner-2.4\conf\sonar-runner.propertie
s
INFO: Project configuration file: C:\xxx\Desktop\Workspace\sona
r-test\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:\xxx\Desktop\Workspace\sonar-test\.\.so
nar
INFO: SonarQube Server 4.5.1
13:47:39.244 INFO - Load global referentials...
13:47:39.546 INFO - Load global referentials done: 308 ms
13:47:39.570 INFO - User cache: C:\xxx\.sonar\cache
13:47:39.597 INFO - Install plugins
13:47:39.994 INFO - Install JDBC driver
13:47:40.012 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
13:47:42.259 INFO - Initializing Hibernate
13:47:45.201 INFO - Load project referentials...
13:47:45.894 INFO - Load project referentials done: 693 ms
13:47:45.896 INFO - Load project settings
13:47:47.144 INFO - Loading technical debt model...
13:47:47.195 INFO - Loading technical debt model done: 51 ms
13:47:47.208 INFO - Apply project exclusions
13:47:47.920 INFO - ------------- Scan sonar-test
13:47:47.947 INFO - Load module settings
13:47:49.148 INFO - Loading rules...
13:47:50.030 INFO - Loading rules done: 882 ms
13:47:50.106 INFO - Configure Maven plugins
13:47:50.327 INFO - Compare to previous analysis (2014-11-06)
13:47:50.352 INFO - Compare over 30 days (2014-10-07, analysis of 2014-11-06 12
:28:06.816)
13:47:50.356 INFO - No quality gate is configured.
13:47:50.840 INFO - Base dir: C:\xxx\Desktop\Workspace\sonar-t
est\.
13:47:50.841 INFO - Working dir: C:\xxx\Desktop\Workspace\sona
r-test\.\.sonar
13:47:50.846 INFO - Source paths: src
13:47:50.847 INFO - Source encoding: UTF-8, default locale: en_US
13:47:50.849 INFO - Index files
13:47:51.001 INFO - 2 files indexed
13:47:51.146 INFO - Quality profile for java: Sonar way
13:47:51.171 INFO - Sensor JavaSquidSensor...
13:47:51.363 INFO - Java Main Files AST scan...
13:47:51.377 INFO - 2 source files to be analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 13.831s
Final Memory: 8M/99M
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.NoSuchMethodError: org.sonar.plugins.java.api.tree.Tree.is(
[Lorg/sonar/plugins/java/api/tree/Tree$Kind;)Z
at org.sonar.samples.java.ExampleCheck.visitMethod(ExampleCheck.java:69)
at org.sonar.java.model.declaration.MethodTreeImpl.accept(MethodTreeImpl
.java:118)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:41)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:35)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitClass(BaseTreeVi
sitor.java:64)
at org.sonar.java.model.declaration.ClassTreeImpl.accept(ClassTreeImpl.j
ava:107)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:41)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:35)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitCompilationUnit(
BaseTreeVisitor.java:50)
at org.sonar.java.model.JavaTree$CompilationUnitTreeImpl.accept(JavaTree
.java:120)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.
java:41)
at org.sonar.samples.java.ExampleCheck.scanFile(ExampleCheck.java:51)
at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:91)
at com.sonar.sslr.impl.ast.AstWalker.walkAndVisit(AstWalker.java:67)
at org.sonar.java.ast.AstScanner.simpleScan(AstScanner.java:118)
at org.sonar.java.ast.AstScanner.scan(AstScanner.java:83)
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:135)
at org.sonar.java.JavaSquid.scan(JavaSquid.java:128)
at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:8
6)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.
java:79)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:7
0)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanConta
iner.java:194)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.j
ava:233)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScan
Container.java:228)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanCon
tainer.java:221)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.ja
va:125)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapCon
tainer.java:173)
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.
According to this example this must create a issue whenever it encounters a method and a annotation starting with a letter 'Z'.
I tried creating a class with such inputs:
sample.java
package test;
public class Sample {
public static void main(String[] args) {
System.out.println("Test");
}
#Ztest(val="hi")
public static void add()
{
System.out.println("Add Method");
}
}
I also created an annotation file:
Ztest.java
package test;
public #interface Ztest {
String val();
}
But when I execute with the SonarQube Runner am getting the above error.
Kindly help me with this.

NoSuchMethodError means that a class is found by the classloader, but the method is missing. This occurs when you are using an older or newer version of a library at runtime, than your rule was compiled with. If you have multiple versions of the same library on your classpath, this still can occur, since the classloader will only load the class once, and I'm not sure if one can tell which version it will use.
If you look at the dependencies of java-custom-rule, it depends on sonar-java-plugin version 2.5, please check if your sonarqube instance has the same version of this plugin.
EDIT tl;dr update your sonarqube java plugin

Related

soapui window disappears after few sec

I have installed SoapUI 5.5.0 in rhel 7.8 server and trying to open it via MobaXterm on windows 10 local desktop.
When i run soapui.sh, soapui window opens up and display below messages on server,
#./soapui.sh
================================
=
= SOAPUI_HOME = /opt/SoapUI-5.5.0
=
================================
Configuring log4j from [/opt/SoapUI-5.5.0/bin/soapui-log4j.xml]
16:52:38,534 INFO [DefaultSoapUICore] Creating new settings at [/root/soapui-settings.xml]
16:52:39,328 INFO [PluginManager] 0 plugins loaded in 2 ms
16:52:39,328 INFO [DefaultSoapUICore] All plugins loaded
Configuring log4j from [/opt/SoapUI-5.5.0/bin/soapui-log4j.xml]
16:52:39,556 INFO [DefaultSoapUICore] Creating new settings at [/root/soapui-settings.xml]
16:52:39,601 INFO [PluginManager] 0 plugins loaded in 11 ms
16:52:39,601 INFO [DefaultSoapUICore] All plugins loaded
16:52:39,844 INFO [SoapUI] Used java version: 1.8.0_221
It opens another window called as 'Stay Tuned!'. As soon as i click on 'Yes, I want to know' or 'skip' button it gives below error on linux server and soapui window disappears.
Exception in thread "Thread-12" sun.reflect.generics.reflectiveObjects.NotImplementedException
at com.smartbear.analytics.impl.SoapUIOSMixpanelProvider.trackError(SoapUIOSMixpanelProvider.java:53)
at com.smartbear.analytics.AnalyticsManager$1.run(AnalyticsManager.java:55)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Prism-ES2 Error : GL_VERSION (major.minor) = 1.4
java.lang.UnsupportedOperationException: Internal Error
at com.sun.glass.ui.gtk.GtkApplication.lambda$new$5(GtkApplication.java:158)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:140)
at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
at com.sun.glass.ui.Application.run(Application.java:146)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:278)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
at javafx.embed.swing.JFXPanel.lambda$initFx$2(JFXPanel.java:232)
at java.lang.Thread.run(Thread.java:748)
Its a vm on vmware platform and have driver as below.
00:0f.0 VGA compatible controller: VMware SVGA II Adapter (prog-if 00 [VGA controller])
Subsystem: VMware SVGA II Adapter
Flags: bus master, medium devsel, latency 64, IRQ 16
I/O ports at 1070 [size=16]
Memory at e8000000 (32-bit, prefetchable) [size=128M]
Memory at fe000000 (32-bit, non-prefetchable) [size=8M]
[virtual] Expansion ROM at c0400000 [disabled] [size=32K]
Capabilities: [40] Vendor Specific Information: Len=00 <?>
Capabilities: [44] PCI Advanced Features
Kernel driver in use: vmwgfx
Kernel modules: vmwgfx
I have below libgl related packages installed on server.
# rpm -qa |grep -i libGL
libglvnd-1.0.1-0.8.git5baa1e5.el7.x86_64
libglvnd-opengl-1.0.1-0.8.git5baa1e5.el7.x86_64
mesa-libGL-18.3.4-10.el7.x86_64
mesa-libglapi-18.3.4-10.el7.x86_64
libglvnd-glx-1.0.1-0.8.git5baa1e5.el7.x86_64
libglvnd-egl-1.0.1-0.8.git5baa1e5.el7.x86_64
libglvnd-gles-1.0.1-0.8.git5baa1e5.el7.x86_64
libglvnd-core-devel-1.0.1-0.8.git5baa1e5.el7.x86_64
mesa-libGLU-devel-9.0.0-4.el7.x86_64
libglvnd-devel-1.0.1-0.8.git5baa1e5.el7.x86_64
mesa-libGL-devel-18.3.4-10.el7.x86_64
mesa-libGLU-9.0.0-4.el7.x86_64
Can you please let me know how to fix this issue?
Thanks,
The below line in /opt/SoapUI-5.5.0/bin/soapui.sh was uncommented to disable the browser component. After his, the SoapUI was no longer crashing as before.
#uncomment to disable browser component
JAVA_OPTS="$JAVA_OPTS -Dsoapui.browser.disabled=true"

Intellij IDEA StackOverflow error when building project

I'm working with Intellij IDEA Community Edition, having a maven project with 6 modules and 122 classes in total.
When I'm trying to run the main class from one of the sub-modules, IDEA first builds the project and this is when I get the StackOverflowError message. Of course it happens when I just build the project.
It looks like this:
Information:javac 1.8.0_25 was used to compile java sources
Information:09/08/2018 14:44 - Compilation completed with 1 error and 1 warning in 5 s 57 ms
Error:java: java.lang.StackOverflowError
IDEA version is: 2018.1.6
I tried reinstalling the same version and installing a previous version 2016.x.x (don't remember exactly). Also tried the solution with -Xss4m suggested here , but with no success. I don't have this problem on other similar projects (maven with modules).
Does anyone know why this could happen or how can I investigate the problem?
Might it be related to lombok (I'm using the lombok plugin in IDEA)?
UPDATE:
I add the build logs below:
```
2018-08-09 15:00:10,503 [ 116169] INFO - .incremental.IncProjectBuilder - Building project; isRebuild:false; isMake:true parallel compilation:false
2018-08-09 15:00:10,573 [ 116239] INFO - .incremental.IncProjectBuilder - Cleaned output directories in 6 ms
2018-08-09 15:00:10,731 [ 116397] INFO - s.incremental.java.JavaBuilder - Compiling 24 java files; module: PROJECT_XXX_MODULE1
2018-08-09 15:00:13,261 [ 118927] INFO - s.incremental.java.JavaBuilder - java.lang.StackOverflowError
java.lang.RuntimeException: java.lang.StackOverflowError
at com.sun.tools.javac.main.Main.compile(Main.java:553)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:198)
at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:453)
at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:317)
at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:244)
at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:202)
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1314)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:991)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1063)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:954)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:787)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:376)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:308)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:137)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:235)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$$Lambda$26/31644974.run(Unknown Source)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$$Lambda$8/7438855.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.StackOverflowError
at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:4532)
at com.sun.tools.javac.code.Types.supertype(Types.java:2295)
at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1956)
at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1945)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1942)
at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1958)
at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1945)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1942)
at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1965)
at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1945)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1942)
at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:918)
at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:841)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
at com.sun.tools.javac.code.Types.isSubtype(Types.java:837)
at com.sun.tools.javac.code.Types.isSubtype(Types.java:801)
at com.sun.tools.javac.code.Types.isSubtypeUncheckedInternal(Types.java:754)
at com.sun.tools.javac.code.Types.isSubtypeUnchecked(Types.java:738)
at com.sun.tools.javac.code.Types.isConvertible(Types.java:296)
at com.sun.tools.javac.code.Types.isAssignable(Types.java:2154)
at com.sun.tools.javac.code.Types.isAssignable(Types.java:2115)
at com.sun.tools.javac.model.JavacTypes.isAssignable(JavacTypes.java:104)
at org.springframework.boot.configurationprocessor.TypeUtils.isCollectionOrMap(TypeUtils.java:153)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processSimpleTypes(ConfigurationMetadataAnnotationProcessor.java:221)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:201)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:331)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedTypes(ConfigurationMetadataAnnotationProcessor.java:286)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:203)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:331)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedTypes(ConfigurationMetadataAnnotationProcessor.java:286)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:203)
[............almost 1000 of the same calls looping between them......]
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:331)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedTypes(ConfigurationMetadataAnnotationProcessor.java:286)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:203)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:331)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedTypes(ConfigurationMetadataAnnotationProcessor.java:286)
2018-08-09 15:00:13,287 [ 118953] INFO - brains.jps.incremental.Builder - Dependency analysis found 0 affected files
2018-08-09 15:00:13,289 [ 118955] INFO - s.incremental.java.JavaBuilder - javac 1.8.0_25 was used to compile [PROJECT_XXX_MODULE1]
2018-08-09 15:00:13,972 [ 0] INFO - etbrains.jps.cmdline.BuildMain - ==================================================
2018-08-09 15:00:13,973 [ 1] INFO - etbrains.jps.cmdline.BuildMain - Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2018.1.6/lib/jps-launcher.jar;C:/jdk/jdk1.8.0_25-windows-i586/lib/tools.jar;C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2018.1.6/lib/optimizedFileManager.jar
2018-08-09 15:00:14,351 [ 379] INFO - etbrains.jps.cmdline.BuildMain - Connection to IDE established in 348 ms
2018-08-09 15:00:14,370 [ 398] INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2018-08-09 15:00:14,415 [ 443] INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = C:/PROJECT_XXX, global options path = C:/Users/me/.IdeaIC2018.1/config/options
2018-08-09 15:00:14,828 [ 856] INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 413 ms
2018-08-09 15:00:14,829 [ 857] INFO - jps.cmdline.JpsModelLoaderImpl - Project has 6 modules, 176 libraries
2018-08-09 15:00:14,970 [ 998] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=656
2018-08-09 15:00:15,223 [ 1251] INFO - etbrains.jps.cmdline.BuildMain - Pre-loaded process ready in 1252 ms
```
Update 2: As suggested by Wiciaq123 I set Xmx to 4G but didn't change the behaviour. My vm options are:
# custom IntelliJ IDEA VM options
-Xms512m
-Xmx4096m
-Xss512m
-XX:ReservedCodeCacheSize=240m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow

Sonar on Travis: ERROR You must define the following mandatory properties for 'Unknown'

I'm trying to setup SonarQube on Travis for a Java project by following Travis documentation https://docs.travis-ci.com/user/sonarqube/
My resulting my .travis.yml file is as follows:
sudo: required
cache:
directories:
- $HOME/.m2
language: java
services:
- docker
jdk:
- oraclejdk8
os:
- linux
env:
matrix:
- NEO_VERSION=3.0.9
WITH_DOCKER=true
EXTRA_PROFILES=-Pwith-neo4j-io
- NEO_VERSION=3.1.2
WITH_DOCKER=true
EXTRA_PROFILES=-Pwith-neo4j-io
addons:
sonarqube:
organization: ${SONAR_ORGANIZATION}
token:
secure: ${SONAR_TOKEN}
branches:
- master
- sonarqube
before_script:
script:
- build/run.sh
- sonar-scanner
install: true
after_success:
- mvn clean test jacoco:report coveralls:report
- "[ ${TRAVIS_PULL_REQUEST} = 'false' ] && [[ ${TRAVIS_BRANCH} = 'master' ]] && mvn clean deploy -DskipTests --settings ./deploy-settings.xml"
My resulting sonar-scanner.properties file is:
# must be unique in a given SonarQube instance
sonar.projectKey=liquigraph
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=Liquigraph
sonar.projectVersion=1.0
# Set modules IDs
sonar.modules=liquigraph-cli,liquigraph-core,liquigraph-maven-plugin,liquigraph-spring-boot-starter,liquigraph-examples
# Modules inherit properties set at parent level
sonar.sources=src
sonar.sourceEncoding=UTF-8
sonar.language=java
But when I commit and Travis start building, sonar job fails with following logs:
. . .
$ sonar-scanner
INFO: Scanner configuration file: /home/travis/.sonarscanner/sonar-scanner-2.8/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.8
INFO: Java 1.8.0_111 Oracle Corporation (64-bit)
INFO: Linux 4.4.0-51-generic amd64
INFO: User cache: /home/travis/.sonar/cache
. . .
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 13.770s
INFO: Final Memory: 64M/505M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.sources
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
I did put my sonar-scanner.properties in the root of my project folder. Why travis cannot find and instead is using /home/travis/.sonarscanner/sonar-scanner-2.8/conf/sonar-scanner.properties?
If your project is a Maven project, then simply use the Scanner for Maven: mvn sonar:sonar
Look at https://about.sonarqube.com/get-started/ for details.
If you really want to use the SonarQube Scanner, then your issue is that you are not using the correct name for the configuration file. It should be sonar-project.properties.

SonarQube Component Coverage details with JUnitTest reports: How to avoid resource not found warning?

I'm pretty new to sonar but unfortunately I wasn't able to find any information in the net the last to days which could help me to solve my problem.
I'm running a SonarRunner on a Jenkins server and I'm trying to insert jUnit reports in order to see some content in the Coverage tab of the project on SonarQube.
The problem seems to be in loading the created jUnit report since the error message is pointing out to the junit framework:
INFO: SonarQube Server 5.3
13:39:28.405 INFO - Load global repositories
13:39:28.608 INFO - Load global repositories (done) | time=203ms
13:39:28.639 INFO - User cache: C:\Windows\system32\config\systemprofile\.sonar\cache
13:39:28.890 INFO - Load plugins index
13:39:28.890 INFO - Load plugins index (done) | time=0ms
13:39:29.202 INFO - Process project properties
13:39:29.249 INFO - Load project repositories
13:39:29.339 INFO - Load project repositories (done) | time=90ms
13:39:29.339 INFO - Apply project exclusions
13:39:29.444 INFO - Load quality profiles
13:39:29.516 INFO - Load quality profiles (done) | time=72ms
13:39:29.519 INFO - Load active rules
13:39:29.766 INFO - Load active rules (done) | time=247ms
13:39:29.771 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
13:39:29.771 INFO - Publish mode
13:39:29.771 INFO - ------------- Scan DatensatzManager
13:39:29.834 INFO - Load server rules
13:39:29.879 INFO - Load server rules (done) | time=45ms
13:39:29.911 INFO - Base dir: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src
13:39:29.911 INFO - Working dir: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\.sonar
13:39:29.911 INFO - Source paths: src
13:39:29.911 INFO - Test paths: test/com/carmeq/dia/dsm
13:39:29.911 INFO - Source encoding: windows-1252, default locale: de_DE
13:39:29.911 INFO - Index files
13:39:30.051 INFO - 162 files indexed
13:39:30.051 INFO - Quality profile for java: Sonar way
13:39:30.067 INFO - Sensor JavaSquidSensor
13:39:30.257 INFO - Configured Java source version: none
13:39:30.459 INFO - Java Main Files AST scan...
13:39:30.459 INFO - 144 source files to be analyzed
13:39:40.551 INFO - 99/144 files analyzed, current file: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\src\com\carmeq\dia\dsm\core\util\RawDatasetImportExport.java
13:39:50.558 INFO - 138/144 files analyzed, current file: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\src\com\carmeq\dia\dsm\template_editor\logic\GUIActions.java
13:39:51.303 INFO - Java Main Files AST scan done: 20844 ms
13:39:51.303 INFO - 144/144 source files have been analyzed
13:39:51.303 WARN - Java bytecode has not been made available to the analyzer. The org.sonar.java.bytecode.visitor.DependenciesVisitor#1f6e340, org.sonar.java.checks.UnusedPrivateMethodCheck#1f9344b are disabled.
13:39:51.303 INFO - Java Test Files AST scan...
13:39:51.303 INFO - 18 source files to be analyzed
13:39:51.702 INFO - Java Test Files AST scan done: 399 ms
13:39:51.702 INFO - 18/18 source files have been analyzed
13:39:51.702 INFO - Sensor JavaSquidSensor (done) | time=21635ms
13:39:51.702 INFO - Sensor Lines Sensor
13:39:51.718 INFO - Sensor Lines Sensor (done) | time=16ms
13:39:51.718 INFO - Sensor QProfileSensor
13:39:51.718 INFO - Sensor QProfileSensor (done) | time=0ms
13:39:51.718 INFO - Sensor SurefireSensor
13:39:51.718 INFO - parsing D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\report
13:39:51.792 WARN - Resource not found: junit.framework.TestSuite
13:39:51.795 INFO - Sensor SurefireSensor (done) | time=77ms
13:39:51.795 INFO - Sensor SCM Sensor
13:39:51.795 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
13:39:51.795 INFO - Sensor SCM Sensor (done) | time=0ms
13:39:51.795 INFO - Sensor Code Colorizer Sensor
13:39:51.798 INFO - Sensor Code Colorizer Sensor (done) | time=3ms
13:39:51.798 INFO - Sensor CPD Sensor
13:39:51.798 INFO - JavaCpdEngine is used for java
13:39:52.234 INFO - Sensor CPD Sensor (done) | time=436ms
13:39:52.602 INFO - Analysis report generated in 352ms, dir size=3 MB
13:39:52.986 INFO - Analysis reports compressed in 384ms, zip size=1 MB
13:39:53.102 INFO - Analysis report uploaded in 116ms
13:39:53.102 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/my:project
13:39:53.102 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
13:39:53.102 INFO - More about the report processing at http://localhost:9000/api/ce/task?id=AVLvPnH_lmKETL1ow_XQ
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 25.530s
Final Memory: 6M/134M
INFO: ------------------------------------------------------------------------
Finished: SUCCESS
I absolutely don't know why Sonar is searching for the junit.framework.TestSuite. Is there anyone who can help me to solve this?
Cheers!
Please note that surefire sensor is about execution of unit tests NOT coverage.
To get coverage displayed, you need to provide a coverage report that you can generate using JaCoCo (recommended way and included in sonar java plugin) or using cobertura (need to install the dedicated plugin for SonarQube).
The surefire sensor will only get you information about the execution of tests.

How to run selenium using other browsers?

I've configured the Selenium 2.0 IDE in Firefox and I execute my Project using this IDE.
Execute the Project using IDE.
And i Play back the executed screens.
Saved those Test case in HTML and Java format. (For Java: I used Jnit/Webdriver)
Then i open the java file using eclipse to change for Chrome Driver
After that i append this code into that System.setProperty();
Then i executed the Chromewebdriver using Command Prompt java -Dwebdriver.chrome.driver=/path/to/chromedriver -jar selenium-server-standalone-2.7.0.jar
Then i got the error as
C:\Program Files\Java\jdk1.6.0\bin>java -Dwebdriver.chrome.driver=c:/Users/FSP/D
ownloads/chromedriver.exe -jar selenium-server-standalone-2.39.0.jar
Unable to access jarfile selenium-server-standalone-2.39.0.jar
C:\Program Files\Java\jdk1.6.0\bin>java -Dwebdriver.chrome.driver=c:/Users/FSP/D
ownloads/chromedriver.exe -jar c:/Users/FSP/Downloads/selenium-server-standalone
-2.39.0.jar
Feb 22, 2014 6:48:37 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
18:48:39.395 INFO - Java: Sun Microsystems Inc. 1.6.0-b105
18:48:39.405 INFO - OS: Windows Vista 6.1 x86
18:48:39.618 INFO - v2.39.0, with Core v2.39.0. Built from revision ff23eac
18:48:40.440 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver regis
tration is skipped: registration capabilities Capabilities [{platform=MAC, brows
erName=iPhone, version=}] does not match with current platform: VISTA
18:48:40.500 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver regis
tration is skipped: registration capabilities Capabilities [{platform=MAC, brows
erName=iPad, version=}] does not match with current platform: VISTA
18:48:41.089 INFO - RemoteWebDriver instances should connect to:
18:48:41.091 INFO - Version Jetty/5.1.x
18:48:41.122 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
18:48:41.124 INFO - Started HttpContext[/selenium-server,/selenium-server]
18:48:41.125 INFO - Started HttpContext[/,/]
18:48:41.772 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#1db4f6
f
18:48:41.772 INFO - Started HttpContext[/wd,/wd]
18:48:41.799 WARN - Failed to start: SocketListener0#0.0.0.0:4444
Exception in thread "main" org.openqa.jetty.util.MultiException[java.net.SocketE
xception: Unrecognized Windows Sockets error: 0: JVM_Bind]
at org.openqa.jetty.http.HttpServer.doStart(HttpServer.java:696)
at org.openqa.jetty.util.Container.start(Container.java:72)
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:4
88)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:30
0)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:24
5)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:96)
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.openqa.jetty.util.ThreadedServe`enter code here`r.newServerSocket(ThreadedServer.j
ava:392)
at org.openqa.jetty.util.ThreadedServer.open(ThreadedServer.java:478)
at org.openqa.jetty.util.ThreadedServer.start(ThreadedServer.java:504)
at org.openqa.jetty.http.SocketListener.start(SocketListener.java:202)
at org.openqa.jetty.http.HttpServer.doStart(HttpServer.java:726)
at org.openqa.jetty.util.Container.start(Container.java:72)
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:4
88)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:30
0)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:24
5)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:96)
C:\Program Files\Java\jdk1.6.0\bin>
How to solve this? So please try to configure and run the script through other browsers using webdriver concept.
It might be classpath issue....
Download the latest version of selenium, say 2.39.0 from the seleniumHQ.org site.
Place it in C:\ drive. Goto the environment variables and add java -jar selenium-server-standalone-2.39.0.jar to the classpath

Categories

Resources