gpt4 book ai didi

java - Libgdx gradle 项目编译失败

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

我在我的项目中添加了一些代码并且它工作正常,直到我再次运行它并给我这个错误消息:

4:46:46 PM: Executing external task 'run'...
Configuration on demand is an incubating feature.
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\Users\me\Desktop\myProject\core\src\com\thiIsme\project\World\WorldController.java:10: error: package com.sun.xml.internal.bind.v2.runtime.reflect.opt does not exist
import com.sun.xml.internal.bind.v2.runtime.reflect.opt.Const;
^
1 error
1 warning
:core:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':core:compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.74 secs
Compilation failed; see the compiler error output for details.
4:46:47 PM: External task execution finished 'run'.

我很确定我收到错误不是因为我新添加的代码,因为我把它全部注释掉了。

最佳答案

error: package com.sun.xml.internal.bind.v2.runtime.reflect.opt does not exist

根据您的错误,缺少以下 jar。所以将此 jar 添加到您的 dependencies。希望它能解决您的问题。

// https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl
compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.2.11'

更新1:

在您的项目中,您将获得build.gradle 文件。打开它,会有一个名为 dependencies 的部分。您必须在依赖项中添加该行。

如果之前的条件如下:

dependencies {
compile group: 'log4j', name: 'log4j', version: '1.2.17'
}

添加这个 jar 文件后,它看起来像下面这样

dependencies {
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.2.11' // This portion is added
}

资源位置:

要了解有关 gradle 的更多信息,您可以阅读以下教程:

  1. Using the Gradle build system in the Eclipse IDE - Tutorial
  2. The Gradle build system- Tutorial

关于java - Libgdx gradle 项目编译失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37905491/

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