我有一种情况,我们用 JSmooth 包装一个 jar 以获得合适的 exe 文件。
传统上它是由 ant 构建的,作为我们一般 mavenification 的一部分,当前的短期解决方案是使用 maven-antrun-plugin 设置属性并调用 ant。
不幸的是,这种方法在 Unix 上构建时失败了(因为没有可用的 X11 显示),解决方案是使用-Djava.awt.headless=true
. 我想在我的 pom.xml 中执行此操作,但无法确定在哪里执行此操作。
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<!-- create one-jar and exefy it -->
<property name="maven.project.build.finalName" value="${project.build.finalName}" />
<!-- note: fails on headless Linux for now -->
<ant />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
可以直接 fork 一个新的 JVM,但不要依赖于平台细节。
我怎样才能正确地做到这一点?