10. Agenda
• Introducing Maven
• The Android Plugin for Maven
• A real world project
• Maven: why and when?
• Question time
2
11. Agenda
• Introducing Maven
• The Android Plugin for Maven
• A real world project
• Maven: why and when?
• Question time
• Thanks to Manfred Moser (Simpligility) for providing some preso stuff
2
13. About Fabrizio
• Senior Architect, Mentor, Technical Writer
–Working with Java (all the editions, plus exotic stuff) since 1996
–Frequent speaker at J1, Devoxx, Jazoon, JUGs
–Blogger at Java.Net, Most Valuable Blogger at DZone
• Member of the NetBeans Dream Team
3
14. About Fabrizio
• Senior Architect, Mentor, Technical Writer
–Working with Java (all the editions, plus exotic stuff) since 1996
–Frequent speaker at J1, Devoxx, Jazoon, JUGs
–Blogger at Java.Net, Most Valuable Blogger at DZone
• Member of the NetBeans Dream Team
• Co-leader of JUG Milano
3
15. About Fabrizio
• Senior Architect, Mentor, Technical Writer
–Working with Java (all the editions, plus exotic stuff) since 1996
–Frequent speaker at J1, Devoxx, Jazoon, JUGs
–Blogger at Java.Net, Most Valuable Blogger at DZone
• Member of the NetBeans Dream Team
• Co-leader of JUG Milano
• In the past years shifting from “mere” design and
architecture...
3
16. About Fabrizio
• Senior Architect, Mentor, Technical Writer
–Working with Java (all the editions, plus exotic stuff) since 1996
–Frequent speaker at J1, Devoxx, Jazoon, JUGs
–Blogger at Java.Net, Most Valuable Blogger at DZone
• Member of the NetBeans Dream Team
• Co-leader of JUG Milano
• In the past years shifting from “mere” design and
architecture...
• ... to method & software factory optimization
3
20. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them”
5
21. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them”
5
22. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them”
5
23. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them”
5
24. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them”
• Ant: a scripting interpreter, build-oriented DSL
5
25. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
5
26. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
• Maven: a standard build workflow executor
5
27. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
• Maven: a standard build workflow executor
declarative
5
28. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
• Maven: a standard build workflow executor
declarative
• POM: Project Object Model
5
29. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
• Maven: a standard build workflow executor
declarative
• POM: Project Object Model
–Project structure, language, packaging
5
30. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
• Maven: a standard build workflow executor
declarative
• POM: Project Object Model
–Project structure, language, packaging
–Dependencies
5
31. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
• Maven: a standard build workflow executor
declarative
• POM: Project Object Model
–Project structure, language, packaging
–Dependencies
–Other metadata (license, developers, mailing list, etc...)
5
32. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
• Maven: a standard build workflow executor
declarative
• POM: Project Object Model
–Project structure, language, packaging
–Dependencies
–Other metadata (license, developers, mailing list, etc...)
• Plugin oriented
5
33. Maven vs Ant
• Maven is truly like cats
–“Cats, either you love them or hate them” procedural
• Ant: a scripting interpreter, build-oriented DSL
• Maven: a standard build workflow executor
declarative
• POM: Project Object Model
–Project structure, language, packaging
–Dependencies
–Other metadata (license, developers, mailing list, etc...)
• Plugin oriented
• FLOSS (Apache License v2.0)
5
35. Phases, plugins, goals
• A lifecycle is a sequence of phases
validate
The
compile
test
“defa
package
ult” l
integration-test
verify
ifecy
install
c le
deploy
6
36. Phases, plugins, goals
• A lifecycle is a sequence of phases
• Every plugin can execute goals
compiler
validate plugin
surefire
The
compile
compile plugin
test
“defa
package
test
deploy
ult” l
integration-test
verify plugin
ifecy
install
deploy
c le
deploy
6
37. Phases, plugins, goals
• A lifecycle is a sequence of phases
• Every plugin can execute goals
mvn compiler:compile
• Goals can be executed manually...
compiler
validate plugin
surefire
The
compile
compile plugin
test
“defa
package
test
deploy
ult” l
integration-test
verify plugin
ifecy
install
deploy
c le
deploy
6
38. Phases, plugins, goals
• A lifecycle is a sequence of phases
• Every plugin can execute goals
mvn compiler:compile
• Goals can be executed manually...
• ... or attached to phases
compiler
validate plugin
surefire
The
compile
compile plugin
test
“defa
package
test
deploy
ult” l
integration-test
verify plugin
ifecy
install
deploy
c le
deploy
6
39. Phases, plugins, goals
• A lifecycle is a sequence of phases
• Every plugin can execute goals
mvn compiler:compile
• Goals can be executed manually...
• ... or attached to phases mvn install
compiler
validate plugin
surefire
The
compile
compile plugin
test
“defa
package
test
deploy
ult” l
integration-test
verify plugin
ifecy
install
deploy
c le
deploy
6
43. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
7
44. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
7
45. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact
7
46. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact
–has got unique coordinates
7
47. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact
–has got unique coordinates
• groupId, artifactId, version, packaging, classifier
7
48. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact
–has got unique coordinates
• groupId, artifactId, version, packaging, classifier
–can be retrieved from a local/remote repository
7
49. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact
–has got unique coordinates
• groupId, artifactId, version, packaging, classifier
–can be retrieved from a local/remote repository
–can be deployed to a local/remote repository
7
50. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact mvn install
mvn deploy
–has got unique coordinates
• groupId, artifactId, version, packaging, classifier
–can be retrieved from a local/remote repository
–can be deployed to a local/remote repository
7
51. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact mvn install
mvn deploy
–has got unique coordinates
• groupId, artifactId, version, packaging, classifier
–can be retrieved from a local/remote repository
–can be deployed to a local/remote repository
• Local repo is at $HOME/.m2/repository
7
52. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact mvn install
mvn deploy
–has got unique coordinates
• groupId, artifactId, version, packaging, classifier
–can be retrieved from a local/remote repository
–can be deployed to a local/remote repository
• Local repo is at $HOME/.m2/repository
• Remote repo is the internet, or your own, or both
7
53. Artifacts and repositories
• A project is usually composed by many modules
• Each module
–possibly depends on other modules’ artifacts
–produces its own artifact (maybe made of multiple files)
• Each artifact mvn install
mvn deploy
–has got unique coordinates
• groupId, artifactId, version, packaging, classifier
–can be retrieved from a local/remote repository
–can be deployed to a local/remote repository
• Local repo is at $HOME/.m2/repository
• Remote repo is the internet, or your own, or both
7
67. The maven-android-plugin
• maven-android-plugin
–Also android-maven-plugin (3.0)
–Made by Jayway (jayway.se), FLOSS
• Makes it possible to call Android SDK tools
• Goals:
–generate-sources, apk, apklib, dex, zipalign, unpack
10
68. The maven-android-plugin
• maven-android-plugin
–Also android-maven-plugin (3.0)
–Made by Jayway (jayway.se), FLOSS
• Makes it possible to call Android SDK tools
• Goals:
–generate-sources, apk, apklib, dex, zipalign, unpack
–deploy, deploy-dependencies, redeploy, undeploy
10
69. The maven-android-plugin
• maven-android-plugin
–Also android-maven-plugin (3.0)
–Made by Jayway (jayway.se), FLOSS
• Makes it possible to call Android SDK tools
• Goals:
–generate-sources, apk, apklib, dex, zipalign, unpack
–deploy, deploy-dependencies, redeploy, undeploy
–emulator-start, emulator-stop, run
10
70. The maven-android-plugin
• maven-android-plugin
–Also android-maven-plugin (3.0)
–Made by Jayway (jayway.se), FLOSS
• Makes it possible to call Android SDK tools
• Goals:
–generate-sources, apk, apklib, dex, zipalign, unpack
–deploy, deploy-dependencies, redeploy, undeploy
–emulator-start, emulator-stop, run
–push, pull
10
71. The maven-android-plugin
• maven-android-plugin
–Also android-maven-plugin (3.0)
–Made by Jayway (jayway.se), FLOSS
• Makes it possible to call Android SDK tools
• Goals:
–generate-sources, apk, apklib, dex, zipalign, unpack
–deploy, deploy-dependencies, redeploy, undeploy
–emulator-start, emulator-stop, run
–push, pull
• Supports native development (NDK)
10
72. The maven-android-plugin
• maven-android-plugin
–Also android-maven-plugin (3.0)
–Made by Jayway (jayway.se), FLOSS
• Makes it possible to call Android SDK tools
• Goals:
–generate-sources, apk, apklib, dex, zipalign, unpack
–deploy, deploy-dependencies, redeploy, undeploy
–emulator-start, emulator-stop, run
–push, pull
• Supports native development (NDK)
–Not covered in this talk
10
75. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
11
76. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
–Note that the POMs are naive (more later)
11
77. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
–Note that the POMs are naive (more later)
• Made of four POMs
11
78. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
–Note that the POMs are naive (more later)
• Made of four POMs
–The Master POM
11
79. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
–Note that the POMs are naive (more later)
• Made of four POMs
–The Master POM
–The Library (pure JSE code for Morse coding)
11
80. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
–Note that the POMs are naive (more later)
• Made of four POMs
–The Master POM
–The Library (pure JSE code for Morse coding)
–The application
11
81. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
–Note that the POMs are naive (more later)
• Made of four POMs
–The Master POM
–The Library (pure JSE code for Morse coding)
–The application
–Integration tests
11
82. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
–Note that the POMs are naive (more later)
• Made of four POMs
–The Master POM
–The Library (pure JSE code for Morse coding)
–The application
–Integration tests
• Includes support for signing and obfuscating
11
83. The MorseFlash demo app
• A very simple application, perfect starter
–Generates Morse signals out of a word
–Note that the POMs are naive (more later)
• Made of four POMs
–The Master POM
–The Library (pure JSE code for Morse coding)
–The application
–Integration tests
• Includes support for signing and obfuscating
• Two profiles, “standard” and “release”
11
84. Android Libraries
• Support for Android apklib
–zipped file with both code and resources (including
R.java)
–can be used for reusing code
• The Android Maven plugin supports it
–even though sources are not layout in the standard way
• Personally I don’t like it
• More about reusing libraries later
12
89. blueBill Mobile
• For bird(watch)ers
–Record geotagged observations on the field
–Browse fact sheets and multimedia resources
14
90. blueBill Mobile
• For bird(watch)ers
–Record geotagged observations on the field
–Browse fact sheets and multimedia resources
• Sophisticated data structure
14
91. blueBill Mobile
• For bird(watch)ers
–Record geotagged observations on the field
–Browse fact sheets and multimedia resources
• Sophisticated data structure
–RDF, semantic web
14
92. blueBill Mobile
• For bird(watch)ers
–Record geotagged observations on the field
–Browse fact sheets and multimedia resources
• Sophisticated data structure
–RDF, semantic web
• Reuses code from JSE and JEE projects
14
93. blueBill Mobile
• For bird(watch)ers
–Record geotagged observations on the field
–Browse fact sheets and multimedia resources
• Sophisticated data structure
–RDF, semantic web
• Reuses code from JSE and JEE projects
• Uses some libraries from the NetBeans Platform
14
94. blueBill Mobile
• For bird(watch)ers
–Record geotagged observations on the field
–Browse fact sheets and multimedia resources
• Sophisticated data structure
–RDF, semantic web
• Reuses code from JSE and JEE projects
• Uses some libraries from the NetBeans Platform
–for implementing DCI (Data, Context, Interaction)
14
95. blueBill Mobile
• For bird(watch)ers
–Record geotagged observations on the field
–Browse fact sheets and multimedia resources
• Sophisticated data structure
–RDF, semantic web
• Reuses code from JSE and JEE projects
• Uses some libraries from the NetBeans Platform
–for implementing DCI (Data, Context, Interaction)
• 3 projects (core, resources, Android app)
14
96. blueBill Mobile
• For bird(watch)ers
–Record geotagged observations on the field
–Browse fact sheets and multimedia resources
• Sophisticated data structure
–RDF, semantic web
• Reuses code from JSE and JEE projects
• Uses some libraries from the NetBeans Platform
–for implementing DCI (Data, Context, Interaction)
• 3 projects (core, resources, Android app)
• 48 modules
14
101. QA
• Test coverage (e.g. Cobertura)
• Static analysis (e.g. FindBugs)
• You just need to configure the proper plugin
16
102. QA
• Test coverage (e.g. Cobertura)
• Static analysis (e.g. FindBugs)
• You just need to configure the proper plugin
–Reuse a Super POM!
16
103. QA
• Test coverage (e.g. Cobertura)
• Static analysis (e.g. FindBugs)
• You just need to configure the proper plugin
–Reuse a Super POM!
• Same configuration for all kind of projects
16
104. QA
• Test coverage (e.g. Cobertura)
• Static analysis (e.g. FindBugs)
• You just need to configure the proper plugin
–Reuse a Super POM!
• Same configuration for all kind of projects
• See some examples
16
108. Continuous Integration with Hudson
• CI is a well known best practice
–“continuously applying QA”
• Should be automated
17
109. Continuous Integration with Hudson
• CI is a well known best practice
–“continuously applying QA”
• Should be automated
–CI server (Hudson/Jenkins the most popular)
17
110. Continuous Integration with Hudson
• CI is a well known best practice
–“continuously applying QA”
• Should be automated
–CI server (Hudson/Jenkins the most popular)
• See some examples
17
111. Continuous Integration with Hudson
• CI is a well known best practice
–“continuously applying QA”
• Should be automated
–CI server (Hudson/Jenkins the most popular)
• See some examples
17
114. Release
• Maven manages a standard release workflow
–Automatically handles versioning (SNAPSHOT, ...)
18
115. Release
• Maven manages a standard release workflow
–Automatically handles versioning (SNAPSHOT, ...)
–Performs some consistency checks
18
116. Release
• Maven manages a standard release workflow
–Automatically handles versioning (SNAPSHOT, ...)
–Performs some consistency checks
–Customizable
18
117. Release
• Maven manages a standard release workflow
–Automatically handles versioning (SNAPSHOT, ...)
–Performs some consistency checks
–Customizable
• Distribution artifacts can be deployed to a repo
18
118. Release
• Maven manages a standard release workflow
–Automatically handles versioning (SNAPSHOT, ...)
–Performs some consistency checks
–Customizable
• Distribution artifacts can be deployed to a repo
• Releasing can be performed by Hudson
18
119. Release
• Maven manages a standard release workflow
–Automatically handles versioning (SNAPSHOT, ...)
–Performs some consistency checks
–Customizable
• Distribution artifacts can be deployed to a repo
• Releasing can be performed by Hudson
–“Push a button” release
18
122. Advanced stuff, tricks and tweaks
• They say that Maven is not flexible
• It’s not true
19
123. Advanced stuff, tricks and tweaks
• They say that Maven is not flexible
• It’s not true
• It’s flexible if you work in its way
19
124. Advanced stuff, tricks and tweaks
• They say that Maven is not flexible
• It’s not true
• It’s flexible if you work in its way
• Some examples in the following slides
19
125. Advanced stuff, tricks and tweaks
• They say that Maven is not flexible
• It’s not true
• It’s flexible if you work in its way
• Some examples in the following slides
–Maybe overkill
19
126. Advanced stuff, tricks and tweaks
• They say that Maven is not flexible
• It’s not true
• It’s flexible if you work in its way
• Some examples in the following slides
–Maybe overkill
–Maybe tweaks
19
131. Preprocessing AndroidManifest.xml
• blueBill Mobile release cycle
–production
–alpha: can be installed side-by-side, uses separate workarea
–beta: can be installed side-by-side, uses same workakea
20
132. Preprocessing AndroidManifest.xml
• blueBill Mobile release cycle
–production
–alpha: can be installed side-by-side, uses separate workarea
–beta: can be installed side-by-side, uses same workakea
• Multiple profiles
20
133. Preprocessing AndroidManifest.xml
• blueBill Mobile release cycle
–production
–alpha: can be installed side-by-side, uses separate workarea
–beta: can be installed side-by-side, uses same workakea
• Multiple profiles
–Automatically set versionName from POM
20
134. Preprocessing AndroidManifest.xml
• blueBill Mobile release cycle
–production
–alpha: can be installed side-by-side, uses separate workarea
–beta: can be installed side-by-side, uses same workakea
• Multiple profiles
–Automatically set versionName from POM
–Automatically set versionCode
20
135. Preprocessing AndroidManifest.xml
• blueBill Mobile release cycle
–production
–alpha: can be installed side-by-side, uses separate workarea
–beta: can be installed side-by-side, uses same workakea
• Multiple profiles
–Automatically set versionName from POM
–Automatically set versionCode
–Use different appPackage, label and icon
20
136. Preprocessing AndroidManifest.xml
• blueBill Mobile release cycle
–production
–alpha: can be installed side-by-side, uses separate workarea
–beta: can be installed side-by-side, uses same workakea
• Multiple profiles
–Automatically set versionName from POM
–Automatically set versionCode
–Use different appPackage, label and icon
• Can be done with android:manifest-update goal
20
137. Preprocessing AndroidManifest.xml
• blueBill Mobile release cycle
–production
–alpha: can be installed side-by-side, uses separate workarea
–beta: can be installed side-by-side, uses same workakea
• Multiple profiles
–Automatically set versionName from POM
–Automatically set versionCode
–Use different appPackage, label and icon
• Can be done with android:manifest-update goal
• Can be done in other ways
20
138. Preprocessing AndroidManifest.xml
• blueBill Mobile release cycle
–production
–alpha: can be installed side-by-side, uses separate workarea
–beta: can be installed side-by-side, uses same workakea
• Multiple profiles
–Automatically set versionName from POM
–Automatically set versionCode
–Use different appPackage, label and icon
• Can be done with android:manifest-update goal
• Can be done in other ways
–e.g. the Groovy Maven plugin
20
141. Patching jars
• Sometimes you might need to patch some library
–Use some JSE runtime classes not available in Android
21
142. Patching jars
• Sometimes you might need to patch some library
–Use some JSE runtime classes not available in Android
–Some Swing stuff, XML stuff (for older Android versions)
21
143. Patching jars
• Sometimes you might need to patch some library
–Use some JSE runtime classes not available in Android
–Some Swing stuff, XML stuff (for older Android versions)
• maven-shade-plugin
21
144. Patching jars
• Sometimes you might need to patch some library
–Use some JSE runtime classes not available in Android
–Some Swing stuff, XML stuff (for older Android versions)
• maven-shade-plugin
–filters: strip some classes out of a jar
21
145. Patching jars
• Sometimes you might need to patch some library
–Use some JSE runtime classes not available in Android
–Some Swing stuff, XML stuff (for older Android versions)
• maven-shade-plugin
–filters: strip some classes out of a jar
–relocations: change class references in the bytecode
21
146. Patching jars
• Sometimes you might need to patch some library
–Use some JSE runtime classes not available in Android
–Some Swing stuff, XML stuff (for older Android versions)
• maven-shade-plugin
–filters: strip some classes out of a jar
–relocations: change class references in the bytecode
• See the code example
21
149. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
22
150. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
–“progressive” values
22
151. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
–“progressive” values
–uh oh: javac inlines static final variables
22
152. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
–“progressive” values
–uh oh: javac inlines static final variables
–two R.java’s from two modules are likely to collide
22
153. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
–“progressive” values
–uh oh: javac inlines static final variables
–two R.java’s from two modules are likely to collide
–changed in Android 4.0
22
154. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
–“progressive” values
–uh oh: javac inlines static final variables
–two R.java’s from two modules are likely to collide
–changed in Android 4.0
• What to do?
22
155. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
–“progressive” values
–uh oh: javac inlines static final variables
–two R.java’s from two modules are likely to collide
–changed in Android 4.0
• What to do?
• maven-rindirect-plugin
22
156. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
–“progressive” values
–uh oh: javac inlines static final variables
–two R.java’s from two modules are likely to collide
–changed in Android 4.0
• What to do?
• maven-rindirect-plugin
–generates an “indirect” R.java which delegates
22
157. Reusing R.java (pre-4.0 trick)
• R.java is automatically generated by the SDK
–It contains constants referring to resources
–“progressive” values
–uh oh: javac inlines static final variables
–two R.java’s from two modules are likely to collide
–changed in Android 4.0
• What to do?
• maven-rindirect-plugin
–generates an “indirect” R.java which delegates
• Or a trick with the maven-replacer-plugin
22
158. Why and when?
Evaluating whether Maven
is the good choice for you
160. Maven is about knowledge reuse
• According to the Merriam-Webster:
24
161. Maven is about knowledge reuse
• According to the Merriam-Webster:
–“maven: one who is experienced or knowledgeable”
24
162. Maven is about knowledge reuse
• According to the Merriam-Webster:
–“maven: one who is experienced or knowledgeable”
• Reuse by inheritance and composition
24
163. Maven is about knowledge reuse
• According to the Merriam-Webster:
–“maven: one who is experienced or knowledgeable”
• Reuse by inheritance and composition
• It’s about putting your and others’ experience
into your build system and reuse it
24
164. Maven is about knowledge reuse
• According to the Merriam-Webster:
–“maven: one who is experienced or knowledgeable”
• Reuse by inheritance and composition
• It’s about putting your and others’ experience
into your build system and reuse it
–the Super POM
24
167. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
25
168. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
• Have a standard build workflow and CI
25
169. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
• Have a standard build workflow and CI
–Test coverage, static analysis, ... (more later)
25
170. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
• Have a standard build workflow and CI
–Test coverage, static analysis, ... (more later)
• Have a standard release workflow
25
171. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
• Have a standard build workflow and CI
–Test coverage, static analysis, ... (more later)
• Have a standard release workflow
• Easily include libraries, manage dependencies
25
172. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
• Have a standard build workflow and CI
–Test coverage, static analysis, ... (more later)
• Have a standard release workflow
• Easily include libraries, manage dependencies
–Reporting!
25
173. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
• Have a standard build workflow and CI
–Test coverage, static analysis, ... (more later)
• Have a standard release workflow
• Easily include libraries, manage dependencies
–Reporting!
• IDE neutral
25
174. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
• Have a standard build workflow and CI
–Test coverage, static analysis, ... (more later)
• Have a standard release workflow
• Easily include libraries, manage dependencies
–Reporting!
• IDE neutral
• CLI just works as the IDE
25
175. Benefits of Maven
• Have a standard project structure for everything
–For JSE, JEE, Android, NetBeans Platform, ...
• Have a standard build workflow and CI
–Test coverage, static analysis, ... (more later)
• Have a standard release workflow
• Easily include libraries, manage dependencies
–Reporting!
• IDE neutral
• CLI just works as the IDE
• Language neutral (e.g. Scala, Groovy, ...)
25
177. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
26
178. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
26
179. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
26
180. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
26
181. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
26
182. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
–but we’ve got different minds and you might not like it
26
183. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
–but we’ve got different minds and you might not like it
• For single developers / very simple projects
26
184. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
–but we’ve got different minds and you might not like it
• For single developers / very simple projects
–might be overkill
26
185. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
–but we’ve got different minds and you might not like it
• For single developers / very simple projects
–might be overkill
–but it’s a matter of reusing knowledge
26
186. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
–but we’ve got different minds and you might not like it
• For single developers / very simple projects
–might be overkill
–but it’s a matter of reusing knowledge
• For companies
26
187. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
–but we’ve got different minds and you might not like it
• For single developers / very simple projects
–might be overkill
–but it’s a matter of reusing knowledge
• For companies
–it’s a must (think of modularization, CI, quality)
26
188. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
–but we’ve got different minds and you might not like it
• For single developers / very simple projects
–might be overkill
–but it’s a matter of reusing knowledge
• For companies
–it’s a must (think of modularization, CI, quality)
–some infrastructure needed (e.g. Nexus)
26
189. Is Maven the right tool for you?
• Undoubtedly Maven is more complex
–in the “entropic” meaning (needed known things)
–simple things are reasonably simple
–but you’ll need time to master it
• Most of people whining about Maven don’t know it well
–but we’ve got different minds and you might not like it
• For single developers / very simple projects
–might be overkill
–but it’s a matter of reusing knowledge
• For companies
–it’s a must (think of modularization, CI, quality)
–some infrastructure needed (e.g. Nexus)
26
191. Question time
... and thanks for your attention!
fabrizio.giudici@tidalwave.it
http://weblogs.java.net/blog/fabriziogiudici
http://fabriziogiudici.it