IntelliJ Gradle deletes its own modules unexpectedly





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















This is the dialog indicating the modules which are being deleted



enter image description here



but when I import a new project with build.gradle and I do not enable auto import now I have a dialog asking my if I would like to enable auto import, and the modules are no longer deleted automatically.



enter image description here



Here is the build.gradle file



/*------------------------------------------------------------------------------
Gradle latest file.

Build command:
./gradlew deploy

Create Javadocs at ./latest/docs/javadoc/index.html
./gradlew buildJavadocs

Other commands of interest:
./gradlew wrapper --gradle-version 4.7
./gradlew tasks
./gradlew properties

Manual search for dependencies in Gradle repository:
https://bintray.com/bintray/jcenter/io.appium%3Ajava-client
------------------------------------------------------------------------------*/
group 'com.my.group'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceSets {
main {
java {
srcDir 'src/'
}
}
}
sourceCompatibility = 1.8

repositories {
jcenter()
}

dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile 'junit:junit:4.12'
compile 'org.seleniumhq.selenium:selenium-java:3.11.0'
compile 'io.appium:java-client:6.1.0' // /compile 'io.appium:java-client:6.0.0-BETA5'
//compile 'io.appium:java-client:6.0.0-BETA5' // compile 'io.appium:java-client:6.1.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'com.google.guava:guava:24.1-jre'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
}

task copyToLib(type: Copy, dependsOn: build) {
String dst = "$rootDir/jar"
description "Copy library JAR dependencies to $dst"
from configurations.runtime
into "$dst"
}

task copyToOut(type: Copy, dependsOn: build) {
String dst = "$rootDir/out"
description "Copy library JAR output to $dst"
from jar
into "$dst"
}

task deploy {
dependsOn clean
dependsOn build
dependsOn copyToLib
dependsOn copyToOut
}

task buildJavadocs(type: Javadoc) {
exclude 'srcOld/**'
classpath += sourceSets.test.compileClasspath
source += sourceSets.main.allJava
}


edit



When Gradle deletes the modules, it also delete gradle.build and the gradle wrapper. I've already created a brand new project with the default Java template, and copied and pasted my code into it, but the problem persists.










share|improve this question

























  • Could you paste your gradle buildscript and a screenshot of File->project structure->Modules. It seems like you are trying to configure your modules using intellij but in reality that dosen't work as intellij follows the projects configured using gradles build script

    – Ryotsu
    Nov 22 '18 at 5:58













  • @th3sp33dst3r So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

    – the_prole
    Nov 22 '18 at 17:37











  • no, actually gradle leaves any already existing modules defined using intellij untouched and you could also create other intellij defined modules when you're using gradle. The above message crops up when you remove an already defined sub-project(as gradle calls it) in your settings.gradle script by removing it fom includes. Did you or anyone else recently edit the settings.gradle file in the root project?

    – Ryotsu
    Nov 23 '18 at 2:21













  • So did this happen after you made the changes i suggested or did you make any changes? Is your issue resolved? because from the edit you made, You get the import project... option when you make changes to any of the build.gradle or settings.gradle files and also the problem of your modules getting deleted seems to be solved.

    – Ryotsu
    Nov 27 '18 at 5:11













  • @th3sp33dst3r the modules are still deleted if I enable auto import which is why I imported the build Gradle file as a new project and left auto import unchecked, so now IDE asks me I would like to enable auto import, but no behaviour has changed, this is just a work around. Sorry, but I can't tell which changes you reccomended. I do not believe anyone has touched the build Gradle file, though I could double check in git history. What changes did you reccomend?

    – the_prole
    Nov 27 '18 at 7:43




















0















This is the dialog indicating the modules which are being deleted



enter image description here



but when I import a new project with build.gradle and I do not enable auto import now I have a dialog asking my if I would like to enable auto import, and the modules are no longer deleted automatically.



enter image description here



Here is the build.gradle file



/*------------------------------------------------------------------------------
Gradle latest file.

Build command:
./gradlew deploy

Create Javadocs at ./latest/docs/javadoc/index.html
./gradlew buildJavadocs

Other commands of interest:
./gradlew wrapper --gradle-version 4.7
./gradlew tasks
./gradlew properties

Manual search for dependencies in Gradle repository:
https://bintray.com/bintray/jcenter/io.appium%3Ajava-client
------------------------------------------------------------------------------*/
group 'com.my.group'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceSets {
main {
java {
srcDir 'src/'
}
}
}
sourceCompatibility = 1.8

repositories {
jcenter()
}

dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile 'junit:junit:4.12'
compile 'org.seleniumhq.selenium:selenium-java:3.11.0'
compile 'io.appium:java-client:6.1.0' // /compile 'io.appium:java-client:6.0.0-BETA5'
//compile 'io.appium:java-client:6.0.0-BETA5' // compile 'io.appium:java-client:6.1.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'com.google.guava:guava:24.1-jre'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
}

task copyToLib(type: Copy, dependsOn: build) {
String dst = "$rootDir/jar"
description "Copy library JAR dependencies to $dst"
from configurations.runtime
into "$dst"
}

task copyToOut(type: Copy, dependsOn: build) {
String dst = "$rootDir/out"
description "Copy library JAR output to $dst"
from jar
into "$dst"
}

task deploy {
dependsOn clean
dependsOn build
dependsOn copyToLib
dependsOn copyToOut
}

task buildJavadocs(type: Javadoc) {
exclude 'srcOld/**'
classpath += sourceSets.test.compileClasspath
source += sourceSets.main.allJava
}


edit



When Gradle deletes the modules, it also delete gradle.build and the gradle wrapper. I've already created a brand new project with the default Java template, and copied and pasted my code into it, but the problem persists.










share|improve this question

























  • Could you paste your gradle buildscript and a screenshot of File->project structure->Modules. It seems like you are trying to configure your modules using intellij but in reality that dosen't work as intellij follows the projects configured using gradles build script

    – Ryotsu
    Nov 22 '18 at 5:58













  • @th3sp33dst3r So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

    – the_prole
    Nov 22 '18 at 17:37











  • no, actually gradle leaves any already existing modules defined using intellij untouched and you could also create other intellij defined modules when you're using gradle. The above message crops up when you remove an already defined sub-project(as gradle calls it) in your settings.gradle script by removing it fom includes. Did you or anyone else recently edit the settings.gradle file in the root project?

    – Ryotsu
    Nov 23 '18 at 2:21













  • So did this happen after you made the changes i suggested or did you make any changes? Is your issue resolved? because from the edit you made, You get the import project... option when you make changes to any of the build.gradle or settings.gradle files and also the problem of your modules getting deleted seems to be solved.

    – Ryotsu
    Nov 27 '18 at 5:11













  • @th3sp33dst3r the modules are still deleted if I enable auto import which is why I imported the build Gradle file as a new project and left auto import unchecked, so now IDE asks me I would like to enable auto import, but no behaviour has changed, this is just a work around. Sorry, but I can't tell which changes you reccomended. I do not believe anyone has touched the build Gradle file, though I could double check in git history. What changes did you reccomend?

    – the_prole
    Nov 27 '18 at 7:43
















0












0








0








This is the dialog indicating the modules which are being deleted



enter image description here



but when I import a new project with build.gradle and I do not enable auto import now I have a dialog asking my if I would like to enable auto import, and the modules are no longer deleted automatically.



enter image description here



Here is the build.gradle file



/*------------------------------------------------------------------------------
Gradle latest file.

Build command:
./gradlew deploy

Create Javadocs at ./latest/docs/javadoc/index.html
./gradlew buildJavadocs

Other commands of interest:
./gradlew wrapper --gradle-version 4.7
./gradlew tasks
./gradlew properties

Manual search for dependencies in Gradle repository:
https://bintray.com/bintray/jcenter/io.appium%3Ajava-client
------------------------------------------------------------------------------*/
group 'com.my.group'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceSets {
main {
java {
srcDir 'src/'
}
}
}
sourceCompatibility = 1.8

repositories {
jcenter()
}

dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile 'junit:junit:4.12'
compile 'org.seleniumhq.selenium:selenium-java:3.11.0'
compile 'io.appium:java-client:6.1.0' // /compile 'io.appium:java-client:6.0.0-BETA5'
//compile 'io.appium:java-client:6.0.0-BETA5' // compile 'io.appium:java-client:6.1.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'com.google.guava:guava:24.1-jre'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
}

task copyToLib(type: Copy, dependsOn: build) {
String dst = "$rootDir/jar"
description "Copy library JAR dependencies to $dst"
from configurations.runtime
into "$dst"
}

task copyToOut(type: Copy, dependsOn: build) {
String dst = "$rootDir/out"
description "Copy library JAR output to $dst"
from jar
into "$dst"
}

task deploy {
dependsOn clean
dependsOn build
dependsOn copyToLib
dependsOn copyToOut
}

task buildJavadocs(type: Javadoc) {
exclude 'srcOld/**'
classpath += sourceSets.test.compileClasspath
source += sourceSets.main.allJava
}


edit



When Gradle deletes the modules, it also delete gradle.build and the gradle wrapper. I've already created a brand new project with the default Java template, and copied and pasted my code into it, but the problem persists.










share|improve this question
















This is the dialog indicating the modules which are being deleted



enter image description here



but when I import a new project with build.gradle and I do not enable auto import now I have a dialog asking my if I would like to enable auto import, and the modules are no longer deleted automatically.



enter image description here



Here is the build.gradle file



/*------------------------------------------------------------------------------
Gradle latest file.

Build command:
./gradlew deploy

Create Javadocs at ./latest/docs/javadoc/index.html
./gradlew buildJavadocs

Other commands of interest:
./gradlew wrapper --gradle-version 4.7
./gradlew tasks
./gradlew properties

Manual search for dependencies in Gradle repository:
https://bintray.com/bintray/jcenter/io.appium%3Ajava-client
------------------------------------------------------------------------------*/
group 'com.my.group'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceSets {
main {
java {
srcDir 'src/'
}
}
}
sourceCompatibility = 1.8

repositories {
jcenter()
}

dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
compile 'junit:junit:4.12'
compile 'org.seleniumhq.selenium:selenium-java:3.11.0'
compile 'io.appium:java-client:6.1.0' // /compile 'io.appium:java-client:6.0.0-BETA5'
//compile 'io.appium:java-client:6.0.0-BETA5' // compile 'io.appium:java-client:6.1.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'com.google.guava:guava:24.1-jre'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
}

task copyToLib(type: Copy, dependsOn: build) {
String dst = "$rootDir/jar"
description "Copy library JAR dependencies to $dst"
from configurations.runtime
into "$dst"
}

task copyToOut(type: Copy, dependsOn: build) {
String dst = "$rootDir/out"
description "Copy library JAR output to $dst"
from jar
into "$dst"
}

task deploy {
dependsOn clean
dependsOn build
dependsOn copyToLib
dependsOn copyToOut
}

task buildJavadocs(type: Javadoc) {
exclude 'srcOld/**'
classpath += sourceSets.test.compileClasspath
source += sourceSets.main.allJava
}


edit



When Gradle deletes the modules, it also delete gradle.build and the gradle wrapper. I've already created a brand new project with the default Java template, and copied and pasted my code into it, but the problem persists.







gradle intellij-idea gradlew






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 30 '18 at 23:20







the_prole

















asked Nov 21 '18 at 21:53









the_prolethe_prole

3,00463481




3,00463481













  • Could you paste your gradle buildscript and a screenshot of File->project structure->Modules. It seems like you are trying to configure your modules using intellij but in reality that dosen't work as intellij follows the projects configured using gradles build script

    – Ryotsu
    Nov 22 '18 at 5:58













  • @th3sp33dst3r So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

    – the_prole
    Nov 22 '18 at 17:37











  • no, actually gradle leaves any already existing modules defined using intellij untouched and you could also create other intellij defined modules when you're using gradle. The above message crops up when you remove an already defined sub-project(as gradle calls it) in your settings.gradle script by removing it fom includes. Did you or anyone else recently edit the settings.gradle file in the root project?

    – Ryotsu
    Nov 23 '18 at 2:21













  • So did this happen after you made the changes i suggested or did you make any changes? Is your issue resolved? because from the edit you made, You get the import project... option when you make changes to any of the build.gradle or settings.gradle files and also the problem of your modules getting deleted seems to be solved.

    – Ryotsu
    Nov 27 '18 at 5:11













  • @th3sp33dst3r the modules are still deleted if I enable auto import which is why I imported the build Gradle file as a new project and left auto import unchecked, so now IDE asks me I would like to enable auto import, but no behaviour has changed, this is just a work around. Sorry, but I can't tell which changes you reccomended. I do not believe anyone has touched the build Gradle file, though I could double check in git history. What changes did you reccomend?

    – the_prole
    Nov 27 '18 at 7:43





















  • Could you paste your gradle buildscript and a screenshot of File->project structure->Modules. It seems like you are trying to configure your modules using intellij but in reality that dosen't work as intellij follows the projects configured using gradles build script

    – Ryotsu
    Nov 22 '18 at 5:58













  • @th3sp33dst3r So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

    – the_prole
    Nov 22 '18 at 17:37











  • no, actually gradle leaves any already existing modules defined using intellij untouched and you could also create other intellij defined modules when you're using gradle. The above message crops up when you remove an already defined sub-project(as gradle calls it) in your settings.gradle script by removing it fom includes. Did you or anyone else recently edit the settings.gradle file in the root project?

    – Ryotsu
    Nov 23 '18 at 2:21













  • So did this happen after you made the changes i suggested or did you make any changes? Is your issue resolved? because from the edit you made, You get the import project... option when you make changes to any of the build.gradle or settings.gradle files and also the problem of your modules getting deleted seems to be solved.

    – Ryotsu
    Nov 27 '18 at 5:11













  • @th3sp33dst3r the modules are still deleted if I enable auto import which is why I imported the build Gradle file as a new project and left auto import unchecked, so now IDE asks me I would like to enable auto import, but no behaviour has changed, this is just a work around. Sorry, but I can't tell which changes you reccomended. I do not believe anyone has touched the build Gradle file, though I could double check in git history. What changes did you reccomend?

    – the_prole
    Nov 27 '18 at 7:43



















Could you paste your gradle buildscript and a screenshot of File->project structure->Modules. It seems like you are trying to configure your modules using intellij but in reality that dosen't work as intellij follows the projects configured using gradles build script

– Ryotsu
Nov 22 '18 at 5:58







Could you paste your gradle buildscript and a screenshot of File->project structure->Modules. It seems like you are trying to configure your modules using intellij but in reality that dosen't work as intellij follows the projects configured using gradles build script

– Ryotsu
Nov 22 '18 at 5:58















@th3sp33dst3r So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

– the_prole
Nov 22 '18 at 17:37





@th3sp33dst3r So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

– the_prole
Nov 22 '18 at 17:37













no, actually gradle leaves any already existing modules defined using intellij untouched and you could also create other intellij defined modules when you're using gradle. The above message crops up when you remove an already defined sub-project(as gradle calls it) in your settings.gradle script by removing it fom includes. Did you or anyone else recently edit the settings.gradle file in the root project?

– Ryotsu
Nov 23 '18 at 2:21







no, actually gradle leaves any already existing modules defined using intellij untouched and you could also create other intellij defined modules when you're using gradle. The above message crops up when you remove an already defined sub-project(as gradle calls it) in your settings.gradle script by removing it fom includes. Did you or anyone else recently edit the settings.gradle file in the root project?

– Ryotsu
Nov 23 '18 at 2:21















So did this happen after you made the changes i suggested or did you make any changes? Is your issue resolved? because from the edit you made, You get the import project... option when you make changes to any of the build.gradle or settings.gradle files and also the problem of your modules getting deleted seems to be solved.

– Ryotsu
Nov 27 '18 at 5:11







So did this happen after you made the changes i suggested or did you make any changes? Is your issue resolved? because from the edit you made, You get the import project... option when you make changes to any of the build.gradle or settings.gradle files and also the problem of your modules getting deleted seems to be solved.

– Ryotsu
Nov 27 '18 at 5:11















@th3sp33dst3r the modules are still deleted if I enable auto import which is why I imported the build Gradle file as a new project and left auto import unchecked, so now IDE asks me I would like to enable auto import, but no behaviour has changed, this is just a work around. Sorry, but I can't tell which changes you reccomended. I do not believe anyone has touched the build Gradle file, though I could double check in git history. What changes did you reccomend?

– the_prole
Nov 27 '18 at 7:43







@th3sp33dst3r the modules are still deleted if I enable auto import which is why I imported the build Gradle file as a new project and left auto import unchecked, so now IDE asks me I would like to enable auto import, but no behaviour has changed, this is just a work around. Sorry, but I can't tell which changes you reccomended. I do not believe anyone has touched the build Gradle file, though I could double check in git history. What changes did you reccomend?

– the_prole
Nov 27 '18 at 7:43














2 Answers
2






active

oldest

votes


















0














In case of a Gradle projects IDE configures the project structure including the modules that are included in project according your the build.gradle script. E.g. if you have Create separate module per source set option enabled in IDE Gradle settings IDE creates separate module for each Grale source set. It does it when re-importing build.gradle file. If you have auto-import enabled in IDE Gradle configuration it does it automatically.






share|improve this answer
























  • So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

    – the_prole
    Nov 22 '18 at 17:34











  • You may open/check out the project with the IDE configuration (including modules) already existed and this configuration does not correspond to what configuration IDE applies when importing it from build.gradle file.

    – Andrey
    Nov 23 '18 at 17:29













  • Thank you, I have included my build.gradle file in an edit to my post. I do not see any code corresponding to the modules which are being removed by IDE, so I assume that the modules have been deleted from the build.gradle file, and I am not sure how to add them back, if that makes sense.

    – the_prole
    Nov 26 '18 at 17:54





















0














Given the limited information, I'll give you an ad-hoc fix, just add -----test as a sub-project directory to your root projects settings.gradle using



include 'root-proj-dir:dir1:dir2:...:----test'



where the directory structure is



root-proj-dir
|
|
----dir1
| |
| |
| ----dir2
| |
| |
| ....----test
----settings.gradle
|
----build.gradle


For more info on dealing with multi-module (or multi-project in Gradle terminology ) builds refer this link






share|improve this answer


























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420977%2fintellij-gradle-deletes-its-own-modules-unexpectedly%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In case of a Gradle projects IDE configures the project structure including the modules that are included in project according your the build.gradle script. E.g. if you have Create separate module per source set option enabled in IDE Gradle settings IDE creates separate module for each Grale source set. It does it when re-importing build.gradle file. If you have auto-import enabled in IDE Gradle configuration it does it automatically.






    share|improve this answer
























    • So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

      – the_prole
      Nov 22 '18 at 17:34











    • You may open/check out the project with the IDE configuration (including modules) already existed and this configuration does not correspond to what configuration IDE applies when importing it from build.gradle file.

      – Andrey
      Nov 23 '18 at 17:29













    • Thank you, I have included my build.gradle file in an edit to my post. I do not see any code corresponding to the modules which are being removed by IDE, so I assume that the modules have been deleted from the build.gradle file, and I am not sure how to add them back, if that makes sense.

      – the_prole
      Nov 26 '18 at 17:54


















    0














    In case of a Gradle projects IDE configures the project structure including the modules that are included in project according your the build.gradle script. E.g. if you have Create separate module per source set option enabled in IDE Gradle settings IDE creates separate module for each Grale source set. It does it when re-importing build.gradle file. If you have auto-import enabled in IDE Gradle configuration it does it automatically.






    share|improve this answer
























    • So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

      – the_prole
      Nov 22 '18 at 17:34











    • You may open/check out the project with the IDE configuration (including modules) already existed and this configuration does not correspond to what configuration IDE applies when importing it from build.gradle file.

      – Andrey
      Nov 23 '18 at 17:29













    • Thank you, I have included my build.gradle file in an edit to my post. I do not see any code corresponding to the modules which are being removed by IDE, so I assume that the modules have been deleted from the build.gradle file, and I am not sure how to add them back, if that makes sense.

      – the_prole
      Nov 26 '18 at 17:54
















    0












    0








    0







    In case of a Gradle projects IDE configures the project structure including the modules that are included in project according your the build.gradle script. E.g. if you have Create separate module per source set option enabled in IDE Gradle settings IDE creates separate module for each Grale source set. It does it when re-importing build.gradle file. If you have auto-import enabled in IDE Gradle configuration it does it automatically.






    share|improve this answer













    In case of a Gradle projects IDE configures the project structure including the modules that are included in project according your the build.gradle script. E.g. if you have Create separate module per source set option enabled in IDE Gradle settings IDE creates separate module for each Grale source set. It does it when re-importing build.gradle file. If you have auto-import enabled in IDE Gradle configuration it does it automatically.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 22 '18 at 9:07









    AndreyAndrey

    3,6911675




    3,6911675













    • So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

      – the_prole
      Nov 22 '18 at 17:34











    • You may open/check out the project with the IDE configuration (including modules) already existed and this configuration does not correspond to what configuration IDE applies when importing it from build.gradle file.

      – Andrey
      Nov 23 '18 at 17:29













    • Thank you, I have included my build.gradle file in an edit to my post. I do not see any code corresponding to the modules which are being removed by IDE, so I assume that the modules have been deleted from the build.gradle file, and I am not sure how to add them back, if that makes sense.

      – the_prole
      Nov 26 '18 at 17:54





















    • So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

      – the_prole
      Nov 22 '18 at 17:34











    • You may open/check out the project with the IDE configuration (including modules) already existed and this configuration does not correspond to what configuration IDE applies when importing it from build.gradle file.

      – Andrey
      Nov 23 '18 at 17:29













    • Thank you, I have included my build.gradle file in an edit to my post. I do not see any code corresponding to the modules which are being removed by IDE, so I assume that the modules have been deleted from the build.gradle file, and I am not sure how to add them back, if that makes sense.

      – the_prole
      Nov 26 '18 at 17:54



















    So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

    – the_prole
    Nov 22 '18 at 17:34





    So you think in the build script I might have not defined the modules, and itellij removes modules automatically because auto import is enabled?

    – the_prole
    Nov 22 '18 at 17:34













    You may open/check out the project with the IDE configuration (including modules) already existed and this configuration does not correspond to what configuration IDE applies when importing it from build.gradle file.

    – Andrey
    Nov 23 '18 at 17:29







    You may open/check out the project with the IDE configuration (including modules) already existed and this configuration does not correspond to what configuration IDE applies when importing it from build.gradle file.

    – Andrey
    Nov 23 '18 at 17:29















    Thank you, I have included my build.gradle file in an edit to my post. I do not see any code corresponding to the modules which are being removed by IDE, so I assume that the modules have been deleted from the build.gradle file, and I am not sure how to add them back, if that makes sense.

    – the_prole
    Nov 26 '18 at 17:54







    Thank you, I have included my build.gradle file in an edit to my post. I do not see any code corresponding to the modules which are being removed by IDE, so I assume that the modules have been deleted from the build.gradle file, and I am not sure how to add them back, if that makes sense.

    – the_prole
    Nov 26 '18 at 17:54















    0














    Given the limited information, I'll give you an ad-hoc fix, just add -----test as a sub-project directory to your root projects settings.gradle using



    include 'root-proj-dir:dir1:dir2:...:----test'



    where the directory structure is



    root-proj-dir
    |
    |
    ----dir1
    | |
    | |
    | ----dir2
    | |
    | |
    | ....----test
    ----settings.gradle
    |
    ----build.gradle


    For more info on dealing with multi-module (or multi-project in Gradle terminology ) builds refer this link






    share|improve this answer






























      0














      Given the limited information, I'll give you an ad-hoc fix, just add -----test as a sub-project directory to your root projects settings.gradle using



      include 'root-proj-dir:dir1:dir2:...:----test'



      where the directory structure is



      root-proj-dir
      |
      |
      ----dir1
      | |
      | |
      | ----dir2
      | |
      | |
      | ....----test
      ----settings.gradle
      |
      ----build.gradle


      For more info on dealing with multi-module (or multi-project in Gradle terminology ) builds refer this link






      share|improve this answer




























        0












        0








        0







        Given the limited information, I'll give you an ad-hoc fix, just add -----test as a sub-project directory to your root projects settings.gradle using



        include 'root-proj-dir:dir1:dir2:...:----test'



        where the directory structure is



        root-proj-dir
        |
        |
        ----dir1
        | |
        | |
        | ----dir2
        | |
        | |
        | ....----test
        ----settings.gradle
        |
        ----build.gradle


        For more info on dealing with multi-module (or multi-project in Gradle terminology ) builds refer this link






        share|improve this answer















        Given the limited information, I'll give you an ad-hoc fix, just add -----test as a sub-project directory to your root projects settings.gradle using



        include 'root-proj-dir:dir1:dir2:...:----test'



        where the directory structure is



        root-proj-dir
        |
        |
        ----dir1
        | |
        | |
        | ----dir2
        | |
        | |
        | ....----test
        ----settings.gradle
        |
        ----build.gradle


        For more info on dealing with multi-module (or multi-project in Gradle terminology ) builds refer this link







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 27 '18 at 8:09

























        answered Nov 23 '18 at 3:17









        RyotsuRyotsu

        630514




        630514






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420977%2fintellij-gradle-deletes-its-own-modules-unexpectedly%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Guess what letter conforming each word

            Port of Spain

            Run scheduled task as local user group (not BUILTIN)