Launch4j Maven 集成:传递 VM 参数 (-XX:CompileCommand)

Launch4j Maven integration: Pass VM arguments (-XX:CompileCommand)

我们在 Java 8 中遇到了与特定 swing 方法相关的 JIT 错误。 LINK。现在我们必须禁用此特定方法的 JIT 作为 launch4j 中的 vm 参数,但我似乎无法将此 vm 参数传递给 maven 中的 launch4j。我有以下 Maven 声明:

        <plugin>
            <groupId>org.bluestemsoftware.open.maven.plugin</groupId>
            <artifactId>launch4j-plugin</artifactId>
            <version>1.5.0.0</version>
            <executions>
                <!-- GUI exe -->
                <execution>
                    <id>l4j-gui</id>
                    <phase>package</phase>
                    <goals>
                        <goal>launch4j</goal>
                    </goals>
                    <configuration>
                        <headerType>gui</headerType>
                        <outfile>target/Launcher_${version}.exe</outfile>
                        <jar>target/${jar.file.withDependencies.name}</jar>
                        <errTitle>Error Title</errTitle>
                        <icon>src/main/resources/icon/icon.ico</icon>
                        <jre>
                            <minVersion>1.7.0</minVersion>
                            <initialHeapSize>128</initialHeapSize>
                            <maxHeapSize>900</maxHeapSize>

                             <!-- Doesn't work... -->
                            <!--<opt>-OmitStackTraceInFastThrow</opt>-->

                        </jre>
                        <versonInfo>
                            <fileVersion>1.0.0.0</fileVersion>
                        </versionInfo>
                    </configuration>
                </execution>
            </executions>
        </plugin>

你应该封装里面的 opt 元素和 opt 标签。

在你的例子中,在 jre 标签内:

<opts> <opt>-OmitStackTraceInFastThrow</opt> </opts>