gpt4 book ai didi

java - Ant-task 不适用于 java 9

转载 作者:行者123 更新时间:2023-11-29 08:29:17 26 4
gpt4 key购买 nike

我希望你能帮助我。

我使用 ant 构建工具制作了一个包,java 8 工作正常,但使用 java 9 我有一个异常(exception)。我不明白为什么,请帮助我

对于安装程序,我使用 Inno Setup 5。我的 IDE 是 Eclipse Oxygen.1a Release (4.7.1a)。

异常

    Buildfile: D:\Workspace BuildTest\HT .-. OE7 v2\build\build.xml
setup-staging-area:
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\externalLibs
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\externalFiles
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\project
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\projectRefs
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\externalLibs
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\externalFiles
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\project
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\projectRefs
[copy] Copying 42 files to D:\Workspace BuildTest\HT .-. OE7 v2\build\project
do-compile:
[delete] Deleting directory D:\Workspace BuildTest\HT .-. OE7 v2\build\build
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\build\src
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\build\libs
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\build\classes
[copydir] DEPRECATED - The copydir task is deprecated. Use copy instead.
[copydir] Copying 1 file to D:\Workspace BuildTest\HT .-. OE7 v2\build\externalFiles
[copydir] DEPRECATED - The copydir task is deprecated. Use copy instead.
[copydir] Copying 6 files to D:\Workspace BuildTest\HT .-. OE7 v2\build\build\libs
[copy] Copying 42 files to D:\Workspace BuildTest\HT .-. OE7 v2\build\build\src
[copy] Copying 22 files to D:\Workspace BuildTest\HT .-. OE7 v2\build\build\classes
[copy] Copied 14 empty directories to 3 empty directories under D:\Workspace BuildTest\HT .-. OE7 v2\build\build\classes
init-fx-tasks:
do-deploy:
[copy] Copying 1 file to D:\Workspace BuildTest\HT .-. OE7 v2\build\dist
[mkdir] Created dir: D:\Workspace BuildTest\HT .-. OE7 v2\build\build \classes\META-INF
"Adding modules: [java.rmi, java.sql, javafx.web, jdk.charsets, java.logging, java.xml.crypto, java.xml, jdk.xml.dom, jdk.jfr, java.datatransfer, jdk.packager.services, jdk.httpserver, javafx.base, jdk.net, java.desktop, java.naming, javafx.controls, java.prefs, java.security.sasl, jdk.naming.rmi, jdk.zipfs, java.base, jdk.crypto.ec, jdk.management.agent, java.management, java.sql.rowset, javafx.swing, jdk.jsobject, jdk.sctp, java.smartcardio, jdk.unsupported, jdk.jdwp.agent, jdk.scripting.nashorn, java.instrument, java.security.jgss, jdk.management, java.compiler, javafx.graphics, jdk.security.auth, java.scripting, javafx.fxml, jdk.dynalink, javafx.media, jdk.accessibility, java.management.rmi, jdk.naming.dns, jdk.security.jgss, jdk.localedata] to runtime image."
[fx:deploy] java.io.IOException: Exec failed with code 2 command [[C:\Program Files (x86)\Inno Setup 5\iscc.exe, /oD:\Workspace BuildTest\HT .-. OE7 v2\build\deploy, C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE 7.iss] in C:\Users\DH\AppData\Local \Temp\fxbundler15157392799151375137\images\win-exe.image
[fx:deploy] at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:169)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:142)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.IOUtils.exec(IOUtils.java:136)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.buildEXE(WinExeBundler.java:703)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.bundle(WinExeBundler.java:372)
[fx:deploy] at jdk.packager/com.oracle.tools.packager.windows.WinExeBundler.execute(WinExeBundler.java:174)
[fx:deploy] at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:371)
[fx:deploy] at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
[fx:deploy] at com.sun.javafx.tools.ant.DeployFXTask.execute(DeployFXTask.java:310)
[fx:deploy] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
[fx:deploy] at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[fx:deploy] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[fx:deploy] at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[fx:deploy] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[fx:deploy] at org.apache.tools.ant.Task.perform(Task.java:348)
[fx:deploy] at org.apache.tools.ant.Target.execute(Target.java:435)
[fx:deploy] at org.apache.tools.ant.Target.performTasks(Target.java:456)
[fx:deploy] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
[fx:deploy] at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
[fx:deploy] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[fx:deploy] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
[fx:deploy] at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
[fx:deploy] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:460)
[fx:deploy] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntR unner.java:142)

BUILD FAILED
D:\Workspace BuildTest\HT .-. OE7 v2\build\build.xml:191: Error: Bundler "EXE Installer" (exe) failed to produce a bundle.

Total time: 8 seconds

这是什么?我仍然想发布 build.xml,但出现此错误“看起来您的帖子主要是代码,请添加更多详细信息。”

最佳答案

我发现了错误。

Ant 创建了一个临时文件夹,其中复制了包的数据,现在很疯狂。

我用 Java 8 运行脚本,创建了文件“OE 7.iss”。

C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE 7.iss

我用 Java 9 运行脚本,创建了文件“OE7.iss”,他去掉程序名中的空格,找不到文件

C:\Users\DH\AppData\Local\Temp\fxbundler15157392799151375137 \images\win-exe.image\OE7.iss

我只是更改了java版本,没有别的。

我能够修复此错误,我将程序名称更改为“OE7”,但现在又出现新错误

现在创建的包(使用 Java 9)没有“OE7.iss(Inno Setup)”和外部库,当我使用 Java 8 编译它时,它工作正常

我的build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="Build" default="do-deploy" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">

<property name="project.Folder" value="Build"/>
<property name="publisher" value="Indivikar AG"/>
<property name="native.Bundles" value="exe"/>
<property name="title" value="OE7"/>
<property name="version" value="1.0.0"/>
<property name="main.Class" value="application.StageStartOE7"/>
<!-- <property name="Java.Version" value="jdk1.8.0_151"/> -->
<property name="Java.Version" value="jdk-9.0.4"/>


<property name="project.Path" value="D:\Workspace BuildTest\OE7"/>
<property name="lib.Path" value="${project.Path}\lib"/>

<target name="init-fx-tasks">
<path id="fxant">
<filelist>
<file name="C:\Program Files\Java\${Java.Version}\lib\ant-javafx.jar"/>
<file name="C:\Program Files\Java\${Java.Version}\jre\lib\ext\jfxrt.jar"/>
<file name="${basedir}"/>
</filelist>
</path>

<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpathref="fxant"/>
</target>

<target name="setup-staging-area">
<delete dir="externalLibs" />
<delete dir="externalFiles" />
<delete dir="project" />
<delete dir="projectRefs" />

<mkdir dir="externalLibs" />
<mkdir dir="externalFiles" />
<mkdir dir="project" />
<mkdir dir="projectRefs" />

<copy todir="project">
<fileset dir="${project.Path}">
<include name="src/**" />
</fileset>
</copy>
</target>

<target name='do-compile'>
<delete dir="build" />
<mkdir dir="build/src" />
<mkdir dir="build/libs" />
<mkdir dir="build/classes" />


<!-- Copy project-libs references -->
<copydir src="${lib.Path}"
dest="${basedir}\build\libs"
includes="**/*.jar"
excludes="**/Test.java"
/>

<copy todir="build/libs">
<fileset dir="externalLibs">
<include name="**/*.jar" />
</fileset>
</copy>

<!-- Copy project sources itself -->
<copy todir="build/src">
<fileset dir="project/src">
<include name="**/*"/>
</fileset>
</copy>

<javac includeantruntime="false" source="9" target="9" srcdir="build/src" destdir="build/classes" encoding="Cp1252">
<classpath>
<fileset dir="build/libs">
<include name="*"/>
</fileset>
</classpath>
</javac>

<!-- Copy over none Java-Files -->
<copy todir="build/classes">
<fileset dir="project/src">
<exclude name="**/*.java"/>
</fileset>
</copy>

</target>
<target name="do-deploy" depends="setup-staging-area, do-compile, init-fx-tasks">
<delete file="dist"/>
<delete file="deploy" />

<mkdir dir="dist" />
<mkdir dir="dist/libs" />

<copy todir="dist/libs">
<fileset dir="externalLibs">
<include name="*" />
</fileset>
</copy>

<fx:resources id="appRes">
<fx:fileset dir="dist" includes="${project.Folder}.jar"/>
<fx:fileset dir="dist" includes="libs/*"/>
<fx:fileset dir="dist" includes="resources/**"/>
</fx:resources>

<fx:application id="fxApplication"
name="${title}"
mainClass="${main.Class}"
version="${version}"
/>

<mkdir dir="build/classes/META-INF" />

<fx:jar destfile="dist/Build.jar">
<fx:application refid="fxApplication"/>
<fileset dir="build/classes">
</fileset>
<fx:resources refid="appRes"/>

<manifest>
<attribute name="Implementation-Vendor" value="${publisher}"/>
<attribute name="Implementation-Title" value="${title}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="JavaFX-Feature-Proxy" value="None"/>
</manifest>
</fx:jar>

<mkdir dir="deploy" />

<fx:deploy
embedJNLP="false"
extension="false"
includeDT="false"
offlineAllowed="true"
outdir="${basedir}/deploy"
outfile="Build" nativeBundles="${native.Bundles}"
updatemode="background"
verbose="true" >


<fx:info title="Build" vendor="${publisher}"/>

<fx:application refId="fxApplication"/>
<fx:resources refid="appRes"/>
</fx:deploy>
</target>

</project>

如果我知道更多,我会再联系你

关于java - Ant-task 不适用于 java 9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49645502/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com