IT박스

IntelliJ IDEA가 디렉토리를 표시하도록하려면 어떻게합니까?

itboxs 2020. 7. 19. 10:52
반응형

IntelliJ IDEA가 디렉토리를 표시하도록하려면 어떻게합니까?


JavaScript 편집을 위해 IntelliJ IDEA를 시험해 보았지만 지금까지는 좋아하지만 새 프로젝트에 약간의 문제가 있습니다.

IDEA가 프로젝트보기의 프로젝트 디렉토리에 디렉토리를 표시하도록 할 수없는 것 같습니다. 디렉토리를 수동으로 추가하더라도 표시를 거부합니다.

아마도 이것이 Java 규칙을 적용하려고한다는 사실과 관련이 있다고 생각하지만 오래된 Eclipse 프로젝트를 가져올 때 모든 디렉토리가 올바르게 표시되었습니다.

디렉토리를 볼 수 있도록 Eclipse를 사용하여 프로젝트를 작성하고 IDEA로 가져와야합니까? 아니면 다른 트릭이 있습니까?

IDEA 버전 8.1.3을 사용하고 있으며 코드는 Java 환경이 아닌 단순한 HTML 및 JavaScript 파일입니다.


실제로 "적절한"디렉토리보기를 보려면 프로젝트 내에 Java 모듈 (파일-> 새 모듈)을 수동으로 작성해야합니다. 프로젝트로 만들 때 왜 나타나지 않았는지 궁금합니다.


나는이 같은 문제로 어려움을 겪고 디렉토리가 올바르게 표시되지 않는 또 다른 이유를 발견했습니다. "컨텐츠 루트"가 올바른지 확인하십시오.

  • 프로젝트를 클릭하십시오
  • "파일"-> "프로젝트 구조"를 선택하십시오
  • 왼쪽 열에서 "모듈"을 선택하고 모듈을 선택하십시오.

소스 탭에는 현재 "컨텐츠 루트"와 함께 새로운 컨텐츠 루트를 추가하는 버튼이 있습니다.

컨텐츠 루트가 올바른지 확인하십시오. 프로젝트 구조보기에서 "컨텐츠 루트"아래에 파일 만 표시됩니다. 나는 IntelliJ에 익숙하지 않지만 내용 루트는 개미 용어의 기반으로 생각합니다.

이 지침은 IntelliJ 9.x 용입니다.

이것이 누군가를 돕기를 바랍니다.


현재보다 간단한 논리 :

  • .idea / 폴더를 제거하십시오
  • 아이디어 파일-> 새 프로젝트에서 선택하십시오.
  • 왼쪽 메뉴에서 웹 모듈을 선택한 다음 프로젝트 폴더를 설정하십시오.
  • 끝났어요!

Thurman Sanders 덕분에 해결책을 찾았고 다른 사람을 도울 수 있도록 더 명확한 답변을 게시하기로 결정했습니다. 나는 이런 대답이 5 분의 혼란을 덜어 줄 것이라고 알고있다.

문제

기본적으로 일부 폴더는 제외됩니다. 대부분의 경우 이것은 정확히 원하는 것입니다. 다른 경우에는 예를 들어 "build"또는 "target"폴더가 표시되어야합니다.

해결책

보려는 폴더를 제외하고 Intellij를 중지시킵니다.

  1. 모듈 설정을 엽니 다
    • 모듈을 선택하고 F4
    • 또는 모듈을 마우스 오른쪽 버튼으로 클릭하고 "모듈 설정 열기"를 선택하십시오
    • 또는을 눌러 cmd;프로젝트 설정을 연 다음 모듈을 선택하십시오.
  2. 아래 그림의 단계를 따르십시오.
    • '소스'탭을 선택하십시오
    • 보려는 폴더를 선택하십시오
    • '제외'옵션 비활성화
  3. OK를 누릅니다
    • 완료되면 폴더가 주황색으로 바뀌고 프로젝트보기에 표시됩니다!

여기에 이미지 설명을 입력하십시오


가장 간단한 방법!

Reading some of the other answers, they require you to go into Project Structure -> Modules and check that the sources are not excluded.

But in my case - there are no modules defined in the project at all, so that didn't help.

To easily create a module for your project and therefore show the folder structure -

  • Go to File menu -> New -> Project...
  • Select Static Web. Note: it does not matter if your project is "web" or not!
  • Hit next, then fill in the same Project Name: and Project location: as you have already.
  • IntelliJ will say "File Already Exists" - "Would you like to overwrite it?" - answer Yes.

Bam! Your Project Pane with the Project view selected should now instantly show the folder structure of your project.

If you have a maven project, you will need to add the root pom.xml in the Maven Projects window.

And if you want to add java to your project later, you should probably configure a JDK also.


Just use File » New Project » Static Web. All your files and directories will show up.

IntelliJ IDEA 새 프로젝트 대화 상자


File -> Invalidate Caches / Restart worked for me.


The same problem had me going crazy for a couple of hours as well, coming from Netbeans where I could just start a new project and import any source tree. My project is PHP/JS and has nothing to do with Java, so it was not intuitive to have to create a Java module, just so I could see my files listed.

I found the solution (covered above) here for more insight.


Here is how I was able to "display" all folders in my project:

  1. Somehow get to the Project Settings page (for me it was right-click the project then select Modules)

  2. Make sure the Sources tab is selected

  3. You should see a section in the middle entitled "Excluded Folders" under Source\Folders"

  4. Click on the X next to it to remove it from being excluded and it becomes visible.

Hope it this helps.


I think this is happening to you as intellij's Project window has the 'Compact Empty Middle Packages' option as checked by default. You will find this option under Setting section of the Projects tab.


I had a test folder which wasn't displaying in IntelliJ. It turned out that it had no files in it, IntelliJ was only showing folders that had some files in them. When i manually added files in test folder via Explorer, it reflected back in IDE.


It happens sometime. You need to go to the configuration (Project Settings) and add the Source folder as content root and then possibly set source/resource etc. from the configuration tab. Apply all the changes and you should be done.


나만의 2c. "New"-> "기존 소스의 모듈"을 사용하여 IntelliJ가 Github Java 프로젝트 내부에서 폴더와 파일을 표시하도록했습니다. 이것이 누군가를 돕기를 바랍니다.


모든 클래스가있는 프로젝트 탐색기 창에서 "패키지"보기에서 "프로젝트"보기로 전환하십시오. 그러면 클래스뿐만 아니라 모든 파일이 표시됩니다.

참고 URL : https://stackoverflow.com/questions/1147336/how-do-i-get-intellij-idea-to-display-directories

반응형