Gradle Eclipse not working correctly for subprojects

Gradle 2.4 and Eclipse Mars. Here is my project directory structure:

myapp/  <-- root project
    myapp-client/
        src/main/groovy/*
        build.gradle <-- just declares some client-specific deps
    myapp-shared/
        src/main/groovy/*
        build.gradle <-- shared-specific deps
    myapp-server/
        src/main/groovy/*
        build.gradle <-- server-specific deps and how to package server JAR
    build.gradle
    settings.gradle

Where myapp/build.gradle:

allprojects {
    apply plugin: 'groovy'
    apply plugin: 'eclipse'
    apply plugin: 'maven'
    apply plugin: 'codenarc'

    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
    [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

    repositories {
        // ...etc.
    }

    dependencies {
        // ...etc.
    }

    task wrapper(type: Wrapper) {
        gradleVersion = '2.4'
    }
}

And where myapp/settings.gradle:

include ':myapp-shared'
include ':myapp-client'
include ':myapp-server'

When I do ./gradlew eclipse, I get messages that the team was successful. Then I open Eclipse for import myappas a series of separate subprojects.

Waiting based on what I'm used to seeing, historically

In previous projects that contained subprojects, I would like to go to Import >> Existing Projects into Workspacewhere I would see this dialog box:

enter image description here

Browse ( myapp). Eclipse 3 Projects . "", Eclipse 3 , ( ).

, myapp , Eclipse , , :

enter image description here

"", , . , , . , myapp-shared, , myapp-client, Eclipse import ! , , / .

Gradle Gradle, ?

+4
1

, . , - .


  • allprojects allprojects subprojects. , "" , , repositories allprojects, subprojects.
  • , gradle eclipse ( , subprojects), Gradle (, .projects, .classpath, .settings/*) / . ...
  • Gradle -Eclipse . Eclipse (, !!!). , Eclipse, , .
  • gradle clean . , .
  • gradle eclipse .
  • Eclipse, , .
+7

Source: https://habr.com/ru/post/1608461/


All Articles