Intellij Community 버전의 경우 Spring Project를 바로 생성할 수 없고,
Maven으로 프로젝트를 만든 후 Spring dependency를 추가해 주어야 한다.
프로젝트 만들기
- File > New > Project 에서 Maven 선택
프로젝트명, Artifact 설정
Dependency 추가 (pom.xml 수정)
[ 추가 전 ]
[ 추가 후 ]
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>study.java8to11</groupId>
<artifactId>java8to11</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<spring.framework.version>5.2.4.RELEASE</spring.framework.version>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.framework.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
프로젝트 Reload
- 우측 상단 'Load Maven Changes' 버튼을 사용하거나
생성한 Project 우클릭 > Maven > Reload Project 버튼 클릭하여 변경된 내용 반영
완료
- Spring 관련 Library들이 추가된 것을 확인. 이후 필요한 설정 추가진행
[ Dependency 추가 전 프로젝트 ]
[ Dependancy 추가 후 프로젝트 ]
'IDE' 카테고리의 다른 글
[Intellij] Project 영역에서 열려있는 파일 찾기 (0) | 2022.12.28 |
---|---|
[Intellij] Default 경로 변경하기 (0) | 2022.12.27 |
[Intellij] VM, Editor Encoding 설정 (0) | 2022.12.26 |
댓글