ant, maven and jenkins

46
Ant/Maven, Jenkins 허광남 [email protected]

Upload: kenu-heo

Post on 16-May-2015

3.080 views

Category:

Technology


10 download

DESCRIPTION

short ov

TRANSCRIPT

Page 1: Ant, Maven and Jenkins

Ant/Maven, Jenkins허광남

[email protected]

Page 2: Ant, Maven and Jenkins

토픽

• Ant/Maven 빌드 도구의 이해

• Jenkins-CI 도구

Page 3: Ant, Maven and Jenkins

Maven 빌드 도구

Page 4: Ant, Maven and Jenkins

Java Compile 단점

• 패키지별로 따로 지정

• make 또는 compile.bat

• 클래스패스 설정 어려움

Page 5: Ant, Maven and Jenkins

ANT

• Another Neat Tool http://ant.apache.org

• build.xml

• project > targets > tasks

• properties ${base.dir}

Page 6: Ant, Maven and Jenkins

Maven 빌드 도구• Convention over Configuration

• ANT의 자유로운 빌드 설정과 차별

• Jar 의존성 관리

• 버전 명시, 프로젝트별 중복 jar 관리

• 플러그인 관리

• 이클립스, 톰캣, Jetty 등의 연계 플러그인

Page 7: Ant, Maven and Jenkins

Quick Start

•mvn --version

•mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Page 8: Ant, Maven and Jenkins

Quick Start #2 pom.xml

my-app|-- pom.xml`-- src |-- main | `-- java | `-- com | `-- mycompany | `-- app | `-- App.java `-- test `-- java `-- com `-- mycompany `-- app `-- AppTest.java

<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>

Page 9: Ant, Maven and Jenkins

Build Project

•mvn package

•package is a phase

•페이즈는 연속적인 작업들

Page 10: Ant, Maven and Jenkins

mvn compile이면1. validate2. generate-sources3. process-sources4. generate-resources5. process-resources6. compile

• compile 까지의 페이즈를 순서대로 수행

Page 11: Ant, Maven and Jenkins

Maven goal

•archetype:generate

• archetype: is the plugin

•archetype:generate is a goal

• plugin은 goal 모음집

•예) eclipse:eclipse, tomcat:run

Page 12: Ant, Maven and Jenkins

Maven phases

• validate

• compile

• test

• package

• integration-test

• verify

• install

• deploy

• clean

• site

Page 13: Ant, Maven and Jenkins

target/

•java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App

• Hello World!

Page 14: Ant, Maven and Jenkins

m2eclipse

• eclipse plugin

• little buggy

Page 15: Ant, Maven and Jenkins

Deployment Assembly

Page 16: Ant, Maven and Jenkins

Nexus

http://cwgkorea.net/zbxe/cwg_consensus/44551����������� ������������������  

Page 17: Ant, Maven and Jenkins

without

Intranet Internet

Dev����������� ������������������  A

Dev����������� ������������������  B

Central

Page 18: Ant, Maven and Jenkins

with

Intranet Internet

Dev����������� ������������������  A

Dev����������� ������������������  B

Nexus Central

Page 19: Ant, Maven and Jenkins

settings.xml

• ~/.m2/settings.xml <settings> <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf>

<url>http://192.168.0.8:7070/nexus/content/groups/public</url> </mirror> </mirrors> <profiles> <profile> <id>nexus</id> <repositories> <repository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles></settings>

Page 20: Ant, Maven and Jenkins

프로젝트 모니터젠킨스 이야기

허광남[email protected]

Page 21: Ant, Maven and Jenkins

Topic

• 프로젝트 안정적으로

• 지속적인 통합 도구

• 젠킨스• 활용

Page 22: Ant, Maven and Jenkins

Continuous Integration

http://www.extremeprogramming.org/map/code.html

Page 23: Ant, Maven and Jenkins

http://xprogramming.com/book/whatisxp/

Page 24: Ant, Maven and Jenkins

Martin Fowler

Page 25: Ant, Maven and Jenkins
Page 26: Ant, Maven and Jenkins
Page 27: Ant, Maven and Jenkins

Jenkins User Conference San Francisco, Oct 2nd 2011

2004����������� ������������������  Summer

• I����������� ������������������  broke����������� ������������������  one����������� ������������������  too����������� ������������������  many����������� ������������������  builds

•Wouldn’t����������� ������������������  it����������� ������������������  be����������� ������������������  nice����������� ������������������  if����������� ������������������  …⋯?

from:����������� ������������������  jenkinsuserconference2011.pptx

Page 28: Ant, Maven and Jenkins

Jenkins User Conference San Francisco, Oct 2nd 2011

And����������� ������������������  so����������� ������������������  it����������� ������������������  began

• build.sh

•monitor.sh

• Run����������� ������������������  from����������� ������������������  cron

#!/bin/bash����������� ������������������  -exexec����������� ������������������  2>&1cd����������� ������������������  /files/jaxb-ricvs����������� ������������������  updateant

#!/bin/bash����������� ������������������  -exbuild.sh����������� ������������������  >����������� ������������������  build.log����������� ������������������  ||����������� ������������������  mail����������� ������������������  …⋯

from:����������� ������������������  jenkinsuserconference2011.pptx

Page 29: Ant, Maven and Jenkins

Jenkins User Conference San Francisco, Oct 2nd 2011

Then����������� ������������������  I����������� ������������������  wrote����������� ������������������  my����������� ������������������  version

from:����������� ������������������  jenkinsuserconference2011.pptx

Page 30: Ant, Maven and Jenkins

Jenkins User Conference San Francisco, Oct 2nd 2011

Plugin����������� ������������������  Growth

0

125

250

375

500

11/15/0611/22/0611/29/0612/6/0612/13/0612/20/0612/27/061/3/071/10/071/17/071/24/071/31/072/7/072/14/072/21/072/28/073/7/073/14/073/21/073/28/074/4/074/11/074/18/074/25/075/2/075/9/075/16/075/23/075/30/076/6/076/13/076/20/076/27/077/4/077/11/077/18/077/25/078/1/078/8/078/15/078/22/078/29/079/5/079/12/079/19/079/26/0710/3/0710/10/0710/17/0710/24/0710/31/0711/7/0711/14/0711/21/0711/28/0712/5/0712/12/0712/19/0712/26/071/2/081/9/081/16/081/23/081/30/082/6/082/13/082/20/082/27/083/5/083/12/083/19/083/26/084/2/084/9/084/16/084/23/084/30/085/7/085/14/085/21/085/28/086/4/086/11/086/18/086/25/087/2/087/9/087/16/087/23/087/30/088/6/088/13/088/20/088/27/089/3/089/10/089/17/089/24/0810/1/0810/8/0810/15/0810/22/0810/29/0811/5/0811/12/0811/19/0811/26/0812/3/0812/10/0812/17/0812/24/0812/31/081/7/091/14/091/21/091/28/092/4/092/11/092/18/092/25/093/4/093/11/093/18/093/25/094/1/094/8/094/15/094/22/094/29/095/6/095/13/095/20/095/27/096/3/096/10/096/17/096/24/097/1/097/8/097/15/097/22/097/29/098/5/098/12/098/19/098/26/099/2/099/9/099/16/099/23/099/30/0910/7/0910/14/0910/21/0910/28/0911/4/0911/11/0911/18/0911/25/0912/2/0912/9/0912/16/0912/23/0912/30/091/6/101/13/101/20/101/27/102/3/102/10/102/17/102/24/103/3/103/10/103/17/103/24/103/31/104/7/104/14/104/21/104/28/105/5/105/12/105/19/105/26/106/2/106/9/106/16/106/23/106/30/107/7/107/14/107/21/107/28/108/4/108/11/108/18/108/25/109/1/109/8/109/15/109/22/109/29/1010/6/1010/13/1010/20/1010/27/1011/3/1011/10/1011/17/1011/24/1012/1/1012/8/1012/15/1012/22/1012/29/101/5/111/12/111/19/111/26/112/2/112/9/112/16/112/23/113/2/113/9/113/16/113/23/113/30/114/6/114/13/114/20/114/27/115/4/115/11/115/18/115/25/116/1/116/8/116/15/116/22/116/29/117/6/117/13/117/20/117/27/118/3/118/10/118/17/11

releasestotal����������� ������������������  pluginsnew����������� ������������������  plugins

6 27

94

223

313

470?����������� ������������������  

2006/11 2011/08

from:����������� ������������������  jenkinsuserconference2011.pptx

Page 31: Ant, Maven and Jenkins

Jenkins User Conference San Francisco, Oct 2nd 2011

2011����������� ������������������  Jan:����������� ������������������  Divorce

• Oracle:����������� ������������������  “you����������� ������������������  do����������� ������������������  it����������� ������������������  our����������� ������������������  way����������� ������������������  or����������� ������������������  highway”

• Community����������� ������������������  chose����������� ������������������  highway:����������� ������������������  214����������� ������������������  to����������� ������������������  14–That’s����������� ������������������  when����������� ������������������  we����������� ������������������  became����������� ������������������  Jenkins

from:����������� ������������������  jenkinsuserconference2011.pptx

Page 32: Ant, Maven and Jenkins

Hudson to Jenkins

Page 33: Ant, Maven and Jenkins

Jenkins User Conference San Francisco, Oct 2nd 2011

Different����������� ������������������  stat,����������� ������������������  same����������� ������������������  storyTwitter

from:����������� ������������������  jenkinsuserconference2011.pptx

Page 34: Ant, Maven and Jenkins

OKJSP with Jenkins

Page 35: Ant, Maven and Jenkins
Page 36: Ant, Maven and Jenkins

Source Code Management

Page 37: Ant, Maven and Jenkins
Page 38: Ant, Maven and Jenkins
Page 39: Ant, Maven and Jenkins
Page 40: Ant, Maven and Jenkins
Page 41: Ant, Maven and Jenkins
Page 42: Ant, Maven and Jenkins
Page 43: Ant, Maven and Jenkins

Review

Page 44: Ant, Maven and Jenkins

빌드가 깨지면http://www.youtube.com/watch?v=1EGk2rvZe8A

Page 45: Ant, Maven and Jenkins

Q&A

Page 46: Ant, Maven and Jenkins

감사합니다