I am currently learning JFoenix library. There is a nice demo and instructions how to run it.
JFoenix uses Gradle, but I need to use Maven, so I've decided to recreate the demo project using Maven for further testing.
The problem appeared when I tried to run my newly created project. It turned out that some classes (e.g. de.jensd.fx.glyphs.GlyphIcon
) were not found. I found out that de.jensd:fontawesomefx-fontawesome:4.7.0-5
depends on de.jensd:fontawesomefx-commons:8.15
in runtime. So I decided to add it as compile dependency and the demo ran correctly. But build.gradle of the demo specifies only de.jensd:fontawesomefx-fontawesome:4.7.0-5
.
Do Maven and Gradle handle dependencies in a different way? Or is it a specific case?
Here is my pom.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jfoenix</groupId>
<artifactId>demo</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- Bintray is needed for de.jensd:fontawesomefx-fontawesome. -->
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>8.0.7</version>
</dependency>
<dependency>
<groupId>io.datafx</groupId>
<artifactId>datafx</artifactId>
<version>8.0.1</version>
</dependency>
<dependency>
<groupId>io.datafx</groupId>
<artifactId>flow</artifactId>
<version>8.0.1</version>
</dependency>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-fontawesome</artifactId>
<version>4.7.0-5</version>
</dependency>
<!-- Without this dependency the project can't be compiled. -->
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-commons</artifactId>
<version>8.15</version>
</dependency>
</dependencies>
</project>
P.S. I am not sure whether the title for this question is OK. So suggestions are welcome.
P.P.S. If you try to compile the demo using my pom.xml
you'll have to comment out demos.components.AnimationTemplateDemo.java
because com.jfoenix.transitions.template
package is new and is not available in com.jfoenix:jfoenix:8.0.7
.
The pom.xml file at jcenter is this one:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-fontawesome</artifactId>
<version>4.7.0-5</version>
<dependencies>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-commons</artifactId>
<version>8.15</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
As you can see, fontawesomefx-commons is only required at runtime. I’m not sure why this is, but it explains why it is not pulled at compile time.
I don’t now where gradle pulls its dependency from, you don’t mention it, but my guess is that the configuration there is not runtime, but compile.
Edit : the scope is compile at later versions of fontawesomefx-fontawesome. So it appears that the runtime scope specified in the 4.7.0-5 version is probably a bug…
pom.xml for version 4.7.0-9:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-fontawesome</artifactId>
<version>4.7.0-9</version>
<dependencies>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-commons</artifactId>
<version>9.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>