How can i create a module under a root projects which already has many modules under it?

Answered

Hi there,

I am new to IntelliJ Idea and Gradle so please bear with me. What I was trying to do was to create a new Gradle module under the root project, which has other modules under it, but Intellij Idea makes the new module as a root project by itself and when I try to change root projects to the main root that I had, I got error saying two different projects cannot have same root.

Did i miss something? Is there a work around for this problem or  is there any way I can create a new module under the root project without error?

This question might appear silly, sorry I am learning both Gradle and Intellij Idea. I really appreciate your help.

5 comments

Thanks for your reply and I followed the procedure as mentioned on your website.

Let me elaborate the problem. I have one big project A having B, C, D and E modules. I added my module in E and E which has module E1, E2, E3 and E4, my new created module. I have included my module in the Parent A setting as module inside E. So far everything looks alright. But when I  tried to include dependencies in my module some other module like D and E1, I am getting error saying this package do not exit. When I open the project setting window and see, I found out that the project has a structure of two project, the parent project and my new module, E4 as one other project. Not only that the same module I created, E4 is also resides in module E. So when I add other packages from the project window, I got error saying two modules cannot share same source root. And when I tried to include the dependency from my Gradle build folder and build the project, I got error, saying project path ':D' could not be found in the root project 'E4'. So how can I resolve the source root conflict or delete the separate project and continue working with the one have inside E. Please both of E4 and E4 as a separate project have the same name and source root. I am afraid if I delete the one which is separate project, the whole module will be gone. Did I make a mistake how I created the module from the beginning, I am very sour I have followed the procedures listed in your website. One thing I remember is I have created the module inside E.

Thanks for your help Petr.

0

Your description is very hard to follow. Please share a sample project so that we can reproduce the issue and help with the configuration: https://uploads.services.jetbrains.com/.

0

Hi Serge, 

I have attached a document as a sample project structure and let me know if you need more information.

Thanks.

0

The document is not very helpful. Please share a sample project so that we can debug it.

0

Please sign in to leave a comment.