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

Eclipse在运行或调试期间没有使用gradle dependencies jar

孔才
2023-03-14

我试图用Gradle项目做基本的hibernate任务。

Dependency JAR由Gradle下载并放置在项目和外部依赖项库中。

我没有得到任何编译时错误。但是,当我试图在Eclipse中运行或调试主类时,我得到的类不是ClassDefFoundError。

Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'java-library'
}

apply plugin: "eclipse"

dependencies {
    // This dependency is exported to consumers, that is to say found on their compile classpath.
    api 'org.apache.commons:commons-math3:3.6.1'

    // This dependency is used internally, and not exposed to consumers on their own compile classpath.
    implementation 'com.google.guava:guava:23.0'

    // Use JUnit test framework
    testImplementation 'junit:junit:4.12'

    // https://mvnrepository.com/artifact/org.hibernate/hibernate-core
    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.3.6.Final'

    // https://mvnrepository.com/artifact/com.oracle.jdbc/ojdbc6
    runtime group: 'com.oracle.jdbc', name: 'ojdbc6', version: '11.1.0.6.0'

    // https://mvnrepository.com/artifact/com.oracle/ojdbc6
    runtime group: 'com.oracle', name: 'ojdbc6', version: '11.2.0.4.0-atlassian-hosted'




}

// 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()
    mavenCentral()
}

提前感谢!!!

共有1个答案

罗安和
2023-03-14

我认为您应该用构建文件中的最新更改更新类路径。Eclipse并不是在所有版本中都自动做到这一点。转到package explorer,右键单击build.gradle文件,然后从上下文菜单中选择gradle->Refresh gradle Project。

您还可以从首选项菜单中启用自动同步,转到分级,并选中“自动项目同步”复选框。

 类似资料:
  • 我已经在Eclipse中创建了用于执行Selenium测试的Maven项目。我编写了一个TestSuite作为testng.xml。我喜欢从pom.xml运行这个testng.xml。 当我运行pom.xml时(右键单击pom.xml->Maven test),构建是成功的,但没有运行任何测试。测试结果如下: 结果:运行的测试:0次,失败:0次,错误:0次,跳过:0次 我的testng.xml:

  • 我正在尝试使用IntelliJ调试Spring Boot项目。突然,我的线路在工作了几年后无法调试。 它将通过类进行调试,但当我尝试运行一个方法时,它不会看到断点。我之前收到了一个应用程序上下文消息,我修复了它,但它仍然不起作用。https://www.jetbrains.com/help/idea/2021.2/spring-support.html#spring-file-set 它将在后台看

  • 问题内容: 我刚刚在Eclipse上第一次安装了插件m2e。 我编写了一个简单的JUnit(版本4)测试。我可以从Eclipse中运行它,但不能从pom.xml中运行它(alt单击,运行方式,Maven测试)。我想我需要告诉Maven搜索该课程,但我只是不知道如何。 另外,我在groupId“ junit”中找不到JUnit 4:只有版本3.8.1可用。我真的需要为3.x版本而不是4+版本编写测试

  • 我是hadoop的新手,尝试在hadoop 2.6.0中设置两个数据节点的hadoop多节点集群,但是当我尝试运行mapreduce应用程序时,它没有运行或者占用更多的时间,但是所有的恶魔都在每两个节点上运行得很好。 [hadoop@slave~]$jps 13406 MRAppMaster 9225 NodeManager 9072 DataNode 13591 jps[hadoop@maste

  • 问题内容: 我正在尝试使用Eclipse作为IDE在计算机上调试简单的Java应用程序。当我尝试通过进入Debug Perspective调试应用程序时,我设置了一个断点并开始调试。在几秒钟内,将出现以下弹出窗口: 。 在控制台上转储的消息如下: 我该如何纠正?为什么会这样? 问题答案: 我只是有同样的问题。 昨天一切正常,现在什么都没有了-与您给出的错误相同。我发现网络管理员在此期间进行了一些更

  • 问题内容: 即使我单击常规的“运行”按钮,Eclipse始终以调试模式启动我的应用程序。 有任何想法吗? 问题答案: 我发现必须重新启动Xoom才能使其再次正常运行。