Ant/Maven, Jenkins
         허광남
     kenu@okjsp.pe.kr
토픽


• Ant/Maven 빌드 도구의 이해
• Jenkins-CI 도구
Maven 빌드 도구
Java Compile 단점

• 패키지별로 따로 지정
• make 또는 compile.bat
• 클래스패스 설정 어려움
ANT

• Another Neat Tool http://ant.apache.org
• build.xml
• project > targets > tasks
• properties ${base.dir}
Maven 빌드 도구
• Convention over Configuration
 • ANT의 자유로운 빌드 설정과 차별
• Jar 의존성 관리
 • 버전 명시, 프로젝트별 중복 jar 관리
• 플러그인 관리
 • 이클립스, 톰캣, Jetty 등의 연계 플러그인
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
Quick Start #2
                     pom.xml
                                            <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
    my-app                                  http://maven.apache.org/xsd/maven-4.0.0.xsd">
                                              <modelVersion>4.0.0</modelVersion>
|-- pom.xml
`-- src                                       <groupId>com.mycompany.app</groupId>
    |-- main                                  <artifactId>my-app</artifactId>
    |   `-- java                              <version>1.0-SNAPSHOT</version>
    |        `-- com                          <packaging>jar</packaging>
    |            `-- mycompany
                                              <name>Maven Quick Start Archetype</name>
    |                `-- app                  <url>http://maven.apache.org</url>
    |                    `-- App.java
    `-- test                                  <dependencies>
        `-- java                                 <dependency>
             `-- com                               <groupId>junit</groupId>
                 `-- mycompany                     <artifactId>junit</artifactId>
                     `-- app                       <version>4.8.2</version>
                         `-- AppTest.java          <scope>test</scope>
                                                 </dependency>
                                              </dependencies>
                                            </project>
Build Project

•mvn package
•package is a phase
•페이즈는 연속적인 작업들
mvn compile이면
1.   validate
2.   generate-sources
3.   process-sources
4.   generate-resources
5.   process-resources
6.   compile

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

• archetype:generate
• archetype: is the plugin
• archetype:generate is a goal
• plugin은 goal 모음집
• 예) eclipse:eclipse, tomcat:run
Maven phases
• validate           • install
• compile            • deploy
• test
• package            • clean
• integration-test   • site
• verify
target/


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

• Hello   World!
m2eclipse


• eclipse plugin
• little buggy
Deployment Assembly
Nexus




http://cwgkorea.net/zbxe/cwg_consensus/44551
 
without
                                         Intranet   Internet


Dev
 A

                                                    Central

Dev
 B
with
                                         Intranet      Internet


Dev
 A

                                               Nexus   Central

Dev
 B
settings.xml
• ~/.m2/settings.xml   settings
                        mirrors
                         mirror
                           idnexus/id
                           mirrorOf*/mirrorOf
                            urlhttp://192.168.0.8:7070/nexus/content/groups/public/url
                          /mirror
                        /mirrors
                        profiles
                          profile
                           idnexus/id
                           repositories
                            repository
                              idcentral/id
                              urlhttp://central/url
                              releasesenabledtrue/enabled/releases
                              snapshotsenabledtrue/enabled/snapshots
                            /repository
                           /repositories
                           pluginRepositories
                            pluginRepository
                              idcentral/id
                              urlhttp://central/url
                              releasesenabledtrue/enabled/releases
                              snapshotsenabledtrue/enabled/snapshots
                            /pluginRepository
                           /pluginRepositories
                          /profile
                        /profiles
                        activeProfiles
                          activeProfilenexus/activeProfile
                        /activeProfiles
                       /settings
프로젝트 모니터
 젠킨스 이야기
      허광남
  kenu@okjsp.pe.kr
Topic

• 프로젝트 안정적으로
• 지속적인 통합 도구
• 젠킨스
• 활용
http://www.extremeprogramming.org/map/code.html




Continuous Integration
http://xprogramming.com/book/whatisxp/
Martin Fowler
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
Jenkins User Conference                                                                                                                                                                                                                                                  San Francisco, Oct 2nd 2011




  And
 so

Ant, Maven and Jenkins