티스토리 뷰

Spring Starter Project를 Maven으로 생성하면 아래와 같이 mvnw, mvnw.cmd 파일도 같이 생성이 되어 있다. 

 

mvnw, mvnw.cmd 

열어보면 mvnw 파일은 다음과 같은 내용들이 들어가 있다. 

#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#    https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
#   JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
#   M2_HOME - location of maven2's installed home dir
#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
#     e.g. to debug Maven itself, use
#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------

뭐 이런 script가 가득한 파일들이다.

mvnw 란?

이 파일의 용도는 별도의 Maven 설치 없이도 Maven을 이용할 수 있도록 해준다. 또한 Maven 버전에 대한 관리도 해주며 별도로 명시하지 않으면 최신 버전을 사용한다.

 

이처럼 mvnw란 maven wrapper의 약자이고 Maven을 편리하게 이용할 수 있도록 도와준다. 


mvnw 사용법

기존에는 mvn 명령어를 사용했다면 mvnw를 이용해서 build 및 실행을 하려면 mvnw 명령어를 사용해야 한다. 

Unix System 에서 maven install

./mvnw clean install

Batch Command 에서 maven install

./mvnw.cmd clean install

Springboot run

./mvnw spring-boot:run

 

이런식으로 별도의 maven에 대한 설치 및 설정 없이 아주 간단하게 이용할 수 있다. 

 

끝!

댓글
최근에 올라온 글
최근에 달린 댓글
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30