Banjer_HD
Banjer_HD

Reputation: 300

JavaFX Maven jfx:jar error: Could not find artifact javafx-packager

I am trying to build an executable file using JavaFX and Maven.

'clean javafx:run' is working fine but when I run 'mvn clean jfx:jar' (in eclipse or cmd) I get this error:

[ERROR] Failed to execute goal com.zenjava:javafx-maven-plugin:8.8.3:jar (default-cli) on project inkoop: Execution default-cli of goal com.zenjava:javafx-maven-plugin:8.8.3:jar failed: Plugin com.zenjava:javafx-maven-plugin:8.8.3 or one of its dependencies could not be resolved: Could not find artifact javafx-packager:javafx-packager:jar:1.8.0_20 at specified path C:\Program Files\Java\jdk-13.0.2/../lib/ant-javafx.jar -> [Help 1]

.
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>nl.myname.programs</groupId>
<artifactId>name</artifactId>
<version>0.0.1-SNAPSHOT</version>


<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
</properties>


<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>13</version>
    </dependency>

    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>13</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>nl.myname.programs.name.App</mainClass>
                <executable>C:/Program Files/Java/jdk-13.0.2/bin/java</executable>
            </configuration>
        </plugin>


        <plugin>
            <groupId>com.zenjava</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>8.8.3</version>
            <configuration>
                <jfxMainAppJarName>${project.build.finalName}.jar</jfxMainAppJarName>
                <mainClass>nl.myname.programs.name.App</mainClass>
            </configuration>
        </plugin>



    </plugins>
</build>

My path has both %JAVA_HOME%\bin and C:\Program Files\apache-maven-3.6.3\bin (%JAVA_HOME is set to C:\Program Files\Java\jdk-13.0.2)

Is there any way I can build my application?
Do I need both javax-maven-plugin's? Thanks for helping!

Upvotes: 3

Views: 10703

Answers (1)

Puce
Puce

Reputation: 38132

AFAIK, the com.zenjava:javafx-maven-plugin does not work with Java 11+ / JavaFX 11+.

Just use the org.openjfx:javafx-maven-plugin with Java 11+ / JavaFX 11+.

Upvotes: 5

Related Questions