상세 컨텐츠

본문 제목

[Maven] 명령과 옵션

Devops 도전기/Maven

by 끝까지해봐야지 2024. 5. 17. 21:19

본문

Maven 명령 및 옵션

Maven 실행

Maven을 실행하는 구문은 다음과 같습니다.

mvn [options] [<goal(s)>] [<phase(s)>]🎉

사용 가능한 모든 옵션은 다음 명령을 통해 액세스할 수 있는 내장 도움말에 문서화되어 있습니다.

mvn -h🎉

Maven 프로젝트를 빌드하기 위한 일반적인 호출은 Maven Lifecycle의 Phase를 사용합니다.

예:

mvn verify🎉

모든 패키지된 출력물과 문서 사이트를 생성하고 이를 저장소 관리자에 배포하는 프로젝트의 새로운 빌드는 다음과 같이 수행할 수 있습니다.

mvn clean deploy site-deploy🎉

패키지를 생성하고 다른 프로젝트에서 재사용하기 위해 로컬 저장소에 설치하면 됩니다.

mvn install🎉

이는 Maven 프로젝트에 대한 가장 일반적인 빌드 호출입니다.

프로젝트 작업을 하지 않을 때나 다른 사용 사례에서는 Maven의 일부로 구현된 특정 작업을 호출할 수 있습니다. 이를 플러그인의 Goal이라고 합니다.

예:

mvn archetype:generate🎉

또는

mvn checkstyle:check🎉

Maven 옵션

Maven은 빌드 프로세스를 변경하기 위한 다양한 명령줄 옵션을 제공합니다.

$ mvn -h

usage: mvn [options] [<goal(s)>] [<phase(s)>]

Options:
 -am,--also-make                        If project list is specified, also
                                        build projects required by the
                                        list
 -amd,--also-make-dependents            If project list is specified, also
                                        build projects that depend on
                                        projects on the list
 -B,--batch-mode                        Run in non-interactive (batch)
                                        mode (disables output color)
 -b,--builder <arg>                     The id of the build strategy to
                                        use
 -C,--strict-checksums                  Fail the build if checksums don't
                                        match
 -c,--lax-checksums                     Warn if checksums don't match
    --color <arg>                       Defines the color mode of the
                                        output. Supported are 'auto',
                                        'always', 'never'.
 -cpu,--check-plugin-updates            Ineffective, only kept for
                                        backward compatibility
 -D,--define <arg>                      Define a user property

...🎉

아래 명령을 실행하면 다른 위치에 있는 프로젝트를 빌드합니다.

mvn -f dir/pom.xml package🎉

아래는 Maven 버전 정보를 표시합니다.

mvn -v🎉

아래 옵션은 skipTests 시스템 속성을 적용하여 빌드 라이프사이클에서 단위 테스트 단계를 건너뜁니다.

mvn -DskipTests package

'Devops 도전기 > Maven' 카테고리의 다른 글

[Maven] build lifecycle 이란?  (0) 2024.05.17
[Maven] 소개  (0) 2024.05.17

관련글 더보기