Remove group of modules from project view (gradle)

已回答

Hello. After adding several modules, in my project view has been added modules group with the same modules (see screenshot, top modules group). And when i created some file, both view opens with this file, it's a bit uncomfortable. I'm not found anything suitable in the Gradle settings section. How I can remove it from the project view? Thanks in advance for the help.

Version of IDEA: Community edition 2020.1

3
正式评论

IDE groups modules based on their qualified names. This is the default behaviour of the IDE and is expected.

For the Gradle-based project IDE takes the module name from the Gradle configuration. If the gradle module name is not explicitly specified in Gradle build files - Gradle names module as the directory it is located in.

Try disabling the 

project.qualified.module.names

option in IDE Registry. To open Registry dialog use Help | Find Action and type "Registry":

Nanitmix Cannot recreate the same behaviour on my machine. Are other modules based on Gradle?

Try to right-click on a group in the Project View and perform (Move Module to Group | Outside any group) action or manually remove the module group from (File | Project Structure... | Modules) settings.

0

Yes, all modules based on Gradle. I found out that this is happening due Gradle protobuf and idea plugins. Idk why but this plugins makes idea create this modules group. I put my build script here, maybe I really do something wrong. Also, sometimes annotationProcessor method does similar.

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
}
}

plugins {
id 'java'
id 'idea'
id 'com.google.protobuf' version '0.8.8'
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.11.0"
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.26.0'
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}

generatedFilesBaseDir = "${projectDir}/src"
}

idea {
module {
sourceDirs += file("${project.generatedFilesBaseDir}/main/java");
sourceDirs += file("${project.generatedFilesBaseDir}/main/grpc");
}
}

group 'ru.nanitmix'
version '1.0'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compileOnly project(":nanitmix-api")
}
0

I have noticed this recently as well.  All modules in my case are also gradle modules.  Sometimes when my modules change and I reload my gradle files, they get added to a new section of the project rather than under the expected project section.  I can go into my project properties and remove all modules, apply, and reload modules to usually fix this.  When that does not seem to work, I remove the module that is showing incorrectly, apply, then close the project, reopen it, remove all modules and re-import -- has not failed me yet.

Today I also had a module show up in a project that should not have.  I had a few projects open, and some of them shared source.  It was a test project, so I deleted it and re-cloned the repo and all was fine.  (I have thus far been unable to reproduce that)

I have been having problems with gradle files parsing properly with kotlin 1.4, and have reverted to the previous kotlin plugin, which may be contributing to this, Also I am running 2020.2.1.  Hope this information helps, I'm here in the forums for something else.  =)

0

@Nanitmix, @Jstone could you please provide a demo project to reproduce a problem?

0

@Petr Rastegaev

Demo: https://github.com/Nan1t/ModulesGroupDemo

In module-first and module-second are build scripts which make idea create modules group. After project building, the modules group appears.

Also, i've saved all files, without gitignore, maybe they will tell you something.

0

@Nanitmix still not reproducible, could you please clarify IDEA version and Gradle version you use?

0

@Petr Rastegaev

It's strange. I've tested it on several IDEA versions. Anyway:

IntelliJ IDEA 2020.1 (Community Edition)
Build #IC-201.6668.121, built on April 8, 2020
Runtime version: 11.0.6+8-b765.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.3.0-46-generic
GC: ParNew, ConcurrentMarkSweep
Non-Bundled Plugins: com.github.redfoos.logstash-intellij-plugin, Lombook Plugin, color.scheme.Eclipse Dark Theme, idea.plugin.protoeditor, org.jetbrains.plugins.hocon, io.protostuff.protostuff-jetbrains-plugin

The Gradle is bundled in IDEA: 201.6668.121

0

Please turn on Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Generate *.iml files for modules imported from Gradle

commit .iml files and share the project.

0

Done. Also, i've found what gradle version my IDEA use. This is 6.1.

0

Dear support,

please provide an answer to the request. I have the same issue with IntelliJ 2021.2.3 Ultimate edition while using Gradle 7.3 from a separate installation.

This suspicion might help to clarify: I have my root project in a subfolder at the same level with subfolders for each of its modules. Thus the folder structure does not correspond to the logical structure of the overall project.

However, I want the very same logical structure to be represented in IntelliJ's project structure - as declared in the Gradle files - but not involving any module groupis I did not request at all.

Each module is included in settings.gradle like this

rootProject.name = 'MyService'
include ':svc-server'
project(':svc-server').projectDir = file('../svc-server')

The folder structure looks like this

MyService\
   svc\ (contains the root project with settings.gradle)
   svc-server\ (one of the projects modules)

0
Avatar
Permanently deleted user

I was also seeing this behavior and the suggested registry change to

project.qualified.module.names

followed by a restart has resolved this for me.

2

Nanitmix Hello big bro, Have u resolved this problem? I gotta the same trouble.

0

Mclubing1989 For me this happens if i add build dir to excluded in settings. At the time i have no such problem.

0

Mclubing1989 Could you please try the following:

  1. Close all instances of IDEA
  2. Rename or remove the System Directory
  3. Re-import the Project: Open -> Navigate to the Project's directory -> Double-click the root pom.xml / build.gradle(.kts) -> Open as Project

If the issue persists, could you please share the affected Project?

0

请先登录再写评论。