SlideShare a Scribd company logo
1 of 54
Download to read offline
What I wish I Knew About
@aalmiray | andresalmiray.com
Andres
Almiray
Seasoned Sourceror

@ Oracle

Java Champion

Hackergarten

github.com/aalmiray
@aalmiray | andresalmiray.com
Override Project
Properties
@aalmiray | andresalmiray.com
mvn -Dkey=value
• Properties may be defined 

• In a <properties> block

• By plugins

• Property values defined on the command line have
precedence
DEMO
@aalmiray | andresalmiray.com
mvn G:A:V:goal
@aalmiray | andresalmiray.com
Invoke plugins on the go
• Any plugin may be applied using the long notation
G:A:V:goal, in other words

mvn com.github.ekryd.echo-maven-plugin:echo-maven-
plugin:1.2.0:echo -Decho.message="Hello World!"
DEMO
@aalmiray | andresalmiray.com
Dependency
Resolution
@aalmiray | andresalmiray.com
Dependencies
• Dependencies defined in a <dependencies> block are
known as direct dependencies.

• Dependencies brought by direct dependencies are known
as transitive dependencies.

• Maven resolves dependencies by locality

- direct in the current POM. Last found wins (closest).

- direct in the parent hierarchy.

- transitive in the hierarchy based on number of hops to
reach it. First found wins.
DEMO
@aalmiray | andresalmiray.com
Semantic Versioning?
https://twitter.com/rfscholte/status/1243226856914063360
@aalmiray | andresalmiray.com
Use the <dependencyManagement> block!
@aalmiray | andresalmiray.com
http://maven.apache.org/enforcer/maven-enforcer-plugin/
@aalmiray | andresalmiray.com
maven-enforcer-plugin
https://twitter.com/aalmiray/status/1243515942560313350
http://andresalmiray.com/maven-dependencies-pop-quiz-results
http://andresalmiray.com/maven-dependencies-pop-quiz-results
@aalmiray | andresalmiray.com
Surviving Dependency Hell with Maven
https://saturnism.me/talk/surviving-dependency-hell-maven/
@aalmiray | andresalmiray.com
mvn verify
• The Reactor knows how to build all requirements.

• The install goal should only be used when artifacts must
be published to the local repository.

• Invoking clean diminishes the reuse of intermediate
results -> defeats incremental builds.
@aalmiray | andresalmiray.com
Broken Buildtools and Bad Behaviors;
The Maven Story by Robert Scholte
https://www.youtube.com/watch?v=2HyGxtsDf60
@aalmiray | andresalmiray.com
mvn -am -pl
@aalmiray | andresalmiray.com
Partial Execution
• Maven runs multi-project builds inside a Reactor.

• The Reactor executes goals for all projects.

• mvn -pl <paths> executes the given goals for all projects
in <paths>

• mvn -am -pl <paths> also executes for all prerequisites in
the Reactor
DEMO
@aalmiray | andresalmiray.com
Restrictions
• All invoked plugin goals must exist in every project!

• Define common plugins in parent POMs using a
combination of <pluginManagement> and <plugins>.

• You’d be forced to define dummy values for plugins in
some cases.
DEMO
@aalmiray | andresalmiray.com
Aggregating POMs
@aalmiray | andresalmiray.com
Aggregating POMs
• These POM files define a <modules> section.

• They are typically also parent POMs but they DO NOT
have to be!

• Also, values in <module> are paths, not project names.
@aalmiray | andresalmiray.com
File Structure & POM
DEMO
@aalmiray | andresalmiray.com
BOM Files
@aalmiray | andresalmiray.com
BOM Definition
@aalmiray | andresalmiray.com
BOM Consumption
DEMO
@aalmiray | andresalmiray.com
Resources
• https://blogs.oracle.com/developers/mastering-maven-
the-series

• https://cguntur.me/2020/05/20/understanding-apache-
maven-the-series

• https://kordamp.org/kordamp-gradle-plugins
@aalmiray | andresalmiray.com
The preceding is intended to outline our general product direction. It is intended for information
purposes only, and may not be incorporated into any contract. It is not a commitment to deliver
any material, code, or functionality, and should not be relied upon in making purchasing
decisions. The development, release, timing, and pricing of any features or functionality
described for Oracle’s products may change and remains at the sole discretion of Oracle
Corporation.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs,
intentions and prospects are “forward-looking statements” and are subject to material risks and
uncertainties. A detailed discussion of these factors and other risks that affect our business is
contained in Oracle’s Securities and Exchange Commission (SEC) filings, including our most
recent reports on Form 10-K and Form 10-Q under the heading “Risk Factors.” These filings
are available on the SEC’s website or on Oracle’s website at http://www.oracle.com/investor. All
information in this presentation is current as of September 2019 and Oracle undertakes no duty
to update any statement in light of new information or future events.
Safe Harbor Statement
@aalmiray | andresalmiray.com

More Related Content

What's hot

Optimizing WordPress - WordPress SF Meetup April 2012
Optimizing WordPress -  WordPress SF Meetup April 2012Optimizing WordPress -  WordPress SF Meetup April 2012
Optimizing WordPress - WordPress SF Meetup April 2012
Ben Metcalfe
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
Thinkful
 

What's hot (20)

How to Prepare a WordPress Theme for Public Release
How to Prepare a WordPress Theme for Public ReleaseHow to Prepare a WordPress Theme for Public Release
How to Prepare a WordPress Theme for Public Release
 
Optimizing WordPress - WordPress SF Meetup April 2012
Optimizing WordPress -  WordPress SF Meetup April 2012Optimizing WordPress -  WordPress SF Meetup April 2012
Optimizing WordPress - WordPress SF Meetup April 2012
 
APIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsAPIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page Objects
 
Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015Responsive Theme Workshop - WordCamp Columbus 2015
Responsive Theme Workshop - WordCamp Columbus 2015
 
Getting started with rails active storage wae
Getting started with rails active storage waeGetting started with rails active storage wae
Getting started with rails active storage wae
 
Manage WordPress From the Command Line with WP-CLI
Manage WordPress From the Command Line with WP-CLIManage WordPress From the Command Line with WP-CLI
Manage WordPress From the Command Line with WP-CLI
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond blogging
 
2016 WordCamp Pittsburgh - Let's Write a Plugin
2016 WordCamp Pittsburgh - Let's Write a Plugin2016 WordCamp Pittsburgh - Let's Write a Plugin
2016 WordCamp Pittsburgh - Let's Write a Plugin
 
Newspapers with WordPress
Newspapers with WordPressNewspapers with WordPress
Newspapers with WordPress
 
WHAT IS HTML5?(20100510)
WHAT IS HTML5?(20100510)WHAT IS HTML5?(20100510)
WHAT IS HTML5?(20100510)
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
 
Namespace less engine
Namespace less engineNamespace less engine
Namespace less engine
 
WordPress Plugins and Security
WordPress Plugins and SecurityWordPress Plugins and Security
WordPress Plugins and Security
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme Review
 
Using Wordpress for Internet Publishing
Using Wordpress for Internet PublishingUsing Wordpress for Internet Publishing
Using Wordpress for Internet Publishing
 
WordPress Theme Structure
WordPress Theme StructureWordPress Theme Structure
WordPress Theme Structure
 
Set up dev environment
Set up dev environmentSet up dev environment
Set up dev environment
 
Rebrand WordPress Admin
Rebrand WordPress AdminRebrand WordPress Admin
Rebrand WordPress Admin
 
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
WordPress Theme Development Basics
WordPress Theme Development BasicsWordPress Theme Development Basics
WordPress Theme Development Basics
 

Similar to What I wish I knew about Maven years ago

Juggling Java EE with Enterprise Apache Maven
Juggling Java EE with Enterprise Apache MavenJuggling Java EE with Enterprise Apache Maven
Juggling Java EE with Enterprise Apache Maven
elliando dias
 

Similar to What I wish I knew about Maven years ago (20)

What I wish I knew about maven years ago
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years ago
 
Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)
 
Making the most of your gradle build - Devoxx PL 2017
Making the most of your gradle build - Devoxx PL 2017Making the most of your gradle build - Devoxx PL 2017
Making the most of your gradle build - Devoxx PL 2017
 
Continuous Testing
Continuous TestingContinuous Testing
Continuous Testing
 
Taking Micronaut out for a spin
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spin
 
Pure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talkPure Speed Drupal 4 Gov talk
Pure Speed Drupal 4 Gov talk
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on Rails
 
Escaping Test Hell - ACCU 2014
Escaping Test Hell - ACCU 2014Escaping Test Hell - ACCU 2014
Escaping Test Hell - ACCU 2014
 
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and Layrry
 
Creating Better Builds with Gradle
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with Gradle
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID Principles
 
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)
 
Juggling Java EE with Enterprise Apache Maven
Juggling Java EE with Enterprise Apache MavenJuggling Java EE with Enterprise Apache Maven
Juggling Java EE with Enterprise Apache Maven
 
Cloudformation101
Cloudformation101Cloudformation101
Cloudformation101
 
WordPress Theming Best Practices
WordPress Theming Best PracticesWordPress Theming Best Practices
WordPress Theming Best Practices
 
Writing an extensible web testing framework ready for the cloud slide share
Writing an extensible web testing framework ready for the cloud   slide shareWriting an extensible web testing framework ready for the cloud   slide share
Writing an extensible web testing framework ready for the cloud slide share
 
Gradle Again
Gradle AgainGradle Again
Gradle Again
 
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
Andres Almiray - Gradle Ex Machina - Codemotion Rome 2019
 
Gradle ex-machina
Gradle ex-machinaGradle ex-machina
Gradle ex-machina
 

More from Andres Almiray

More from Andres Almiray (20)

Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abiertoCreando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abierto
 
Liberando a produccion con confianza
Liberando a produccion con confianzaLiberando a produccion con confianza
Liberando a produccion con confianza
 
Liberando a produccion con confidencia
Liberando a produccion con confidenciaLiberando a produccion con confidencia
Liberando a produccion con confidencia
 
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java Developers
 
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven Puzzlers
 
Maven Puzzlers
Maven PuzzlersMaven Puzzlers
Maven Puzzlers
 
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java Developers
 
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of light
 
Going Reactive with g rpc
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpc
 
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and LayrryBuilding modular applications with JPMS and Layrry
Building modular applications with JPMS and Layrry
 
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and YouApache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and You
 
The impact of sci fi in tech
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in tech
 
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
 
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
 
Go Java, Go!
Go Java, Go!Go Java, Go!
Go Java, Go!
 
Going Reactive with gRPC
Going Reactive with gRPCGoing Reactive with gRPC
Going Reactive with gRPC
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
 
Spock's New Tricks
Spock's New TricksSpock's New Tricks
Spock's New Tricks
 
Go Java, Go!
Go Java, Go!Go Java, Go!
Go Java, Go!
 

Recently uploaded

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

What I wish I knew about Maven years ago