개요
이클립스(혹은 STS)에서 Spring Starter Project를 통해 새로운 스프링 부트 프로젝트 생성 시 Package Explorer 내 프로젝트 구조에서 패키지 구조가 뜨지 않았다. Project Factes를 통해 Java Build Path를 설정하여 해결한다.
이슈
이클립스(혹은 STS)에서 Spring Starter Project를 통해 새로운 스프링 부트 프로젝트 생성 시 사진1과 같이 Package Explorer 내 프로젝트 구조에서 패키지 구조가 뜨지 않는 이슈가 발생했다.
또 다른 특이사항으로는 위 사진2과 같이 Build Path가 비어있는 것을 확인했다.
경과 및 해결
이슈가 발생한 프로젝트의 Properties 설정을 살펴보면 이곳에서도 Java Build Path는 물론 Java 관련 설정은 모두 찾아볼 수 없었다.
사진3의 Project Facets 또한 비어있는데, Convert to faceted form 버튼을 클릭하면 설정할 수 있는 목록이 표시된다.
목록은 최초에 사진4와 같이 뜨며, Java가 선택된 상태에서 (버전 선택 가능) Apply를 클릭하면 프로젝트의 기본 구성 및 기능을 설정한 상태로 저장할 수 있다.
추가로 패키지의 시작 기점 및 기준이 src/main/java가 아니고 더 상위 경로의 폴더라면 사진5의 Java Buil Path의 source 탭에서 classpath를 재설정하면 된다. 프로젝트의 패키지 구조는 classpath를 기준으로 잡히기 때문이다.
예전에는 프로젝트를 처음 생성할 때 그에 맞게 Facets가 잡혔는데, 왜 안잡힌 채로 생성되는지는 확인하지 못했다.
추가
Project Facets이란
Facets define characteristics and requirements for Java EE projects and are used as part of the runtime configuration.
When you add a facet to a project, that project is configured to perform a certain task, fulfill certain requirements, or have certain characteristics. For example, the EAR facet sets up a project to function as an enterprise application by adding a deployment descriptor and setting up the project's classpath.
You can add facets only to Java EE projects and other types of projects that are based on J2EE projects, such as enterprise application projects, dynamic Web projects, and EJB projects. You cannot add facets to a Java™ project or plug-in project, for example. Typically, a facet-enabled project has at least one facet when it is created, allowing you to add more facets if necessary. For example, a new EJB project has the EJB Module facet. You can then add other facets to this project like the EJBDoclet (XDoclet) facet. To add a facet to a project, see Adding a facet to a Java EE project.
Some facets require other facets as prerequisites. Other facets cannot be in the same project together. For example, you cannot add the Dynamic Web Module facet to an EJB project because the EJB project already has the EJB Module facet. Some facets can be removed from a project and others cannot.
Facets also have version numbers. You can change the version numbers of facets as long as you stay within the requirements for the facets. To change the version number of a facet, see Changing the version of a facet.
간단히 말하자면 Project Facets는 Java 프로젝트의 특성 및 요구 사항을 정의하고 실행 환경을 구성한다. 예시와 같이 Spring 프로젝트에 맞게 Java, Dynamic Web 등의 Facets를 추가하면 그에 맞게 프로젝트 환경이 구성된다. Java Facets를 추가할 때, Java 패키지 구성이 프로젝트에 설정된 것 처럼 말이다.
eclipse docs: https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclipse.jst.j2ee.doc.user%2Ftopics%2Fcfacets.html
Help - Eclipse Platform
help.eclipse.org
Classpath란
말 그대로 Class의 경로를 말한다. Java 프로그램이 실행되기 위해서는 Java 컴파일러가 .java 파일을 .class 파일로 변환돼야한다. 이때 JVM에서 변환된 Java Class를 찾을 수 있도록 그 기준점이 되는 경로를 설정한다.
oracle java docs: https://docs.oracle.com/javase/tutorial/essential/environment/paths.html
PATH and CLASSPATH (The Java™ Tutorials > Essential Java Classes > The Platform Environment)
The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available. See Java Language Changes for a summary of updated
docs.oracle.com
'개발 > 이슈' 카테고리의 다른 글
[HTML] 크롬 확장 프로그램으로 인한 HTML 속성 충돌 (bis_skin_checked, bis_label, bis_size ) (1) | 2024.07.16 |
---|---|
[Spring Boot] JSON Serialization Error (No serializer found for class) - lombok 설치 - 게시판 웹 (0) | 2024.02.29 |
[Git] Sourcetree 원격 브랜치 푸시 (Remote branch push) 무한로딩 오류 (1) | 2024.01.26 |
[JavaScript] 유튜브 Iframe API - 화질 설정 이슈 (setPlaybackQuality 함수 미작동) (1) | 2024.01.21 |
JSP byte 제한 이슈 (0) | 2024.01.16 |