Ant 在 JDK9 上的 maven 构建期间无法创建.pkg文件



我正在将javaFx应用程序的构建过程从JDK8升级到JDK9,但我遇到了问题。

构建过程由 Maven 运行,并使用 Ant 将 jar 文件捆绑到 pkg 文件(在 Mac Osx 上(和 Windows 中的 MSI 文件中。

Maven 版本:3.5.2。蚂蚁版本:

我在执行构建期间收到异常:

com.oracle.tools.packager.ConfigException: java.lang.RuntimeException: File /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/jmods does not belong to <our project binaries folder>
    at jdk.packager/com.oracle.tools.packager.mac.MacPkgBundler.validate(MacPkgBundler.java:568)
    at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:370)
    at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
    at com.sun.javafx.tools.ant.DeployFXTask.execute(DeployFXTask.java:310)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at jdk.internal.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at jdk.internal.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:313)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

在 maven 中,我使用以下插件(全部升级到最新版本(:

  • 专家资源插件:3.0.2
  • Maven-dependency-plugin: 3.0.2
  • 执行插件:1.6.0
  • Maven-编译器-插件:3.7.0(配置为使用 JDK 9(
  • Maven-Surefire-plugin: 2.20.1
构建

在我们的构建中配置的 fx:deply 任务中失败.xml如下所示:

<fx:deploy width="600" height="400" install="true"
        verbose="true" nativeBundles="${native.bundles}" 
        outdir="${dist.dir}/bundle" outfile="${app.name}" >
        <fx:application id="${app.id}" name="${app.name}" mainClass="${javafx.main.class}" version="${app.version}" />
        <fx:preferences shortcut="true" menu="false" install="true"/>
        <fx:secondaryLauncher 
            mainClass="com.pingidentity.proxy.proxyhelper.ProxyExternalEntryPoint"
            name="ProxyHelperSetup"/>
        <fx:secondaryLauncher 
            mainClass="com.pingidentity.proxy.proxyhelper.AutoUpdatesExternalEntryPoint"
            name="AutoUpdatesSetup"/>
        <fx:secondaryLauncher
            mainClass="com.pingidentity.proxy.proxyhelper.MigrationHelper" 
            name="MigrationHelperSetup"/>
        <fx:resources >
            <fx:fileset dir="${dist.dir}" includes="${jar.name}"/>
            <fx:fileset dir="${dist.dir}/lib" />
            <fx:fileset dir="${resources.dir}"  type="license" includes="license.rtf"/>
                <fx:fileset dir="${resources.dir}"  type="license" includes="testwelcome.rtf"/>
            <fx:fileset dir="${basedir}/UnlimitedJCEPolicy" includes="*.jar" />
            <!-- the attr os="mac" not works, so I created emtpy folder in case of windows -->
            <fx:fileset dir="${dist.dir}/uninstaller" />
        </fx:resources>
        <fx:info  title="${app.name}" vendor="${vendor}" category="public.app-category.productivity">
        </fx:info>
        <fx:platform>
            <fx:jvmarg value="-Xms128m"/>
            <fx:jvmarg value="-Xmx384m"/>
            <fx:jvmarg value="-Xmn64m"/>
        </fx:platform>
        <fx:bundleArgument arg="mac.CFBundleVersion" value="${app.version}"/>
        <fx:bundleArgument arg="mac.signing-key-developer-id-app" value="Developer ID Application: Ping Identity Corporation (6U3RF4C84N)"/>
        <fx:bundleArgument arg="mac.signing-key-developer-id-installer" value="Developer ID Installer: Ping Identity Corporation (6U3RF4C84N)"/>
            <fx:bundleArgument arg="mainJar" value="${dist.dir}/${jar.name}" />
    </fx:deploy>

有什么想法吗?

我发现添加此行会使错误消失:build.xml -> fx:deploy ->

<fx:runtime strip-native-commands="false">
    <fx:add-modules value="java.base"/>
    <fx:module-path value="${java.home}/jmods"/>
    <fx:module-path value="${basedir}/modules"/>
</fx:runtime>

相关内容

  • 没有找到相关文章

最新更新