Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Introduction to Maven
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Sperasoft
August 28, 2013
Technology
190
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction to Maven
Maven
Sperasoft
August 28, 2013
More Decks by Sperasoft
See All by Sperasoft
Code and Memory Optimisation Tricks
sperasoft
0
130
The Theory of Relational Databases
sperasoft
0
130
Automated Layout testing using Galen framework
sperasoft
0
130
Sperasoft talks: Android Security Threats
sperasoft
0
290
JPoint 2015: Java technology conference overview
sperasoft
0
79
RxJava: Functional Reactive Programming on Android
sperasoft
0
290
Effective Мeetings
sperasoft
0
160
Unreal Engine 4 Introduction
sperasoft
0
260
JIRA Development
sperasoft
0
280
Other Decks in Technology
See All in Technology
GuardDuty 検知対応を DevOps Agent で効率化しようとしている話 / GuardDuty Investigations with DevOps Agent
masahirokawahara
1
340
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
400
「図書館」という名前のままでいいのか -Code4Lib JAPANカンファレンス2026 アンカンファレンス報告- / Code4Lib JAPAN Conference 2026: Unconference Report
ykiyota
0
120
Tab5をRubyで動くパソコンにする
kishima
2
270
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
1
230
Oracle Cloud Infrastructure IaaS 新機能アップデート 2026/6 - 2026/8
oracle4engineer
PRO
0
130
2026/09/10 Spring_Bootから_Jakarta_EE_MicroProfileへの移行
megascus
0
250
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
120
Claude Code本って、 読む必要あるの?
oikon48
1
220
AIオーケストレーションを活用した 開発ワークフローの設計と実践
bqnq
0
110
Snowflakeのコスト最適化を支えるアーキテクチャ設計
ktatsuya
0
1k
Microsoft 365 Copilot chat -tekoälypalvelun tietosuojaongelmat
hponka
0
560
Featured
See All Featured
HDC tutorial
michielstock
2
850
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
250
Building AI with AI
inesmontani
PRO
1
1.2k
Rails Girls Zürich Keynote
gr2m
96
14k
Building Adaptive Systems
keathley
44
3.2k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
500
A Tale of Four Properties
chriscoyier
163
24k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
My Coaching Mixtape
mlcsv
0
310
We Are The Robots
honzajavorek
0
350
Transcript
Introduction to Maven
• Maven goal and key ideas • Configuration by conventions
• Project layout • Build lifecycle • Dependency management TOC
Software Development
Software Discrepancy
Software Discrepancy Solution
• shell script • make (1977) • Apache Ant (2000)
• MSBuild (2005) • Apache Maven (2002) Examples: Build tools
make
Maven Vs. Ant Holy War
<?xml version="1.0" encoding="UTF-8"?> <project name="AntProject" basedir="." default="jar"> <property file="nbproject/nbjdk.properties"/> <property
name="user.properties.file" location="${netbeans.user}/build. properties"/> <property file="${user.properties.file}"/> <import file="nbproject/jdk.xml"/> <target name="-init" depends="-jdk-init"> <property file="user.build.properties"/> <property file="build.properties"/> </target> <target name="compile" depends="-init" description="Compile main sources."> <mkdir dir="${classes.dir}"/> <depend srcdir="${src.dir}" destdir="${classes.dir}" cache="build/depcache" <classpath path="${cp}"/> </depend> <javac srcdir="${src.dir}" destdir="${classes.dir}" source="1.5" debug="${d <classpath path="${cp}"/> <compilerarg value="-Xlint:unchecked"/> </javac> <copy todir="${classes.dir}"> <fileset dir="${src.dir}" excludes="${jar.excludes}"/> </copy> </target> <target name="jar" depends="compile" description="Build JAR file for main sour <jar jarfile="${jar}" compress="true"><!-- manifest="${manifest}" --> <fileset dir="${classes.dir}"/> </jar> </target> Example: Ant Script <target name="run" depends="compile" description="Run application."> <fail unless="main.class">Must set property 'main.class' (e.g. in build.pro <java classname="${main.class}" fork="true" failonerror="true"> <classpath path="${run.cp}"/> <jvmarg value="-ea"/> </java> </target> <target name="compile-tests" depends="compile"> <mkdir dir="${test.classes.dir}"/> <depend srcdir="${test.dir}" destdir="${test.classes.dir}" cache="build/test <classpath path="${test.cp}"/> </depend> <javac srcdir="${test.dir}" destdir="${test.classes.dir}" source="1.5" debug <classpath path="${test.cp}"/> <compilerarg value="-Xlint:unchecked"/> </javac> <copy todir="${test.classes.dir}"> <fileset dir="${test.dir}" excludes="${jar.excludes}"/> </copy> </target> <target name="run-tests" depends="compile-tests" description="Run JUnit tests." <mkdir dir="${test.results.dir}"/> <junit failureproperty="tests.failed" showoutput="true" fork="true"> <batchtest todir="${test.results.dir}"> <fileset dir="${test.dir}"> <include name="**/*Test.java"/> </fileset> </batchtest> <classpath path="${test.run.cp}"/> <formatter type="brief" usefile="false"/> <formatter type="xml"/> </junit>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:x <modelVersion>4.0.0</modelVersion> <groupId>com.sperasoft</groupId> <artifactId>helloworld</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> </project> Example:
Maven POM
Download: http://maven.apache.org Version: 2.2.1 Requires: JDK 5+ Nature: Java command
line program Invocation: mvn Apache Maven
1. Get apache-maven-2.2.1-bin.zip 2. Unpack it to a folder 3.
Set M2_HOME env var to the above folder Install Apache Maven
"A maven (also mavin) is a trusted expert in a
particular field, who seeks to pass knowledge on to others." (http://en.wikipedia.org/wiki/Maven) or Configuration by Convention or Do it right way Quote
1. Project layout 2. Build lifecycle Maven Conventions
Simple Project Layout
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:x <modelVersion>4.0.0</modelVersion> <groupId>com.sperasoft</groupId> <artifactId>helloworld</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> </project> pom.xml
Project Layout: Typical
Lifecycles • Default lifecycle (build) • Clean lifecycle • Site
lifecycle Build Lifecycle
Default Lifecycle
compiler compiler:compile compiler:testCompile Example: Compiler Plugin
Lifecycle Bindings: jar
Lifecycle Bindings: pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:x <modelVersion>4.0.0</modelVersion> <groupId>com.sperasoft</groupId> <artifactId>helloworld</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> </project> pom.xml:
packaging
Clean lifecycle bindings
• Dependency identification • Getting dependency Dependency Management Basis Maven
Coordinates Repositories
groupId: org.testng artifactId: testng version: 5.11 packaging: jar classifier: jdk15
Maven Coordinates
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:x <modelVersion>4.0.0</modelVersion> <groupId>com.sperasoft</groupId> <artifactId>helloworld</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> </project> pom.xml:
coordinates
Artifact Resolution
Local Repository
Local Repository Population
http://repo1.maven.org/maven2 Number of artifacts (GAV): 313,955 Number of unique artifacts
(GA): 38,372 Size of repository: 457,310 MB Maven Central
Artifact Resolution
1. Choose a library 2. Find Maven coordinates 3. Add
<dependency> to POM 4. Use it in your code Using External Libs
1. Good quality 2. Mature 3. Supported 4. Local expertise
5. Has a reliable source External Lib Selection
1. Maven Central search 2. Project documentation / site 3.
Google 4. Not found? Do not use this crap. Where to Find Maven Coordinates
http://search.maven.org/ Maven Central Search
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:x ... <dependencies> ... <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.5</version>
</dependency> ... </dependencies> ... </project> POM: Add Dependency
1. Dependency management explained 2. IDE (Eclipse) integration 3. Testing
with Maven 4. Building web applications 5. Serving static content 6. Using binary libs Maven Talks: Next