当前位置: 首页 > 知识库问答 >
问题:

无法在Eclipse中构建gradle项目?

朱宜
2023-03-14

找不到符号symbol:类JSONObject

java文件中存在jsonobject和json数组的所有地方都有红色标记。

我已经将包含所有jar文件的文件夹web inf/lib放在我创建的src/main/webapp目录中。

/*
 * This build file was auto generated by running the Gradle 'init' task
 * by 'i2cdev001' at '14/11/18 3:11 PM' with Gradle 2.14.1
 *
 * This generated file contains a sample Java project to get you started.
 * For more details take a look at the Java Quickstart chapter in the Gradle
 * user guide available at https://docs.gradle.org/2.14.1/userguide/tutorial_java_projects.html
 */

// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'war'

// In this section you declare where to find the dependencies of your project
repositories {
    // Use 'jcenter' for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

// In this section you declare the dependencies for your production and test code
dependencies {
    // The production code uses the SLF4J logging API at compile time
    compile 'org.slf4j:slf4j-api:1.7.21'

    // Declare the dependency for your favourite test framework you want to use in your tests.
    // TestNG is also supported by the Gradle Test task. Just change the
    // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
    // 'test.useTestNG()' to your build script.
    testCompile 'junit:junit:4.12'
}

共有1个答案

宰父飞翼
2023-03-14

由于您的项目是gradle项目,手动添加jar是行不通的。您必须提到将所有jar文件保存在build.gradle文件中的路径。

在flatDir{}下的repository中提及您的jar文件路径:

repositories {
  jcenter()
  flatDir {
   dirs 'libs'
  }
}

然后您必须从上面提到的文件夹中添加哪个jar(即libs)

dependencies {
  compile 'gson-0.1.0'
}
 类似资料:
  • 失败:生成失败,出现异常。 > 错误:任务“:CompileJava”执行失败。 找不到系统Java编译器。确保您已经安装了JDK(而不仅仅是JRE)并将您的JAVA_HOME系统变量配置为指向相应的目录。

  • 我使用gradle jar命令构建项目,然后尝试使用java-jar myproject.jar命令启动应用程序 我的建筑。加德尔:

  • 我遇到了一个问题。我正在尝试构建基于Java 1.6的遗留代码。然而,当我试图使用具有类似版本的ANT构建它时,支持运行到JRE 1.7或更高版本。我试着用Eclipse NEON按照说明操作,但没有成功。 https://blog.sibvisions.com/2016/06/30/eclipse-neon-with-ant-and-jre6/ 我有一个Eclipse Oxygen IDE,也尝

  • 我有一个简单的gradle项目,我想建立在Docker容器内 我有一个多级码头建设。第一阶段只是从github克隆项目。第二阶段必须建立项目,所以我可以在最后阶段运行它。但是它失败了 命令<代码>。/gradlew build - stacktrace无法执行并失败,错误为: 和stacktraces: 为什么docker用户没有在工作目录下创建文件的权限,如何添加这些权限?简单的< code >

  • 当我试图在eclipse中创建一个Maven项目(选择maven-archetype-quickstart,1.4版)时,我得到以下错误: 无法计算生成计划:插件org.apache.maven。插件:maven-resources-plugin:3.0.2或其依赖项之一无法解析:未能读取org.apache.maven的项目描述符。插件:maven-resources-plugin:3.0.2插

  • 我正在我的Gradle项目中使用plugin'org.springframework.boot'。更新到1.5.19.Release版本后,我在尝试构建项目时遇到一个错误: 无法解析配置“:DetachedConfiguration1”的所有依赖项。 无法解析外部依赖org.springframework.boot:spring-boot-starter-parent:1.5.19.release