1

I had a Maven Java 8 project that got updated for Java 11. As a result I had to update some of the dependencies, in particular de.jensd:fontawesomefx-commons, which I updated to the latest version 11.0 from JFrog Bintray.

Maven downloaded the updated dependencies. While some classes are successfully imported, others aren't:

enter image description here

Note that the compiler is missing GlyphsDude and the package de.jensd.fx.glyphs.fontawesome, and upon examining the JAR file in my local .m2 Maven repository I indeed do not see them. However, examining the source code in its Bitbucket repository (pointed at as the official source repository from the JFrog Bintray page) I do see de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon, so why isn't it in the JAR too?

EDIT:The problem occurred even though I added all dependencies for fontawesomefx. I tried both 9.1.2 and 11.0 sets and the problem persists.

user118967
  • 4,895
  • 5
  • 33
  • 54
  • 1
    `fontawesomefx-commons` doesn't have any transitive dependency on other artifacts. On the contrary, [`fontawesomefx-fontawesome`](https://mvnrepository.com/artifact/de.jensd/fontawesomefx-fontawesome/4.7.0-11) does depends on commons, so you will need this one (an maybe `fontawesomefx-controls`) in the pom instead. Anyway, it is just a matter of adding the required dependencies. – José Pereda Apr 13 '20 at 10:33
  • I had a similar problem a while back. I think it was due to using some of the wrong versions of jars together. – SedJ601 Apr 13 '20 at 13:52
  • The problem occurred even though I added all dependencies for fontawesomefx. I tried both 9.1.2 and 11.0 sets and the problem persists. – user118967 Apr 13 '20 at 13:58
  • It seems the API (and set of classes available) has changed since version 8. Is there documentation available for the newer versions of fontawasomefx so I can learn which classes to substitute? – user118967 Apr 13 '20 at 14:00
  • @JoséPereda: thanks, but how do I find out what dependencies are required? Where can I find clear documentation about this library? – user118967 Jun 20 '20 at 05:41

1 Answers1

2

Sample App:

module-info

module sed.test.testproject {
    requires javafx.controls;
    exports sed.test.testproject;

    requires de.jensd.fx.glyphs.commons;
    requires de.jensd.fx.glyphs.materialdesignicons;
    requires de.jensd.fx.glyphs.fontawesome;
}

Main

import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;


public class App extends Application { 

    @Override 
    public void start(Stage primaryStage) {   
        MaterialDesignIconView materialDesignIconView = new MaterialDesignIconView(MaterialDesignIcon.THUMB_UP);
        materialDesignIconView.setSize("4em");      

        FontAwesomeIconView fontAwesomeIconView = new FontAwesomeIconView(FontAwesomeIcon.ANDROID);
        fontAwesomeIconView.setSize("4em");   

        VBox root = new VBox(materialDesignIconView, fontAwesomeIconView);
        Scene scene = new Scene(root, 600, 500);
        primaryStage.setTitle("Streaming Test");
        primaryStage.setScene(scene);
        primaryStage.show();  
    } 

    public static void main(String[] args) {
        launch(args);
    }
}

POM

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>sed.test</groupId>
    <artifactId>TestProject</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>14</maven.compiler.source>
        <maven.compiler.target>14</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>14</version>
        </dependency>
        <dependency>
            <groupId>de.jensd</groupId>
            <artifactId>fontawesomefx-materialdesignfont</artifactId>
            <version>2.0.26-9.1.2</version>
        </dependency>
        <dependency>
            <groupId>de.jensd</groupId>
            <artifactId>fontawesomefx-commons</artifactId>
            <version>9.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>14</version>
        </dependency>
        <dependency>
            <groupId>de.jensd</groupId>
            <artifactId>fontawesomefx-fontawesome</artifactId>
            <version>4.7.0-9.1.2</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.4</version>
                <configuration>
                    <mainClass>sed.test.testproject.App</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Output

enter image description here

SedJ601
  • 12,173
  • 3
  • 41
  • 59
  • Thank you for the sample. It helped me fix one of the imports but GlyphDude and FontAwesomeIcons (plural) still don't work. One issue is that I just can't find clear instructions about how to use this library. Do you have a pointer to that? – user118967 Jun 20 '20 at 05:40
  • Also note that adding the `GlyphsDude` import to your sample project raises an import error too. – user118967 Jun 20 '20 at 05:57
  • 1
    I will look into it if I get time today. – SedJ601 Jun 20 '20 at 14:37
  • I just used the Github repo's examples – SedJ601 Jun 20 '20 at 14:37
  • 1
    Thank you. It seems GlyphsDude and FontAwesomeIcons were removed from the newer versions. I need to figure out how to replace them. – user118967 Jun 20 '20 at 16:05