I am trying to do basic hibernate task using Gradle project.

Dependency jars are download by Gradle and placed in Project and External Dependencies library.

[![enter image description here](https://i.stack.imgur.com/bgO40.png)](https://i.stack.imgur.com/bgO40.png)

I don't get any compile time error. But when I try to run or debug the main class in Eclipse, I am getting class not found NoClassDefFoundError.

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

```

When I checked the build path, I could see the dependency library is configured with required jars but still eclipse is not using it.

[![enter image description here](https://i.stack.imgur.com/7RhwH.png)](https://i.stack.imgur.com/7RhwH.png)

But when I add the jar manually in the build path, I am not getting this exception.

[![enter image description here](https://i.stack.imgur.com/Fmjh4.png)](https://i.stack.imgur.com/Fmjh4.png)

Build.gradle File

```
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()
}

```

Thanks in advance!!!