SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Maven
Plugins, Properties
and Profiles
ADVANCED CONCEPTS
Agenda
Plugins
◦ Maven lifecycles
◦ Plugin binding
◦ Plugin configuration

Properties
◦ Build properties
◦ System properties
◦ Filtering

Profiles
Reactor
Maven in a nutshell
Maven Basics
Convention over configuration
◦ Convention for source code organization
◦ src/main/java
◦ src/webapp
◦ src/test/java

◦ Plugins with default configurations
◦ Jar, war, ear
◦ Surefire tests
◦ Reporting

Dependency Management
◦ Remote repository and local repository
◦ Transitive dependencies
Maven Plugins
Various components that take advantage of a project model.
◦ Build tasks
◦ Test tasks
◦ Installation tasks

A set of goals + configuration
◦ Can be executed directly:
◦ $ mvn plugin:goal

◦ Can be bound to a phase in a maven lifecycle
◦ $ mvn package
◦ Multiple plugin goals can be bound to the same phase
Maven Lifecycle
3 lifecycles
◦ Clean
◦ Default
◦ Site

Fixed set of phases
Default plugin bindings
◦ Depends on packaging
◦ See http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Builtin_Lifecycle_Bindings
Plugin Binding
Some plugin goals are bound to a phase by default.
E.g. maven-failsafe-plugin
◦ Not included by default
◦ When declared, two goals bind to a lifecycle phase
◦ failsafe:integration-test -> integration-test
◦ failsafe:verify -> verify

◦ Custom <execution> to bind to a different goal
Plugin Configuration
Plugin <configuration> element.
◦ In plugin definition
◦ Applied for default lifecycle bindings
◦ Applied for explicit execution

◦ In <execution>
◦ Applied for bound execution only

◦ XML Deserialization for complex configuration elements

Plugins can use build properties to get default configuration values
◦ Defined in plugin documentation
◦ Useful for default plugins (convention over configuration)
◦ E.g. -DskipTests
Maven Properties
Build properties
◦ Defined in pom.xml <properties> element
◦ Inherited from parent poms
◦ System properties are copied over build properties

Usage
◦ Plugin configuration
◦ Dependency versions
◦ Dependency management
Filtering
Supported in resources plugin, war plugin and some more.
◦ Enabled by <filtering>true</filtering>
◦ Standard resources in build definition
◦ Plugin configuration for war plugin

Replaces ${xxx} by corresponding build property.
◦ During copy, not in place.
◦ Build property can be overriden by system property.
◦ At build time! Not changed later.
System properties
Supported by some plugins that launches other jvm processes
E.g. surefire or failsafe plugin
◦ When using forkMode <> none
◦ <systemPropertyVariables>

E.g. launching application containers
◦ JBoss-as plugin
◦ Jetty plugin
◦ Tomcat plugin
Profiles
Profiles allows alternative build executions within the same pom
◦ Different <modules/>, <dependencies/>, etc.
◦ Different plugin configuration, different resources
◦ Inherited from parent

Activation
◦ Explicit: $ mvn –Pprofile1,profile2
◦ Activated by properties
◦ Activated by settings.xml

Could be used in combination with filtering
◦ To have different artifacts for different usages
◦ Use different classifier in resulting artifact

◦ Should not be used to escalate from DEV->TEST->PROD
Maven reactor
Maven builds recursively, using nested <modules/>
Can be tweaked by maven parameters
◦
◦
◦
◦
◦
◦

$ mvn –N
$ mvn –pl m1, m2,…
$ mvn –pl :m1
$ mvn –pl m1 –am
$ mvn –pl m1 –amd
$ mvn –rf m1

-> non-recursive
-> project list
-> by artifact id instead of directory name
-> also make requirements
-> also make dependents
-> resume from

Weitere ähnliche Inhalte

Was ist angesagt?

Build Automation using Maven
Build Automation using Maven Build Automation using Maven
Build Automation using Maven Ankit Gubrani
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by ExampleHsi-Kai Wang
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - ExplainedSmita Prasad
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache MavenRajind Ruparathna
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 OverviewMike Ensor
 
Maven for Dummies
Maven for DummiesMaven for Dummies
Maven for DummiesTomer Gabel
 
Apache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyApache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyVolodymyr Ostapiv
 
Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in MavenGeert Pante
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with MavenSid Anand
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Introboyw165
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to MavenVadym Lotar
 
Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsJohn Ferguson Smart Limited
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and AntDavid Noble
 

Was ist angesagt? (20)

Maven ppt
Maven pptMaven ppt
Maven ppt
 
Build Automation using Maven
Build Automation using Maven Build Automation using Maven
Build Automation using Maven
 
Apache Maven In 10 Slides
Apache Maven In 10 SlidesApache Maven In 10 Slides
Apache Maven In 10 Slides
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Introduction to Apache Maven
Introduction to Apache MavenIntroduction to Apache Maven
Introduction to Apache Maven
 
Maven 3 Overview
Maven 3  OverviewMaven 3  Overview
Maven 3 Overview
 
Maven basics
Maven basicsMaven basics
Maven basics
 
Maven for Dummies
Maven for DummiesMaven for Dummies
Maven for Dummies
 
Apache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT AcademyApache Maven for SoftServe IT Academy
Apache Maven for SoftServe IT Academy
 
Version Management in Maven
Version Management in MavenVersion Management in Maven
Version Management in Maven
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Note - Apache Maven Intro
Note - Apache Maven IntroNote - Apache Maven Intro
Note - Apache Maven Intro
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 
Automated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yardsAutomated Deployment with Maven - going the whole nine yards
Automated Deployment with Maven - going the whole nine yards
 
Maven 2 Introduction
Maven 2 IntroductionMaven 2 Introduction
Maven 2 Introduction
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
 
Maven
MavenMaven
Maven
 

Ähnlich wie Maven plugins, properties en profiles: Advanced concepts in Maven

Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...Lucidworks
 
Bundle deployment at state machine level - Ales Justin, JBoss
Bundle deployment at state machine level - Ales Justin, JBossBundle deployment at state machine level - Ales Justin, JBoss
Bundle deployment at state machine level - Ales Justin, JBossmfrancis
 
Maven in Java EE project
Maven in Java EE projectMaven in Java EE project
Maven in Java EE projectOndrej Mihályi
 
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 Mavenelliando dias
 
Developing Liferay Plugins with Maven
Developing Liferay Plugins with MavenDeveloping Liferay Plugins with Maven
Developing Liferay Plugins with MavenMika Koivisto
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfAppster1
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfAppster1
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Gunith Devasurendra
 
maven
mavenmaven
mavenakd11
 
Maven introduction in Mule
Maven introduction in MuleMaven introduction in Mule
Maven introduction in MuleShahid Shaik
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAkshaya Mahapatra
 

Ähnlich wie Maven plugins, properties en profiles: Advanced concepts in Maven (20)

Maven and versioning
Maven and versioningMaven and versioning
Maven and versioning
 
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
 
Bundle deployment at state machine level - Ales Justin, JBoss
Bundle deployment at state machine level - Ales Justin, JBossBundle deployment at state machine level - Ales Justin, JBoss
Bundle deployment at state machine level - Ales Justin, JBoss
 
Maven in Java EE project
Maven in Java EE projectMaven in Java EE project
Maven in Java EE project
 
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
 
Maven in Mule
Maven in MuleMaven in Mule
Maven in Mule
 
Maven advanced
Maven advancedMaven advanced
Maven advanced
 
Maven2交流
Maven2交流Maven2交流
Maven2交流
 
Developing Liferay Plugins with Maven
Developing Liferay Plugins with MavenDeveloping Liferay Plugins with Maven
Developing Liferay Plugins with Maven
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
 
Apache Maven basics
Apache Maven basicsApache Maven basics
Apache Maven basics
 
Maven
MavenMaven
Maven
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
 
Maven basic concept
Maven basic conceptMaven basic concept
Maven basic concept
 
maven
mavenmaven
maven
 
Maven introduction in Mule
Maven introduction in MuleMaven introduction in Mule
Maven introduction in Mule
 
Maven
MavenMaven
Maven
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps Approach
 

Mehr von Geert Pante

OAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootOAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootGeert Pante
 
Kafka Introduction.pptx
Kafka Introduction.pptxKafka Introduction.pptx
Kafka Introduction.pptxGeert Pante
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECSGeert Pante
 
Docker in practice
Docker in practiceDocker in practice
Docker in practiceGeert Pante
 
Spring JMS and ActiveMQ
Spring JMS and ActiveMQSpring JMS and ActiveMQ
Spring JMS and ActiveMQGeert Pante
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELKGeert Pante
 
Spring 4 en spring data
Spring 4 en spring dataSpring 4 en spring data
Spring 4 en spring dataGeert Pante
 
Spring and SOA (2006)
Spring and SOA (2006)Spring and SOA (2006)
Spring and SOA (2006)Geert Pante
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISGeert Pante
 

Mehr von Geert Pante (10)

OAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring BootOAuth2 and OpenID with Spring Boot
OAuth2 and OpenID with Spring Boot
 
Kafka Introduction.pptx
Kafka Introduction.pptxKafka Introduction.pptx
Kafka Introduction.pptx
 
Kubernetes and Amazon ECS
Kubernetes and Amazon ECSKubernetes and Amazon ECS
Kubernetes and Amazon ECS
 
Docker in practice
Docker in practiceDocker in practice
Docker in practice
 
Spring JMS and ActiveMQ
Spring JMS and ActiveMQSpring JMS and ActiveMQ
Spring JMS and ActiveMQ
 
Log management with ELK
Log management with ELKLog management with ELK
Log management with ELK
 
Java EE 6
Java EE 6Java EE 6
Java EE 6
 
Spring 4 en spring data
Spring 4 en spring dataSpring 4 en spring data
Spring 4 en spring data
 
Spring and SOA (2006)
Spring and SOA (2006)Spring and SOA (2006)
Spring and SOA (2006)
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
 

Kürzlich hochgeladen

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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].pdfOverkill Security
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
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 SavingEdi Saputra
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
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 challengesrafiqahmad00786416
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
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 educationjfdjdjcjdnsjd
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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.pptxRustici Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
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...Martijn de Jong
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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...
 

Maven plugins, properties en profiles: Advanced concepts in Maven

  • 2. Agenda Plugins ◦ Maven lifecycles ◦ Plugin binding ◦ Plugin configuration Properties ◦ Build properties ◦ System properties ◦ Filtering Profiles Reactor
  • 3. Maven in a nutshell
  • 4. Maven Basics Convention over configuration ◦ Convention for source code organization ◦ src/main/java ◦ src/webapp ◦ src/test/java ◦ Plugins with default configurations ◦ Jar, war, ear ◦ Surefire tests ◦ Reporting Dependency Management ◦ Remote repository and local repository ◦ Transitive dependencies
  • 5. Maven Plugins Various components that take advantage of a project model. ◦ Build tasks ◦ Test tasks ◦ Installation tasks A set of goals + configuration ◦ Can be executed directly: ◦ $ mvn plugin:goal ◦ Can be bound to a phase in a maven lifecycle ◦ $ mvn package ◦ Multiple plugin goals can be bound to the same phase
  • 6. Maven Lifecycle 3 lifecycles ◦ Clean ◦ Default ◦ Site Fixed set of phases Default plugin bindings ◦ Depends on packaging ◦ See http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Builtin_Lifecycle_Bindings
  • 7. Plugin Binding Some plugin goals are bound to a phase by default. E.g. maven-failsafe-plugin ◦ Not included by default ◦ When declared, two goals bind to a lifecycle phase ◦ failsafe:integration-test -> integration-test ◦ failsafe:verify -> verify ◦ Custom <execution> to bind to a different goal
  • 8. Plugin Configuration Plugin <configuration> element. ◦ In plugin definition ◦ Applied for default lifecycle bindings ◦ Applied for explicit execution ◦ In <execution> ◦ Applied for bound execution only ◦ XML Deserialization for complex configuration elements Plugins can use build properties to get default configuration values ◦ Defined in plugin documentation ◦ Useful for default plugins (convention over configuration) ◦ E.g. -DskipTests
  • 9. Maven Properties Build properties ◦ Defined in pom.xml <properties> element ◦ Inherited from parent poms ◦ System properties are copied over build properties Usage ◦ Plugin configuration ◦ Dependency versions ◦ Dependency management
  • 10. Filtering Supported in resources plugin, war plugin and some more. ◦ Enabled by <filtering>true</filtering> ◦ Standard resources in build definition ◦ Plugin configuration for war plugin Replaces ${xxx} by corresponding build property. ◦ During copy, not in place. ◦ Build property can be overriden by system property. ◦ At build time! Not changed later.
  • 11. System properties Supported by some plugins that launches other jvm processes E.g. surefire or failsafe plugin ◦ When using forkMode <> none ◦ <systemPropertyVariables> E.g. launching application containers ◦ JBoss-as plugin ◦ Jetty plugin ◦ Tomcat plugin
  • 12. Profiles Profiles allows alternative build executions within the same pom ◦ Different <modules/>, <dependencies/>, etc. ◦ Different plugin configuration, different resources ◦ Inherited from parent Activation ◦ Explicit: $ mvn –Pprofile1,profile2 ◦ Activated by properties ◦ Activated by settings.xml Could be used in combination with filtering ◦ To have different artifacts for different usages ◦ Use different classifier in resulting artifact ◦ Should not be used to escalate from DEV->TEST->PROD
  • 13. Maven reactor Maven builds recursively, using nested <modules/> Can be tweaked by maven parameters ◦ ◦ ◦ ◦ ◦ ◦ $ mvn –N $ mvn –pl m1, m2,… $ mvn –pl :m1 $ mvn –pl m1 –am $ mvn –pl m1 –amd $ mvn –rf m1 -> non-recursive -> project list -> by artifact id instead of directory name -> also make requirements -> also make dependents -> resume from