Maven : https://maven.apache.org/
Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. If you think that Maven could help your project, you can find out more information about in the "About Maven" section of the navigation.
메이븐은 영어로 전문가라는 뜻이자, 이디시어(출처 : 이디시아어 위키피디아)로 지식의 누적(accumulator of knowledge) 라는 뜻을 가지고 있다. 원래는 빌드 프로세스를 간단하게 하려는 시도인 Jakarta Turbine project에서 시작되었다. 일명 자카르타 프로젝트는 자바 플랫폼을 위한 오픈소스 소프트웨어를 만들고 정비하기 위해 만들어졌다. 프로젝트안에는 하위 프로젝트로 많은 tool, library, framework들의 성과물이 나왔으며 그 중 최상위로 승격된 프로젝트는 아래와 같다.(출처 : 자카르타 프로젝트 위키피디아)
위 여러 자카르타 하위 프로젝트 중 메이븐에 대해 알아보고자 한다.
메이븐의 목적
Plugin |
Type |
Description |
Core plugins |
|
|
clean |
B |
build 후 clean작업 |
compiler |
B |
Compiles Java sources |
deploy |
B |
remote repository로 빌드된 artifact를 deploy |
install |
B |
local repository에 빌드된 artifact를 install |
resources |
B |
JAR을 include하기 위해 output directory에 resource들을 카피 |
site |
B |
현재 프로젝트를 위한 사이트(무슨사이트??)를 생성 |
Packaging types/tools | ||
| ear | B | 현재 프로젝트에 대해 EAR 생성 |
jar | B | 현재 프로젝트에 대해 jar생성 |
rar |
B |
현재 프로젝트에 대해 rar생성 |
war | B | 현재 프로젝트에 대해 war생성 |
source | B | 현재 프로젝트에 대해 source-JAR생성 |
Reporting plugins |
| |
changelog | R | SCM(??)으로부터 최근 변경사항 리스트 생성 |
| changes | B+R | 이슈트래커 or change document로 부터 리포트 생성 |
javadoc | B+R | 프로젝트를 위한 Javadoc 생성 |
Tools | ||
ant | B | 프로젝트를 위해 Ant 빌드 파일을 생성 |
| antrun | B | build순서에 따라 ant 빌드set을 실행 |
archetype | B | archetype에 따라 skeleton project structure 생성 |
| B | 프로젝트문서를 위한 PDF생성 | |
| release | B | 현재 프로젝트를 release함 |
scm | B | 현재 ㅍ로젝트에 SCM 명령어를 실행 |
B : Build plugin / R : Reporting plugin
1 | mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | my-app |-- pom.xml `-- src |-- main | `-- java | `-- com | `-- mycompany | `-- app | `-- App.java `-- test `-- java `-- com `-- mycompany `-- app `-- AppTest.java | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <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>com.mycompany.app</groupId> <artifactId>my-app</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>Maven Quick Start Archetype</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> </dependencies> </project> | cs |
프로젝트 빌드 하려면 아래와 같이 명령어를 친다.(pom.xml이 있는 디렉토리에 반드시 들어가야한다!)
1 | mvn package | cs |
1 2 3 4 5 6 7 8 | ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Thu Jul 07 21:34:52 CEST 2011 [INFO] Final Memory: 3M/6M [INFO] ------------------------------------------------------------------------ | cs |
1 | java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App | cs |
1 | Hello World! | cs |
End of Document
| [Gradle]기본 클래스 org.gradle.wrapper.GradleWrapperMain을(를) 찾거나 로드할 수 없습니다. 해결법 (0) | 2018.06.19 |
|---|---|
| [Gradle 고급]git release 브랜치 기준으로 jar 자동 versioning하기 (0) | 2018.06.19 |
| 개발자 생산성을 200% 늘리는 git client 추천 - GitKraken (1) | 2018.05.22 |
| How to use Intellij Sequence Diagram plugin (0) | 2017.07.07 |
| Simple Spring 4 MVC Hello world Example with gradle (0) | 2017.06.18 |
| Gradle build tool 4.0 가이드 (0) | 2017.06.17 |