简体   繁体   中英

Maven downloads wrong transitive dependency

PROBLEM:

Maven downloads wrong non-classifier transitive dependency.

pom.xml

<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-graphics</artifactId>
        <version>19</version>
        <classifier>win</classifier>
    </dependency>
</dependencies>

This produces following result in dependencies:

在此处输入图像描述

It is obviously wrong, because non-classifier javafx-base is empty and creates mess.

WORKAROUND:

It seems to be fixed when I excluse transitive dependency and manually declare javafx-base as dependency, like that:

<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-base</artifactId>
        <version>19</version>
        <classifier>win</classifier>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-graphics</artifactId>
        <version>19</version>
        <classifier>win</classifier>
        <exclusions>
            <exclusion>
                <groupId>*</groupId>
                <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

In the result, I get this:

在此处输入图像描述

QUESTION:

Is there any solution to my problem that doesn't utilize some bad practice workaround?

ADDITIONAL SOURCE:

openjfx maven repository

Why do you think you have to explicitly mess around with the classifiers yourself? This is normally not needed at all. Just follow the examples given in the official documentation.

https://openjfx.io/openjfx-docs/#maven

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM