際際滷

際際滷Share a Scribd company logo
Build Lifecycle
Maven & Gradle
Index
 Maven Build Lifecycle
 Gradle Build Lifecycle
Maven  Introduction to the Build Lifecycle
 Maven is based around the central concept of a build lifecycle
=> 轟 artifact (襦)襯 蟲豢螻 覦壱 襦語り 覈 
 Maven 覩碁Μ 伎 觜 襯 螳讌螻 .
 螳 觜 螻襯 phase手 .
 Lifecycle phaseる 蟲焔 朱 襯 螳讌.
 phase ろ襦 goal螻 覦碁.
 phase 轟  磯殊 goal ろ 蟲譟
 蠍磯蓋(default) Lifecycle / clean Lifecycle / site Lifecycle
1. default : 襦 觜 覦 覦壱襯 企
2. clean : 襦語 企Π(觜  )襯 企
3. site : 襦 危 (覓語)襯 企
https://i.stack.imgur.com/tp88Z.jpg
Maven  Build Lifecycle
 Plugin
 Maven 覈 蠍磯レ 蠏語語 蠍磯朱  -> Phase 蠏語瑚骸 郁屋
 Phase Plugin螻 郁屋, ろ   螳螳  = Goal
 1 : 1
 貊襯 貉危  compile goal
ろ れ 貉危 testCompile goal
襷 螻 help goal
 mvn groupid:artifactId:version:goal
ex) mvn org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
Maven  Build Lifecycle
 clean
pre-clean -> clean -> post-clean : 伎 觜 焔 覈  
 default
validate: 襦  蟆, 觜  覲 譟伎覓 
compile:  貊襯 貉危
test:  ろ碁ゼ ろ -> ろ  觜 ろ襦 螳譯
ex) target/test-classes 豺 junit  ろ ろ,
蟆郁骸 target/surefire-reports 襴 
package: 貉危朱 企 手骸 襴 朱れ れ(war, jar, etc.)
verify: れ螳 讌 蠍一 讌 蟆
install: れ 殊 襦貉 レ襦 覦壱
deploy: れ 殊 蟆 レ 覦壱
 site
pre-site -> site -> post-site ; 危 覓語 
site-deploy : 焔 覓語襯  覯 覦壱
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
Maven  Build Lifecycle
 mvn package襯 ろ 蟆曙, package phase  覈 phase螳 一朱 ろ
 use case
=> maven [options] [<goal(s)>] [<phase(s)>]
1. mvn package
2. mvn clean install
3. mvn clean deploy
ex) CI 蟲襯 伎 Maven Build襯  , 觜 蟆郁骸覓殊 蟇壱螻 觜 蟆郁骸覓殊 
4. mvn compiler:compile
ex) compiler 蠏語語 compile Goal ろる 覩
mvn [plugin-name]:[goal-name]
 觜 蟯 れ pom.xml e.g. Lifecycle覲 ろ 蠏語 れ 
 Maven Lifecycle 豌企 maven-core module 伎 components.xml .
 default Lifecycle bindings - Maven 2.x : components.xml, Maven 3.x : default-bindings.xml
Gradle  Build Lifecycle
 java plugin  蟆曙 e.g. apply plugin: java, 覦 觜  Lifecycle 豢螳
 Build Phase
1. The initialization phase
2. The configuration phase
3. The execution phase
 The initialization phase
 Gradle Single-project build  Multi-project build 覲企ゼ  蟆 譴
 磯殊 Gradle settings.gradle 殊 誤.
=> るジ 觚 襦 豌危襯 
 企 phase螳  , Gradle Project 語ろ伎るゼ 燕.
Gradle  Build Lifecycle
 The configuration Phase
<Single-project build>
 伎 phase 碁 螳 襦語 觜 ろ襴渚 ろ
 蠏碁Μ螻 command line arguments 狩 企 ろ襯 誤螻, ろ.
<Multi-project build>
 configuration -> 襦語 build.gradle 殊 ろ.
e.g. apply plugin 碁 蠏語 れ企
 覈 襦語 configuration 一 .
 Task;  Task襯   螻, 企 螳 譟伎煙 れ  .
 Gradle Taskれ 譟伎煙 襦 讌覃伎, れ  覯襷 ろ.
  Task襯 ろ蠍  Directed Acyclic Graph襦 .
Gradle  Build Lifecycle
Directed acyclic graph for the Java plugin tasks
Gradle  Build Lifecycle
 The execution Phase
 Gradle 伎 phase 襷り, れ task  讌 蟆一 覦 
 Task name argument 覦朱 企 task襯 ろ伎 讌 蟆一
cf) Java 蠏語語 build task襯  貉危, ろ 煙   .
buildNeeded / buildDependent
Gradle  Build Lifecycle
Initialization Configuration Execution
 Initialize resources
 Start daemon thread
 Figure out what to build
 Evaluate build.gradle
script
 Configure all the plugins
 Evaluate the task graph
 Runs all the previously
evaluated task
 Build the application
Build Lifecycle Reference
 Apache Maven
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
http://mangkyu.tistory.com/8
http://sjh836.tistory.com/131
http://blog.devkuma.com/448?category=782552
 Gradle
https://docs.gradle.org/current/userguide/build_lifecycle.html
https://proandroiddev.com/understanding-gradle-the-build-lifecycle-5118c1da613f
http://kwonnam.pe.kr/wiki/gradle/buildlifecycle
螳矧

More Related Content

Backend Master | 3.1.4 Build - Java build tool - Maven/Gradle Build Lifecycle

  • 2. Index Maven Build Lifecycle Gradle Build Lifecycle
  • 3. Maven Introduction to the Build Lifecycle Maven is based around the central concept of a build lifecycle => 轟 artifact (襦)襯 蟲豢螻 覦壱 襦語り 覈 Maven 覩碁Μ 伎 觜 襯 螳讌螻 . 螳 觜 螻襯 phase手 . Lifecycle phaseる 蟲焔 朱 襯 螳讌. phase ろ襦 goal螻 覦碁. phase 轟 磯殊 goal ろ 蟲譟 蠍磯蓋(default) Lifecycle / clean Lifecycle / site Lifecycle 1. default : 襦 觜 覦 覦壱襯 企 2. clean : 襦語 企Π(觜 )襯 企 3. site : 襦 危 (覓語)襯 企 https://i.stack.imgur.com/tp88Z.jpg
  • 4. Maven Build Lifecycle Plugin Maven 覈 蠍磯レ 蠏語語 蠍磯朱 -> Phase 蠏語瑚骸 郁屋 Phase Plugin螻 郁屋, ろ 螳螳 = Goal 1 : 1 貊襯 貉危 compile goal ろ れ 貉危 testCompile goal 襷 螻 help goal mvn groupid:artifactId:version:goal ex) mvn org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
  • 5. Maven Build Lifecycle clean pre-clean -> clean -> post-clean : 伎 觜 焔 覈 default validate: 襦 蟆, 觜 覲 譟伎覓 compile: 貊襯 貉危 test: ろ碁ゼ ろ -> ろ 觜 ろ襦 螳譯 ex) target/test-classes 豺 junit ろ ろ, 蟆郁骸 target/surefire-reports 襴 package: 貉危朱 企 手骸 襴 朱れ れ(war, jar, etc.) verify: れ螳 讌 蠍一 讌 蟆 install: れ 殊 襦貉 レ襦 覦壱 deploy: れ 殊 蟆 レ 覦壱 site pre-site -> site -> post-site ; 危 覓語 site-deploy : 焔 覓語襯 覯 覦壱 https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
  • 6. Maven Build Lifecycle mvn package襯 ろ 蟆曙, package phase 覈 phase螳 一朱 ろ use case => maven [options] [<goal(s)>] [<phase(s)>] 1. mvn package 2. mvn clean install 3. mvn clean deploy ex) CI 蟲襯 伎 Maven Build襯 , 觜 蟆郁骸覓殊 蟇壱螻 觜 蟆郁骸覓殊 4. mvn compiler:compile ex) compiler 蠏語語 compile Goal ろる 覩 mvn [plugin-name]:[goal-name] 觜 蟯 れ pom.xml e.g. Lifecycle覲 ろ 蠏語 れ Maven Lifecycle 豌企 maven-core module 伎 components.xml . default Lifecycle bindings - Maven 2.x : components.xml, Maven 3.x : default-bindings.xml
  • 7. Gradle Build Lifecycle java plugin 蟆曙 e.g. apply plugin: java, 覦 觜 Lifecycle 豢螳 Build Phase 1. The initialization phase 2. The configuration phase 3. The execution phase The initialization phase Gradle Single-project build Multi-project build 覲企ゼ 蟆 譴 磯殊 Gradle settings.gradle 殊 誤. => るジ 觚 襦 豌危襯 企 phase螳 , Gradle Project 語ろ伎るゼ 燕.
  • 8. Gradle Build Lifecycle The configuration Phase <Single-project build> 伎 phase 碁 螳 襦語 觜 ろ襴渚 ろ 蠏碁Μ螻 command line arguments 狩 企 ろ襯 誤螻, ろ. <Multi-project build> configuration -> 襦語 build.gradle 殊 ろ. e.g. apply plugin 碁 蠏語 れ企 覈 襦語 configuration 一 . Task; Task襯 螻, 企 螳 譟伎煙 れ . Gradle Taskれ 譟伎煙 襦 讌覃伎, れ 覯襷 ろ. Task襯 ろ蠍 Directed Acyclic Graph襦 .
  • 9. Gradle Build Lifecycle Directed acyclic graph for the Java plugin tasks
  • 10. Gradle Build Lifecycle The execution Phase Gradle 伎 phase 襷り, れ task 讌 蟆一 覦 Task name argument 覦朱 企 task襯 ろ伎 讌 蟆一 cf) Java 蠏語語 build task襯 貉危, ろ 煙 . buildNeeded / buildDependent
  • 11. Gradle Build Lifecycle Initialization Configuration Execution Initialize resources Start daemon thread Figure out what to build Evaluate build.gradle script Configure all the plugins Evaluate the task graph Runs all the previously evaluated task Build the application
  • 12. Build Lifecycle Reference Apache Maven https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html http://mangkyu.tistory.com/8 http://sjh836.tistory.com/131 http://blog.devkuma.com/448?category=782552 Gradle https://docs.gradle.org/current/userguide/build_lifecycle.html https://proandroiddev.com/understanding-gradle-the-build-lifecycle-5118c1da613f http://kwonnam.pe.kr/wiki/gradle/buildlifecycle

Editor's Notes

  • #4: 覃企 觜 覈譯手鍵(覈譯手鍵) 旧 螳 蠍磯朱 . 朱 -> 譟伎
  • #5: 襦貉 レ 豕 覯 る 覯 螳
  • #6: clean : 觜 焔 一覓殊 default : 襦 覦壱谿, れ 覲襦 るゴ蟆 site : 襦 覓語 谿
  • #8: 螳讌 るジ 殊危危企 讌. 狩 襦 . 覃 襦碁 settings.gradle
  • #9: gradle 襦 覈語 企 覿覿 語る 覲 壱 讌蠍 . needed : api, api 譟危 覈 襦語 build depend : 覈 襦語 build
  • #11: gradle 襦 覈語 企 覿覿 語る 覲 壱 讌蠍 . needed : api, api 譟危 覈 襦語 build depend : 覈 襦語 build
  • #13: 2. 焔 一 Redis蟆 豺覈 .