JavaFX classes not found when analysing a Maven Project

566 views
Skip to first unread message

samir.ha...@gmail.com

unread,
Apr 10, 2017, 9:54:48 AM4/10/17
to SonarQube
Hi,

I have a JavaFX Maven project. I'm trying to run sonar on it by using sonar-maven-plugin version 3.2. Sadly, I have a bunch or warnings saying javafx classes are not found.

Apparently, this seems to be the same issue as https://groups.google.com/forum/#!searchin/sonarqube/javafx|sort:relevance/sonarqube/jJjvFpycIrk/1cOBC8IEAwAJ .

So it seems that the issue was fixed in Gradle plugin, but not in the Maven one.

I forked the Maven plugin at https://github.com/SonarSource/sonar-scanner-maven and I do not find any reference to javaFX libraries being loaded somewhere.

Any ideas?

For information here is what comes out of the log :
sonar-maven-plugin:3.2:sonar (default-cli)

User cache: C:\Users\samir.hadzic\.sonar\cache

Load global repositories

Load global repositories (done) | time=214ms

User cache: C:\Users\samir.hadzic\.sonar\cache

Load plugins index

Load plugins index (done) | time=5ms

Download sonar-csharp-plugin-5.8.0.660.jar

Download sonar-java-plugin-4.6.0.8784.jar

Download sonar-scm-git-plugin-1.2.jar

Download sonar-scm-svn-plugin-1.4.0.522.jar

Download sonar-javascript-plugin-2.21.0.4409.jar

SonarQube version: 6.2

Default locale: "fr_FR", source code encoding: "UTF-8"

Process project properties

Load project repositories

Load project repositories (done) | time=100ms

Load quality profiles

Load quality profiles (done) | time=24ms

Load active rules

Load active rules (done) | time=279ms

Publish mode

-------------  Scan

Load server rules

Load server rules (done) | time=141ms

Initializer GenericCoverageSensor

Initializer GenericCoverageSensor (done) | time=0ms

Base dir:

Working dir:

Source paths: pom.xml, src/main/java

Test paths: src/test/java

Source encoding: UTF-8, default locale: fr_FR

Index files

53 files indexed

Quality profile for java: Sonar way

Sensor Lines Sensor

Sensor Lines Sensor (done) | time=29ms

Sensor JavaSquidSensor

Configured Java source version (sonar.java.source): 8

JavaClasspath initialization

JavaClasspath initialization (done) | time=14ms

JavaTestClasspath initialization

JavaTestClasspath initialization (done) | time=6ms

Java Main Files AST scan

53 source files to be analyzed

Class not found: javafx.event.Event

Class not found: javafx.beans.property.ObjectProperty

Class not found: javafx.scene.Node

Class not found: javafx.event.EventTarget

Class not found: com.sun.javafx.event.EventHandlerManager

Class not found: javafx.event.EventType

Class not found: javafx.event.EventHandler

Class not found: javafx.event.EventDispatchChain

Class not found: javafx.application.Application

Class not found: javafx.util.Duration

Class not found: javafx.scene.Scene

Class not found: javafx.stage.Stage

Class not found: javafx.collections.ObservableList

Class not found: javafx.scene.layout.BorderPane

Class not found: javafx.scene.layout.VBox


Regards,
Sam'

Julien HENRY

unread,
Apr 10, 2017, 12:59:59 PM4/10/17
to SonarQube, samir.ha...@gmail.com
Hi Sam,

How do you make Maven aware of javafx libraries? Do you use a special plugin? Can you share a sample project?

++

Julien

samir.ha...@gmail.com

unread,
Apr 11, 2017, 5:10:34 AM4/11/17
to SonarQube, samir.ha...@gmail.com
Hi Julien,

Ok I have made some tests and here is my conclusion. If I have a simple project using JavaFX, nothing to worry.

But if I'm loading a JavaFX dependency and using it, then I having some mistake. You can take a look at this very simple project here : https://github.com/Maxoudela/sonarTest

Basically I'm loading a SpreadsheetView from ControlsFX project. If use Sonar on that project, I have some "class not found". But if I remove that dependency, everything is allright.

Regards,

Julien HENRY

unread,
Apr 11, 2017, 8:32:04 AM4/11/17
to SonarQube, samir.ha...@gmail.com
Thanks for the sample. This way of passing the classpath (using bootclasspath) is not supported.

Here is a ticket:

samir.ha...@gmail.com

unread,
Apr 11, 2017, 8:57:47 AM4/11/17
to SonarQube, samir.ha...@gmail.com
Hi Julien,

Thanks for the issue. I'll watch that. I must confess I'm not an expert in Maven so maybe the way I do it (or Netbeans do it) is not the "proper" way. Maybe there is a cleaner way to do that.

I'll try to dig a bit more about that.

Thanks,
Sam'
Reply all
Reply to author
Forward
0 new messages