【发布时间】:2019-04-02 15:35:16
【问题描述】:
我目前正在学习JFoenix 库。有一个很好的demo 和instructions 如何运行它。
JFoenix 使用 Gradle,但我需要使用 Maven,因此我决定使用 Maven 重新创建演示项目以进行进一步测试。
当我尝试运行我新创建的项目时出现了问题。结果发现有些类(例如de.jensd.fx.glyphs.GlyphIcon)没有找到。我发现de.jensd:fontawesomefx-fontawesome:4.7.0-5 在运行时依赖于de.jensd:fontawesomefx-commons:8.15。所以我决定将它添加为编译依赖,并且演示正确运行。但是演示中的build.gradle 只指定了de.jensd:fontawesomefx-fontawesome:4.7.0-5。
Maven 和 Gradle 是否以不同的方式处理依赖关系?还是特例?
这是我的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>
附:我不确定这个问题的标题是否可以。所以欢迎提出建议。
附言如果您尝试使用我的pom.xml 编译演示,则必须注释掉demos.components.AnimationTemplateDemo.java,因为com.jfoenix.transitions.template 包是new,在com.jfoenix:jfoenix:8.0.7 中不可用。
【问题讨论】:
标签: java maven gradle javafx jfoenix