首页 > 解决方案 > 如何使用插件编译带有 JVM 参数的 Maven JAR 文件?

问题描述

我正在寻找一个可以自行执行良好 JVM 参数的 Maven 插件。现在,我已经尝试使用maven-compiler-pluginand the maven-surefire-plugin(我的项目的 pom 在下面)。

我希望 jvm 执行的参数类型是这样的:

--module-path="C:\Program Files\Java\javafx-sdk-11\lib" --add-modules=javafx.controls

为了启动 javafx 应用程序。

pom.xml插件测试。

<build>
    <plugins>
        //tests with the surefire plugin (without tests).
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M1</version>
            <configuration>
                <skipTests>true</skipTests>
                <argLine>--module-path="C:\Program Files\Java\javafx-sdk-11\lib" --add-modules=javafx.controls</argLine>
            </configuration>
        </plugin>
    </plugins>
</build>

标签: javamavenjavafxjavafx-11openjfx

解决方案


推荐阅读