gluonhq / client-samples

Client samples to run with Gluon Client plugins for Maven and Gradle
114 stars 23 forks source link

Exe generate by the plugin is not running in some cases #89

Open aminabs opened 4 years ago

aminabs commented 4 years ago

Hi there,

This is related to #88 but not the same

Using the client-maven-plugin version 0.1.27 I am able to generate an exe file for a very simple sample which is consist of an HBox with a button all inside a StackPane as the root pane of scene.

The exe when launched does nothing if I depend the project on javafx-controls version 14.0.1 but it works if depending on version 14.

The weird thing is that if I use TableView it is simply not working (exe generated) using javafx-conrols version 14. The source code and pom.xml content are inserted here.

My machine settings are: Windows 8 openjdk version "11.0.1" 2018-10-16 graalvm-ce-java11-windows-amd64-20.2.0

The App.java source code

package com.mycompany.gluonnew;

import javafx.application.Application;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Scene;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

/**
 * JavaFX App
 */
public class App extends Application
{
//    private TableView<X> table;

    public static class X
    {
        int a;

        public X(int a)
        {
            this.a = a;
        }

        public int getId()
        {
            return a;
        }

        public void setA(int a)
        {
            this.a = a;
        }

    }

    @Override
    public void start(Stage stage)
    {

        TableView<X> table = new TableView<>();
        for (int i = 0; i < 100; i++) {
            TableColumn<X, Integer> a = new TableColumn<>("A" + i);
            a.setCellValueFactory(p -> new SimpleObjectProperty<>(p.getValue().getId()));
            a.setCellFactory((TableColumn<X, Integer> p) -> new TableCell<>()
            {
                @Override
                protected void updateItem(Integer item, boolean empty)
                {
                    if (empty || item == null)
                        super.updateItem(item, empty);
                    else
                        setText(item + "");
                }

            });

            table.getColumns().add(a);
        }
        for (int i = 0; i < 100; i++) {
            table.getItems().add(new X(i));
        }
        var scene = new Scene(new StackPane(table), 640, 480);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args)
    {
        launch();
    }

}

The pom.xml file

<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>com.mycompany</groupId>
    <artifactId>GluonNew</artifactId>
    <version>1.0-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>14</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>com.mycompany.gluonnew.App</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.gluonhq</groupId>
                <artifactId>client-maven-plugin</artifactId>
                <version>0.1.27</version>
                <configuration>
                    <mainClass>com.mycompany.gluonnew.App</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Would you please help me on this?

jperedadnr commented 4 years ago

Same comment in #88 applies.