How to make maven request the correct javafx dependancies on linux

Doralitze :

I've got a java project build by maven, compiling and running fine on FreeBSD, Mac and Windows. However when I try to compile it on Linux I get the following error:

The following artifacts could not be resolved: org.openjfx:javafx-controls:jar:${javafx.platform}:12, org.openjfx:javafx-graphics:jar:${javafx.platform}:12, org.openjfx:javafx-base:jar:${javafx.platform}:12: Could not find artifact org.openjfx:javafx-controls:jar:${javafx.platform}:12 in central (https://repo.maven.apache.org/maven2)

Obviously it can't determine the fact that it's running on linux so I added

<javafx.platform>sources</javafx.platform>

to the properties division of the pom.xml with no effect. This however has the effect, that other OS try to download the linux version, and aren't capable to run the software anymore (being expected but showing to me that I wrote that property correctly). I'm testing inside a fresh Ubuntu VM and the VM is capable of compiling and running other (non JFX) project fine. I'm officially out of ideas.

Edit: My current pom.xml

<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>swengf</groupId>
    <artifactId>china</artifactId>
    <packaging>jar</packaging>
    <version>0.0-SNAPSHOT</version>
    <name>ferfehlt</name>
    <url>https://projects.isp.uni-luebeck.de/grp_f/sweng_f</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>10</java.version>
        <junit.version>5.4.1</junit.version>
        <javafx.version>12</javafx.version>
        <javafx.platform>linux</javafx.platform>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>swengf.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>${javafx.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>1.18</version>
        </dependency>
    </dependencies>
</project>
Doralitze :

I was able to get it working by replacing <javafx.platform>linux</javafx.platform> with <javafx.platform>\%linux\%</javafx.platform>. A colleague suggested this to me but I've got no clue why this is working.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=105326&siteId=1