Home>

Gradle environment is being built with eclipse. If i create a new Gradle project, convert it to a Groovy project, and edit build.gradle, the library "Groovy Libraries" and "Groovy DSL Support" disappear, so I want to restore them.

Error message

Applicable source code

Original code (when "Groovy Libraries" and "Groovy DSL Support" are available)

/*
 * This build file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java Library project to get you started.
 * For more details take a look at the Java Libraries chapter in the Gradle
 * user guide available at https://docs.gradle.org/4.3/userguide/java_library_plugin.html
 * /
// Apply the java-library plugin to add support for Java Library
apply plugin: 'java-library'
// 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 ()
}
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'
}


Modified code (when "Groovy Libraries" and "Groovy DSL Support" are gone)

apply plugin: 'groovy'
repositories {
    jcenter ()
}
dependencies {
    compile 'org.seleniumhq.selenium: selenium-java: 3.14.0'
    testCompile group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.0-alpha-3', ext: 'pom'
    testCompile 'org.codehaus.groovy: groovy-all: 2.5.2'
    testCompile 'junit: junit: 4.12'
    testCompile 'org.seleniumhq.selenium: selenium-java: 3.14.0'
    testCompile group: 'org.gebish', name: 'geb-core', version: '2.2'
    testCompile group: 'org.gebish', name: 'geb-junit4', version: '2.2'
}
Tried

When you right-click on the project and execute [Build Path]-[Add Library]-[Groovy Runtime Libraries], "Groovy Libraries" was added, but the following error occurred during execution.
I don't know if the following error can be ignored, but if I have a problem later, I want to fix the error, but I don't know how to deal with the error.

Supplemental information (FW/tool version etc.)

OS: Windows10
Eclipse: Photon 4.8.0
groovy-all: 2.5.2
geb-core: 2.2
geb-junit4: 2.2

  • Answer # 1

    ■ We were able to solve it safely ■
    Right-click on the project and execute [Groovy]-[Remove Groovy DSL Support from classpath] and [Remove Groovy Libraries from classpath].
    (Note: P.151-152 of "Introduction to Selenium Practice" by Technical Critics Inc. was implemented, but it was not the same project structure, and it was half a day.)