簡體   English   中英

無法運行 Ant 內置 Eclipse

[英]Cannot Run Ant Build in Eclipse

我的 ant 構建最近某個時候停止工作。 我不知道確切的時間,因為我在這個項目中偶爾只做 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 來解決問題,但沒有成功。

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

該 java 文件夾中的release文件說:

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"

知道如何解決這個問題嗎?

這似乎與用於運行 Ant 腳本的 Java 有關。

運行配置JRE選項卡中確保選擇了 JRE/JDK (對於現有的 Ant 運行配置,可能會由於首選項Java > 已安裝 JRE 的更改或更新時丟失先前選擇的 JRE/JDK爪哇)。 如果已經選擇了 JRE/JDK,請在此處嘗試另一個 JRE/JDK 設置(如果指定了 VM 參數,請在沒有它​​們的情況下嘗試,因為它們對於所選的 VM 可能是非法的)。

Eclipse升級到2022-03后出現類似錯誤。 Ant 不會運行但沒有顯示錯誤。 然后我注意到工作區日志中的java.net.SocketException: Socket closed錯誤。

僅當我使用最新的 Java 版本但我需要使用 JDK 1.8 時,才按照其他答案的建議更改 JRE。 由於無法解決問題,我只是將 Eclipse 降級為 2021-12。

顯然,在未來的版本中至少需要 Java 11 才能運行 Ant: https://bugs.eclipse.org/bugs/show_bug.cgi?id=579317

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM