javafx如何将参数传递给main(),就像使用eclipse运行配置一样

时间:2017-10-08 13:10:12

标签: java eclipse maven javafx

我使用jfx:native构建deb并在Debian中启动它。它的工作正常。

我决定将一个字符串参数传递给该程序。它与Eclipse /运行配置/ java应用程序/参数一起使用,其中包含单词。

但是现在,jfx:native建立了一个不运行的deb。当然,我必须在maven中声明一些东西,也许是在jfx中。但是什么,在哪里?

这是我的pom:

<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>fr.mycomp</groupId>
    <artifactId>ActionsOLD20171010Version046</artifactId>
    <version>0.4.6</version>
    <name>Actions</name>

    <organization>
        <name>mycomp</name>
    </organization>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- 2 lignes ci-dessous rajoutées pour création de la property timestamp, 
            contournement d'un bug maven pour mise à jour du fichier version.txt -->
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
        <authorname>FXMA</authorname>

        <runSuite>**/AASuiteTestActions.class</runSuite>
    </properties>

    <build>

        <!-- bloc ci-dessous rajouté pour copie du fichier version.txt -->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.zenjava</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>8.6.0</version>
                <configuration>
                    <vendor>mycomp</vendor>
                    <mainClass>fr.mycomp.MainApp</mainClass>
                    <nativeInstallers />
                    <bundler>deb</bundler>
                </configuration>
            </plugin>

            <!-- PLUGIN RAJOUTE POUR COPIER LES FICHIERS FXML VERS TARGET/CLASSES, 
                SOLUTION DE CONTOURNEMENT DE BUG SCENEBUILDER -->
            <!-- NORMALEMENT CES FICHIERS DEVRAIENT ETRE EN src/main/resources MAIS 
                POSE PB POUR SCENEBUILDER -->
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <!-- here the phase you need -->
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/classes</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/java</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>**/*.fxml</include> <!-- les fichiers des écrans -->
                                        <include>**/*.xml</include> <!-- les fichiers paramètres hibernate ou autres -->
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>


                    </execution>
                </executions>
            </plugin>

            <!-- The Surefire Plugin is used during the test phase of the build lifecycle -->
            <!-- to execute the unit tests of an application. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <includes>
                        <include>${runSuite}</include>
                    </includes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.0.0-M1</version>
                <configuration>
                </configuration>
            </plugin>

        </plugins>

    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-access</artifactId>
            <version>1.2.3</version>
        </dependency>


    </dependencies>

</project>

0 个答案:

没有答案