[B -2-1] 스프링 프로젝트 생성

2019. 9. 27. 18:42Project B (SPMS)/Project B 파트1

반응형

스프링 프로젝트 생성




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 https://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.spms</groupId>
	<artifactId>controller</artifactId>
	<name>SPMS_B</name>
	<packaging>war</packaging>
	<version>1.0.0-BUILD-SNAPSHOT</version>
	<properties>
		<!-- <java-version>1.6</java-version> : 1.8 갱신 -->
		<java-version>1.8</java-version>
		<!-- <org.springframework-version>3.1.1.RELEASE</org.springframework-version> : 5.0.7 갱신-->
		<org.springframework-version>5.0.7.RELEASE</org.springframework-version>
		<org.aspectj-version>1.6.10</org.aspectj-version>
		<org.slf4j-version>1.6.6</org.slf4j-version>
	</properties>
	<dependencies>
		<!-- Spring -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${org.springframework-version}</version>
			<exclusions>
				<!-- Exclude Commons Logging in favor of SLF4j -->
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				 </exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		
		<!-- Spring-test 추가 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${org.springframework-version}</version>
		</dependency>
		
		<!-- Spring-jdbc 추가 -->								
		<dependency>								
			<groupId>org.springframework</groupId>							
			<artifactId>spring-jdbc</artifactId>							
			<version>${org.springframework-version}</version>							
		</dependency>								

		<!-- Spring-tx 추가 -->								
		<dependency>								
			<groupId>org.springframework</groupId>							
			<artifactId>spring-tx</artifactId>			
			<version>${org.springframework-version}</version>							
		</dependency>								

		<!-- Hikari CP 추가 -->								
		<dependency>								
			<groupId>com.zaxxer</groupId>							
			<artifactId>HikariCP</artifactId>							
			<version>2.7.8</version>							
		</dependency>								

		<!-- MyBatis 추가 -->								
		<dependency>								
			<groupId>org.mybatis</groupId>							
			<artifactId>mybatis</artifactId>							
			<version>3.4.6</version>							
		</dependency>								

		<!-- MyBatis-spring 추가 -->								
		<dependency>								
			<groupId>org.mybatis</groupId>							
			<artifactId>mybatis-spring</artifactId>							
			<version>1.3.2</version>							
		</dependency>								

		<!-- Log4jdbc 추가 -->								
		<dependency>								
			<groupId>org.bgee.log4jdbc-log4j2</groupId>							
			<artifactId>log4jdbc-log4j2-jdbc4</artifactId>							
			<version>1.16</version>							
		</dependency>
				
		<!-- AspectJ -->
		<dependency>
			<groupId>org.aspectj</groupId>
			<artifactId>aspectjrt</artifactId>
			<version>${org.aspectj-version}</version>
		</dependency>	
		
		<!-- Logging -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${org.slf4j-version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>${org.slf4j-version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>${org.slf4j-version}</version>
			<scope>runtime</scope>
		</dependency>
		<!-- Log4j 라이브러리 갱신 -->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
			<!-- <exclusions>
				<exclusion>
					<groupId>javax.mail</groupId>
					<artifactId>mail</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.jms</groupId>
					<artifactId>jms</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jdmk</groupId>
					<artifactId>jmxtools</artifactId>
				</exclusion>
				<exclusion>
					<groupId>com.sun.jmx</groupId>
					<artifactId>jmxri</artifactId>
				</exclusion>
			</exclusions> -->
			<!-- Log4j 컴파일 에러 대책으로 인해 코멘트 처리 -->					
			<!-- <scope>runtime</scope> -->	
		</dependency>

		<!-- @Inject -->
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
		</dependency>
				
		<!-- Servlet (servlet-api 버전 갱신) -->								
		<dependency>								
			<groupId>javax.servlet</groupId>							
			<artifactId>javax.servlet-api</artifactId>							
			<version>3.1.0</version>							
			<scope>provided</scope>							
		</dependency>								
		<dependency>		
			<groupId>javax.servlet.jsp</groupId>							
			<artifactId>jsp-api</artifactId>							
			<version>2.1</version>							
			<scope>provided</scope>							
		</dependency>								
		<dependency>								
			<groupId>javax.servlet</groupId>							
			<artifactId>jstl</artifactId>							
			<version>1.2</version>							
		</dependency>
	
		<!-- Junit Test 버전 갱신 -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency> 
		
		<!-- Lombok 추가 -->								
		<dependency>								
			<groupId>org.projectlombok</groupId>							
			<artifactId>lombok</artifactId>							
			<version>1.18.0</version>							
			<scope>provided</scope>		
		</dependency>       
	</dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
            	<!-- maven-compiler-plugin java 버전 갱신 -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <!-- 메이븐 플러그인 추가 : 자바 기반 스프링 프로젝트용 -->
            <plugin>
            	<groupId>org.apache.maven.plugins</groupId>
            	<artifactId>maven-war-plugin</artifactId>
            	<version>3.2.0</version>
            	<configuration>
            		<failOnMissingWebXml>false</failOnMissingWebXml>
            	</configuration>
            </plugin>
            
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

톰캣서버 > Add and Remove > 해당 프로젝트 추가 후 

톰캣 서버 메뉴

 


서버 더블 클릭

웹 포트 HTTP/1.1 "80" 으로 저장

톰캣 서버 설정


서버 더블 클릭

웹 모듈 경로 "/" 로 수정 후 저장

톰캣 서버 웹 모듈 설정


서버 기동 후 테스트

http://localhost/

서버 기동

반응형