Project without recognized sources or with subdirectories containing (real) projects

Answered

I am struggling regularly with importing certain projects into IntelliJ, mostly I can get it working, but with the new version it seems to be more difficult now.

We have a single, bit repository containing the backend (gradle) project, some frontend projects, a directory for the local docker environment, and so on. What I would like to achieve (and it worked in the past):

* Import the project root as project
* Import project/backend as gradle project
* And still having access to the other files in the project

If I do this with IntelliJ 2021.1, I get in the "Project View"

* The gradle project (displayed as root project)
* All plain files directly under the root directory listed (with yellow background, as not belonging to the project)

Switching to "Project files" I can see all files and directories, but they are still not belonging to my project and if I edit any of those files, the view jumps automatically to "Open files". Which is not what I want.

What can I do to have the whole project? Is there a way to just import a "Plain Project", without any build configuration and have modules under it (gradle modules, frontend modules, etc).

I have another, similar case in another project, where I have the backend (written in Go, this time) and the React frontend in the same repository. And I would like to have the whole project imported in Goland (and/or WebStorm), so that I can view all files, but still have the subdirectory imported as "real" project.

I hope this is clear for readers, if not, I'll create an example of what I mean.

0
6 comments

Does it fit your case to create a dummy "parent" project with all of the parts connected as modules?

0
Avatar
Permanently deleted user

Konstantin Annikov, thank you! I guess it would. How do I create a "dummy" project in IntelliJ? A project without any compilable sources? And, more important, how do I keep this parent dummy project once I added the gradle project as submodule? (as I tried to explain above, importing the gradle submodule changes the parent project configuration)

0

See this video on how to do that: https://youtu.be/0izcwMCuR1o

I do not see any overwritten configurations. 

0
Avatar
Permanently deleted user

Thanks, Konstantin Annikov, I tried exactly this. But I still can't see the rest of the project files if "Project" is selected, and all other files are still not in my project and I get a warning when editing them and they are not included in the file search.

Just as a showcase: I created this project: https://gitlab.com/wellnerbou/intellij-test-project

I opened IntelliJ, created a new empty project, as you showed in the video. Then I get just an empty project without any sources. After that, I can import the gradle module as project. But then, the root level project is not there any more.

Under "Project", there is just the gradle project. If I got to "Project Files", the files of the root directory are listed, but they are not part of the project.

See screenshots under https://gitlab.com/wellnerbou/intellij-test-project/-/tree/main/imgs

0

Still working as expected: https://youtu.be/Yuv13ke83-A

May you share a similar video? 

0
Avatar
Permanently deleted user

Thank you! This works perfectly. The difference seem to be that "Import module" does handle it differently than "Link Gradle project". The latter one works fine, together with "Import project", without the "Empty project" way.

Beside that: I had another problem with an existing `.idea` directory, which contains only a JUnit Test template definition. This caused that in the root project no subdirectories were visible and no files were belonging to the project. I deleted it and `git restore`d the file afterwards again.

0

Please sign in to leave a comment.