Chillax in dev

[Spring] Eclipse 스프링 프로젝트 생성하기 본문

Java 공부/SpringFramwork

[Spring] Eclipse 스프링 프로젝트 생성하기

Seong Story 2020. 10. 5. 10:12
728x90

[Spring] 스프링 Maven 프로젝트 생성하기 

- 이제 이클립스에 스프링 프레임워크의 모든 설치가 완료 되었다면 스프링 프로젝트를 생성해보자. 

 

1. File  > new  >Maven Project > 심플프로젝트 그룹아이디 스프링 이름 sp_05_1 finish

2. Create a simple project(skip archetype selection) 을 체크하여 심플 프로젝트를 생성한다 > next

3. Group Id , Artifact Id  를 입력한후 종료

 

4. pom.xml 을 수정한다. 아래 사진은 기본 상태이고 아래 첨부한 부분을 넣어준다.

기본상태

 - 입력할 pom.xml이다. 복붙해 주자! 그후 저장하면 프로젝트 오류가 난다.

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Spring</groupId>
  <artifactId>Sp_08</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <repositories>
        <repository>
            <id>oracle</id>
            <name>ORACLE JDBC Repository</name>
            <url>http://maven.jahia.org/maven2</url>
        </repository>
  </repositories>
    
  <dependencies>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>4.1.0.RELEASE</version>
		</dependency>
		
        <dependency>
            <groupId>com.mchange</groupId>
            <artifactId>c3p0</artifactId>
            <version>0.9.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>4.1.0.RELEASE</version>
        </dependency>		
   </dependencies>
   <build>
	<plugins>
		<plugin>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.1</version>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
				<encoding>utf-8</encoding>
			</configuration>
		</plugin>
	</plugins>
   </build>
</project>

 

5. pom.xml 수정시 프로젝트를 업데이트 해줘야한다.  프로젝트 > 마우스 우 > Maven > update Project

6. 해당 프로젝트 선택 ok 하면 프로젝트 세팅이완료 된다.

728x90
LIST
Comments