首页 > 解决方案 > 无法在 Eclipse 中运行 Ant Build

问题描述

我的 ant build 最近某个时候停止工作。我不知道确切的时间,因为我只是偶尔在这个项目中进行 ant 构建。我得到以下弹出窗口:

在此处输入图像描述

该错误仅针对此项目。我可以从另一个项目运行构建没问题。

build.xml 文件可能非常简单,但仍然会导致错误:

<project basedir=".">
    <target name="init">
    </target>
</project>

我检查了 Eclipse 的日志,我得到了这个错误:

!SESSION 2020-10-15 04:24:23.311 -----------------------------------------------
eclipse.buildId=4.17.0.I20200902-1800
java.version=13.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product

!ENTRY org.eclipse.jface 2 0 2020-10-15 04:24:25.323
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2020-10-15 04:24:25.323
!MESSAGE A conflict occurred for CTRL+SHIFT+T:
Binding(CTRL+SHIFT+T,
  ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
    Open a type in a Java editor,
    Category(org.eclipse.ui.category.navigate,Navigate,null,true),
    org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@5f67181f,
    ,,true),null),
  org.eclipse.ui.defaultAcceleratorConfiguration,
  org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+SHIFT+T,
  ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
    ,
    Category(org.eclipse.lsp4e.category,Language Servers,null,true),
    org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@1169fdfd,
    ,,true),null),
  org.eclipse.ui.defaultAcceleratorConfiguration,
  org.eclipse.ui.contexts.window,,,system)

!ENTRY org.eclipse.e4.ui.workbench 4 0 2020-10-15 04:24:27.543
!MESSAGE Unable to retrieve the bundle from the URI: bundleclass://org.eclipse.recommenders.news.rcp/org.eclipse.recommenders.internal.news.rcp.toolbar.NewsToolControl

!ENTRY org.eclipse.egit.ui 2 0 2020-10-15 04:24:28.090
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\Joshua'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

    !ENTRY org.eclipse.ant.launching 4 120 2020-10-15 04:24:37.887
    !MESSAGE Error logged from Ant UI: 
    !STACK 0
    java.net.SocketException: Socket closed
      at java.base/sun.nio.ch.NioSocketImpl.endAccept(NioSocketImpl.java:689)
      at java.base/sun.nio.ch.NioSocketImpl.accept(NioSocketImpl.java:762)
      at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:662)
      at java.base/java.net.ServerSocket.platformImplAccept(ServerSocket.java:628)
      at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:604)
      at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:561)
      at java.base/java.net.ServerSocket.accept(ServerSocket.java:518)
      at org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntBuildListener$ServerConnection.run(RemoteAntBuildListener.java:91)

    !ENTRY org.eclipse.core.jobs 4 2 2020-10-15 04:24:37.888
    !MESSAGE An internal error occurred during: "Launching Hypnos build.xml".
    !STACK 0
    java.lang.NullPointerException
      at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.getBootpathExt(AbstractJavaLaunchConfigurationDelegate.java:364)
      at org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate.getVMSpecificAttributesMap(AbstractJavaLaunchConfigurationDelegate.java:679)
      at org.eclipse.jdt.launching.JavaLaunchDelegate.getVMRunnerConfiguration(JavaLaunchDelegate.java:92)
      at org.eclipse.jdt.launching.JavaLaunchDelegate.launch(JavaLaunchDelegate.java:160)
      at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate.runInSeparateVM(AntLaunchDelegate.java:580)
      at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate.launch(AntLaunchDelegate.java:251)
      at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:807)
      at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:718)
      at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1021)
      at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1224)
      at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

我使用的是 Eclipse 2020-06。我尝试升级到 Eclipse 2020-09 来解决这个问题,但没有运气。

根据eclipse的JVM是eclipse.vm=C:\java\jdk-13.0.1\bin\server\jvm.dll

releasejava文件夹中的文件说:

BUILD_TYPE="commercial"
IMPLEMENTOR="Oracle Corporation"
JAVA_VERSION="13.0.1"
JAVA_VERSION_DATE="2019-10-15"
MODULES="java.base java.compiler java.datatransfer java.xml java.prefs java.desktop java.instrument java.logging java.management java.security.sasl java.naming java.rmi java.management.rmi java.net.http java.scripting java.security.jgss java.transaction.xa java.sql java.sql.rowset java.xml.crypto java.se java.smartcardio jdk.accessibility jdk.internal.vm.ci jdk.management jdk.unsupported jdk.internal.vm.compiler jdk.aot jdk.internal.jvmstat jdk.attach jdk.charsets jdk.compiler jdk.crypto.ec jdk.crypto.cryptoki jdk.crypto.mscapi jdk.dynalink jdk.internal.ed jdk.editpad jdk.hotspot.agent jdk.httpserver jdk.internal.le jdk.internal.opt jdk.internal.vm.compiler.management jdk.jartool jdk.javadoc jdk.jcmd jdk.management.agent jdk.jconsole jdk.jdeps jdk.jdwp.agent jdk.jdi jdk.jfr jdk.jlink jdk.jshell jdk.jsobject jdk.jstatd jdk.localedata jdk.management.jfr jdk.naming.dns jdk.naming.rmi jdk.net jdk.pack jdk.rmic jdk.scripting.nashorn jdk.scripting.nashorn.shell jdk.sctp jdk.security.auth jdk.security.jgss jdk.unsupported.desktop jdk.xml.dom jdk.zipfs"
OS_ARCH="x86_64"
OS_NAME="Windows"
SOURCE=".:hg:b06ae01c3eea open:hg:8d03d066c4e8"

知道如何解决这个问题吗?

标签: eclipseant

解决方案


这似乎与用于运行 Ant 脚本的 Java 有关。

运行配置中,在JRE选项卡中,确保选择了 JRE/JDK(对于现有的 Ant 运行配置,由于首选项Java > Installed JREs的更改或更新时可能会丢失先前选择的 JRE/JDK爪哇)。如果已经选择了 JRE/JDK,请在此处尝试另一个 JRE/JDK 设置(如果指定了 VM 参数,请尝试不使用它们,因为它们对于所选 VM 可能是非法的)。


推荐阅读