SlideShare a Scribd company logo
1 of 42
Exigen Services confidential Exigen Services confidential
Apache Maven 2 Overview
Part 2
Advanced Topics of Apache Maven 2
Anatoly Kondratyev
September 2012
20 July 2015
Exigen Services confidential
The Goal
• Understand several Maven capabilities
• Build multi-module project with Maven
• Some special pom blocks
• Nexus configuration notes
2
Exigen Services confidential
WORKING WITH MULTI-MODULE
PROJECTS
Maven in real world
3
Exigen Services confidential
Project contents
4
GWT
application
EJB BEJB A
My Library
Exigen Services confidential
What to do with Maven?
• 4 independent artifacts with dependencies
• Build in one step?
• Organize versioning?
• Keeping up to date?
• Wrong!
• Maven Inheritance and Aggregation
• Solves the above problems
• Right!
5
Exigen Services confidential
Maven Inheritance & Aggregation
• <packaging>pom</packaging>
• Super pom
• Data in parent pom is inherited
• Maven dependency reactor
• Notes
• No cyclic dependencies
• No same modules
6
Exigen Services confidential
Maven Inheritance & Aggregation
Parent
pom
EJB A
ejb
EJB B
ejb
Gwt
war
My library
jar
7
Exigen Services confidential
Maven in action
8
<project …>
<modelVersion>4.0.0</modelVersion>
<groupId>ru.exigenservices</groupId>
<artifactId>my-parent</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>EJB-A</module>
<module>EJB-B</module>
<module>Gwt</module>
<module>MyLibrary</module>
</modules>
</project>
Exigen Services confidential
Maven in action
• What about deployment?
• EAR needed
• Special step needed
• Maybe divide frontend and backend?
• NB! One pom – one artifact
9
Exigen Services confidential
Maven in action
Parent
pom
Frontend
pom
Gwt
war
Frontend
wrapper
ear
Backend
pom
EJB A
ejb
EJB B
ejb
Backend
wrapper
ear
My library
jar
10
Exigen Services confidential
Multimodal hierarchy
• Parent pom
<project …>
<groupId>exigen</groupId>
<artifactId>parent</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>backend</module>
<module>frontend</module>
</modules>
</project>
• Frontend pom
<project …>
<parent>
<groupId>exigen</groupId>
<artifactId>parent</artifactId>
<version>1.0.1-SNAPSHOT</version>
</parent>
<artifactId>frontend</artifactId>
<packaging>pom</packaging>
<modules>
<module>Gwt</module>
</modules>
</project>
11
Exigen Services confidential
Dependency&Plugin management
• Changeable, overriddable and inheritable
• In parent
• GroupId & ArtifactId
• Version
• Everything you can configure
• Type, packaging
• In child
• GroupId & ArtifactId
12
Exigen Services confidential
Dependency&Plugin Management
Parent:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
Child:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
</dependency>
</dependencies>
13
Exigen Services confidential
Flat vs Tree, Flat
.
|-- my-module
| `-- pom.xml
`--parent
`--pom.xml
• Pom.xml for my-module:
<project>
<parent>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<relativePath>.../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>my-module</artifactId>
</project>
15
Exigen Services confidential
Maven reactor
• Collects all the available modules to build
• Sorts the projects into the correct build order
• a project dependency on another module in the build
• different rules with plugins dependencies
• the order declared in the <modules> element (if no other rule
applies)
• Builds the selected projects in order
• Be aware of cycles and same modules on different
parents
16
Exigen Services confidential
Conclusion
• Inheritance and aggregation
• Flat/Tree structure
• Maven reactor
• Dependency&Plugin management
• Deploy to Nexus/Weblogic problem
17
Exigen Services confidential
PROPERTIES, PROFILES,
EXECUTION BLOCKS
What will help you
18
Exigen Services confidential
Maven properties
• Just as common Ant properties
• ${property_name}
• Case sensitive
• Upper case for environment variables
• Dot(.) notated path
19
Exigen Services confidential
Predefined properties
• Build in properties
• ${basedir} – directory with pom
• ${version} – artifact version
• Project properties
• ${project.build.directory}
• ${project.build.outputDirectory} (target/classes)
• ${project.name}
• ${project.version}
• Local user settings
• ${settings.localRepository}
• Environment properties
• ${env.M2_HOME}
20
Exigen Services confidential
Maven profiles
• Maven profile – special way for configuring
build
• Different environments – different results
• Renaming
• Different build cycles
• Special plugin configuration
• Just different targets
• For different users
22
Exigen Services confidential
Maven profiles
• Per project
• pom.xml
• Per user
• %USER_HOME%/.m2/settings.xml
• Per computer (Global)
• %M2_HOME%/conf/settings.xml
23
Exigen Services confidential
Maven profiles
• Activation
• By hand (-P profile1,profile2)
• <activeProfiles>
• <activation>
• By environment settings
• By properties
24
Exigen Services confidential
Maven profiles
<profiles>
<profile>
<activation>
<jdk>[1.3,1.6)</jdk>
</activation>
...
</profile>
<profile>
<activation>
<property>
<name>environment</name>
<value>test</value>
</property>
</activation>
...
</profile>
</profiles>
25
Exigen Services confidential
Mojo
• Plugin
• Executing action
• Mojo – magical charm in hoodoo
• Just a Goal
• Plugin consists of Mojos
• Some parameters
• MOJO aka POJO (Plain-old-Java-object)
27
Exigen Services confidential
Mojo
• When we should use mojos?
• Run from command line
• Different execution parameters for different
configurations
• Group of mojos from same plugin with
different configuration
28
Exigen Services confidential
Execution blocks
Plugin:time
<plugin>
<groupId>com.mycompany.example</groupId>
<artifactId>plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>first</id>
<phase>test</phase>
<goals>
<goal>time</goal>
</goals>
<configuration> … </configuration>
</execution>
<execution>
<id>default</id>
…
<!– No phase block -->
</execution>
</executions>
</plugin>
29
Exigen Services confidential
SCM SourceCodeManagement
• CVS, Mercurial, Perforce, Subversion, etc.
• Commit/update
• scm:bootstrap – build project
• Maven Release Plugin
• Snapshot  Version
• Check everything
• Commit
30
Exigen Services confidential
Maven archetypes
• Create folders, poms, general stuff
• Archetype  Project
• For creating project:
• archetype:generate
• Select archetype from list
• Set up groupId, artifactId, version, …
• Get all project structure and draft files
• maven-archetype-quickstart
• For creating archetype:
• archetype:create-from-project
31
Exigen Services confidential
Provided Arhetypes
• maven-archetype-archetype
• Sample archetype
• maven-archetype-j2ee-simple
• Simplified sample J2EE application
• maven-archetype-plugin
• Sample Maven plugin
• maven-archetype-quickstart
• Sample Maven project
• maven-archetype-webapp
• Sample Maven Webapp project
• More information:
http://maven.apache.org/archetype/maven-archetype-bundles/
32
Exigen Services confidential
archetype:create-from-project
• Sample project
• mvn archetype:create-from-project
• src catalog
• Pom.xml (maven-archetype)
• Some resources
• Modify code (…targetgenerated-sourcesarchetype)
• archetype-metadata.xml
• Update properties and default values; review
• Go to target, run “mvn install”
• To test archetype
“mvn archetype:generate -DarchetypeCatalog=local”
33
Exigen Services confidential
NEXUS
SETTING.XML
Good configuration - great advantage
34
Exigen Services confidential
Sonatype Nexus
• Artifact repository
• Nexus and Nexus Pro
• Rather simple
• Widely used
• Other Maven Repository Managers
• Apache Archiva
• Artifactory
• Comparison
http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Fe
ature+Matrix
35
Exigen Services confidential
Nexus hints
• Nexus configuration + local configuration
• Proxy repositories
• Add everything and cache it!
• Add to Public Repositories group
• Restrictions on uploading artifacts
• UI: Artifact Upload
36
Exigen Services confidential
Settings.xml
• Servers
<servers>
<server>
<id>nexus</id>
<username>…</username>
<password>…</password>
</server>
</servers>
• Mirrors (2.0.9)
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localserver:8081/nexus/content/groups/public/
</url>
</mirror>
</mirrors>
• Active Profile
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
• Profile
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
…
</pluginRepositories>
</profile>
</profiles>
37
Exigen Services confidential
updatePolicy
• UpdatePolicy
• Always
• Daily (default)
• Interval:X (X – integer in minutes)
• Never
• Repository Snapshots
• Enabled true/false
38
Exigen Services confidential
LICENSE, ORGANIZATION,
DEVELOPERS, CONTRIBUTORS
When you have free time…
39
Exigen Services confidential
Licenses
• How your project could be used?
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
40
Exigen Services confidential
Organization
• Just tell everybody!
<organization>
<name>Exigen Services</name>
<url>http://www.exigenservices.ru/</url>
</organization>
41
Exigen Services confidential
Developers & Contributors block
• Id, name, email
• Organization, organizationUrl
• Roles
• Timezone
• Properties
• Contributors don’t have Id
42
Exigen Services confidential
Developers block
<developers>
<developer>
<id>anatoly.k</id>
<name>Anatoly</name>
<email>Anatoly.Kondratiev@exigenservices.com</email>
<organization>Exigen</organization>
<organizationUrl>http://www.exigenservices.ru/</organizationUrl>
<roles>
<role>Configuration Manager</role>
<role>Developer</role>
</roles>
<timezone>+3</timezone>
<properties>
<skype>anatoly.kondratyev</skype>
</properties>
</developer>
</developers>
Exigen Services confidential
Final notes
• A great amount of plugins
• Ant-run
• Mirrors on local repo, not on computer
44
Exigen Services confidential
QUESTIONS
Now it’s your turn…
45

More Related Content

What's hot

Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules uploadRyan Cuprak
 
Introduction tomaven
Introduction tomavenIntroduction tomaven
Introduction tomavenManav Prasad
 
Maven for Dummies
Maven for DummiesMaven for Dummies
Maven for DummiesTomer Gabel
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with MavenSid Anand
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsGR8Conf
 
Java build tool_comparison
Java build tool_comparisonJava build tool_comparison
Java build tool_comparisonManav Prasad
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best PracticesBurt Beckwith
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksMike Hugo
 
DockerCon SF 2015: A New Model for Image Distribution
DockerCon SF 2015: A New Model for Image DistributionDockerCon SF 2015: A New Model for Image Distribution
DockerCon SF 2015: A New Model for Image DistributionDocker, Inc.
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and AntDavid Noble
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with JenkinsJadson Santos
 

What's hot (20)

Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Introduction tomaven
Introduction tomavenIntroduction tomaven
Introduction tomaven
 
Maven for Dummies
Maven for DummiesMaven for Dummies
Maven for Dummies
 
Maven
Maven Maven
Maven
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
My "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails ProjectsMy "Perfect" Toolchain Setup for Grails Projects
My "Perfect" Toolchain Setup for Grails Projects
 
Java build tool_comparison
Java build tool_comparisonJava build tool_comparison
Java build tool_comparison
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best Practices
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Building Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And TricksBuilding Grails Plugins - Tips And Tricks
Building Grails Plugins - Tips And Tricks
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
 
Development Tools - Maven
Development Tools - MavenDevelopment Tools - Maven
Development Tools - Maven
 
DockerCon SF 2015: A New Model for Image Distribution
DockerCon SF 2015: A New Model for Image DistributionDockerCon SF 2015: A New Model for Image Distribution
DockerCon SF 2015: A New Model for Image Distribution
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Maven Overview
Maven OverviewMaven Overview
Maven Overview
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
 
Apache Maven In 10 Slides
Apache Maven In 10 SlidesApache Maven In 10 Slides
Apache Maven In 10 Slides
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with Jenkins
 

Similar to Apache maven 2. advanced topics

How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.Fazreil Amreen Abdul Jalil
 
Lorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - MavenLorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - MavenArnaud Héritier
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 
Apache Maven - eXo TN presentation
Apache Maven - eXo TN presentationApache Maven - eXo TN presentation
Apache Maven - eXo TN presentationArnaud Héritier
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5mbaric
 
Building a server platform with os gi
Building a server platform with os giBuilding a server platform with os gi
Building a server platform with os giDileepa Jayakody
 
Using GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to AzureUsing GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to AzureKasun Kodagoda
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using MavenScheidt & Bachmann
 
Building a Modular Server Platform with OSGi - Harshana Eranga Martin, Dileep...
Building a Modular Server Platform with OSGi - Harshana Eranga Martin, Dileep...Building a Modular Server Platform with OSGi - Harshana Eranga Martin, Dileep...
Building a Modular Server Platform with OSGi - Harshana Eranga Martin, Dileep...mfrancis
 
Building a Modular Server Platform with OSGi
Building a Modular Server Platform with OSGiBuilding a Modular Server Platform with OSGi
Building a Modular Server Platform with OSGiDileepa Jayakody
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...E. Camden Fisher
 
Alfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European BankAlfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European BankPiergiorgio Lucidi
 

Similar to Apache maven 2. advanced topics (20)

How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.How maven makes your development group look like a bunch of professionals.
How maven makes your development group look like a bunch of professionals.
 
Apache Maven 2 Part 2
Apache Maven 2 Part 2Apache Maven 2 Part 2
Apache Maven 2 Part 2
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
Lorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - MavenLorraine JUG (1st June, 2010) - Maven
Lorraine JUG (1st June, 2010) - Maven
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Apache Maven - eXo TN presentation
Apache Maven - eXo TN presentationApache Maven - eXo TN presentation
Apache Maven - eXo TN presentation
 
Introduction to ASP.NET 5
Introduction to ASP.NET 5Introduction to ASP.NET 5
Introduction to ASP.NET 5
 
Agile sites2
Agile sites2Agile sites2
Agile sites2
 
Unit4wt
Unit4wtUnit4wt
Unit4wt
 
Unit4wt
Unit4wtUnit4wt
Unit4wt
 
Building a server platform with os gi
Building a server platform with os giBuilding a server platform with os gi
Building a server platform with os gi
 
Agile sites311training
Agile sites311trainingAgile sites311training
Agile sites311training
 
Using GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to AzureUsing GitHub Actions to Deploy your Workloads to Azure
Using GitHub Actions to Deploy your Workloads to Azure
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using Maven
 
Building a Modular Server Platform with OSGi - Harshana Eranga Martin, Dileep...
Building a Modular Server Platform with OSGi - Harshana Eranga Martin, Dileep...Building a Modular Server Platform with OSGi - Harshana Eranga Martin, Dileep...
Building a Modular Server Platform with OSGi - Harshana Eranga Martin, Dileep...
 
Building a Modular Server Platform with OSGi
Building a Modular Server Platform with OSGiBuilding a Modular Server Platform with OSGi
Building a Modular Server Platform with OSGi
 
Container Patterns
Container PatternsContainer Patterns
Container Patterns
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
Alfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European BankAlfresco Summit 2014 - Crafter CMS - Case European Bank
Alfresco Summit 2014 - Crafter CMS - Case European Bank
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 

More from Return on Intelligence

Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Return on Intelligence
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsReturn on Intelligence
 
Types of testing and their classification
Types of testing and their classificationTypes of testing and their classification
Types of testing and their classificationReturn on Intelligence
 
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Return on Intelligence
 
Apache cassandra - future without boundaries (part2)
Apache cassandra - future without boundaries (part2)Apache cassandra - future without boundaries (part2)
Apache cassandra - future without boundaries (part2)Return on Intelligence
 
Apache cassandra - future without boundaries (part1)
Apache cassandra - future without boundaries (part1)Apache cassandra - future without boundaries (part1)
Apache cassandra - future without boundaries (part1)Return on Intelligence
 

More from Return on Intelligence (20)

Clean Code Approach
Clean Code ApproachClean Code Approach
Clean Code Approach
 
Code Coverage
Code CoverageCode Coverage
Code Coverage
 
Effective Communication in english
Effective Communication in englishEffective Communication in english
Effective Communication in english
 
Anti-patterns
Anti-patternsAnti-patterns
Anti-patterns
 
Conflicts Resolving
Conflicts ResolvingConflicts Resolving
Conflicts Resolving
 
Database versioning with liquibase
Database versioning with liquibaseDatabase versioning with liquibase
Database versioning with liquibase
 
Effective Feedback
Effective FeedbackEffective Feedback
Effective Feedback
 
English for Negotiations 2016
English for Negotiations 2016English for Negotiations 2016
English for Negotiations 2016
 
Lean Software Development
Lean Software DevelopmentLean Software Development
Lean Software Development
 
Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!Unit Tests? It is Very Simple and Easy!
Unit Tests? It is Very Simple and Easy!
 
Quick Start to AngularJS
Quick Start to AngularJSQuick Start to AngularJS
Quick Start to AngularJS
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.js
 
Types of testing and their classification
Types of testing and their classificationTypes of testing and their classification
Types of testing and their classification
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
Enterprise Service Bus
Enterprise Service BusEnterprise Service Bus
Enterprise Service Bus
 
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)
 
Apache cassandra - future without boundaries (part2)
Apache cassandra - future without boundaries (part2)Apache cassandra - future without boundaries (part2)
Apache cassandra - future without boundaries (part2)
 
Apache cassandra - future without boundaries (part1)
Apache cassandra - future without boundaries (part1)Apache cassandra - future without boundaries (part1)
Apache cassandra - future without boundaries (part1)
 
Career development in exigen services
Career development in exigen servicesCareer development in exigen services
Career development in exigen services
 
Introduction to selenium web driver
Introduction to selenium web driverIntroduction to selenium web driver
Introduction to selenium web driver
 

Recently uploaded

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 

Recently uploaded (20)

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 

Apache maven 2. advanced topics

  • 1. Exigen Services confidential Exigen Services confidential Apache Maven 2 Overview Part 2 Advanced Topics of Apache Maven 2 Anatoly Kondratyev September 2012 20 July 2015
  • 2. Exigen Services confidential The Goal • Understand several Maven capabilities • Build multi-module project with Maven • Some special pom blocks • Nexus configuration notes 2
  • 3. Exigen Services confidential WORKING WITH MULTI-MODULE PROJECTS Maven in real world 3
  • 4. Exigen Services confidential Project contents 4 GWT application EJB BEJB A My Library
  • 5. Exigen Services confidential What to do with Maven? • 4 independent artifacts with dependencies • Build in one step? • Organize versioning? • Keeping up to date? • Wrong! • Maven Inheritance and Aggregation • Solves the above problems • Right! 5
  • 6. Exigen Services confidential Maven Inheritance & Aggregation • <packaging>pom</packaging> • Super pom • Data in parent pom is inherited • Maven dependency reactor • Notes • No cyclic dependencies • No same modules 6
  • 7. Exigen Services confidential Maven Inheritance & Aggregation Parent pom EJB A ejb EJB B ejb Gwt war My library jar 7
  • 8. Exigen Services confidential Maven in action 8 <project …> <modelVersion>4.0.0</modelVersion> <groupId>ru.exigenservices</groupId> <artifactId>my-parent</artifactId> <version>1.0.1-SNAPSHOT</version> <packaging>pom</packaging> <modules> <module>EJB-A</module> <module>EJB-B</module> <module>Gwt</module> <module>MyLibrary</module> </modules> </project>
  • 9. Exigen Services confidential Maven in action • What about deployment? • EAR needed • Special step needed • Maybe divide frontend and backend? • NB! One pom – one artifact 9
  • 10. Exigen Services confidential Maven in action Parent pom Frontend pom Gwt war Frontend wrapper ear Backend pom EJB A ejb EJB B ejb Backend wrapper ear My library jar 10
  • 11. Exigen Services confidential Multimodal hierarchy • Parent pom <project …> <groupId>exigen</groupId> <artifactId>parent</artifactId> <version>1.0.1-SNAPSHOT</version> <packaging>pom</packaging> <modules> <module>backend</module> <module>frontend</module> </modules> </project> • Frontend pom <project …> <parent> <groupId>exigen</groupId> <artifactId>parent</artifactId> <version>1.0.1-SNAPSHOT</version> </parent> <artifactId>frontend</artifactId> <packaging>pom</packaging> <modules> <module>Gwt</module> </modules> </project> 11
  • 12. Exigen Services confidential Dependency&Plugin management • Changeable, overriddable and inheritable • In parent • GroupId & ArtifactId • Version • Everything you can configure • Type, packaging • In child • GroupId & ArtifactId 12
  • 13. Exigen Services confidential Dependency&Plugin Management Parent: <dependencyManagement> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> </dependencies> </dependencyManagement> Child: <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> </dependency> </dependencies> 13
  • 14. Exigen Services confidential Flat vs Tree, Flat . |-- my-module | `-- pom.xml `--parent `--pom.xml • Pom.xml for my-module: <project> <parent> <groupId>com.mycompany.app</groupId> <artifactId>my-app</artifactId> <version>1</version> <relativePath>.../parent/pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>my-module</artifactId> </project> 15
  • 15. Exigen Services confidential Maven reactor • Collects all the available modules to build • Sorts the projects into the correct build order • a project dependency on another module in the build • different rules with plugins dependencies • the order declared in the <modules> element (if no other rule applies) • Builds the selected projects in order • Be aware of cycles and same modules on different parents 16
  • 16. Exigen Services confidential Conclusion • Inheritance and aggregation • Flat/Tree structure • Maven reactor • Dependency&Plugin management • Deploy to Nexus/Weblogic problem 17
  • 17. Exigen Services confidential PROPERTIES, PROFILES, EXECUTION BLOCKS What will help you 18
  • 18. Exigen Services confidential Maven properties • Just as common Ant properties • ${property_name} • Case sensitive • Upper case for environment variables • Dot(.) notated path 19
  • 19. Exigen Services confidential Predefined properties • Build in properties • ${basedir} – directory with pom • ${version} – artifact version • Project properties • ${project.build.directory} • ${project.build.outputDirectory} (target/classes) • ${project.name} • ${project.version} • Local user settings • ${settings.localRepository} • Environment properties • ${env.M2_HOME} 20
  • 20. Exigen Services confidential Maven profiles • Maven profile – special way for configuring build • Different environments – different results • Renaming • Different build cycles • Special plugin configuration • Just different targets • For different users 22
  • 21. Exigen Services confidential Maven profiles • Per project • pom.xml • Per user • %USER_HOME%/.m2/settings.xml • Per computer (Global) • %M2_HOME%/conf/settings.xml 23
  • 22. Exigen Services confidential Maven profiles • Activation • By hand (-P profile1,profile2) • <activeProfiles> • <activation> • By environment settings • By properties 24
  • 23. Exigen Services confidential Maven profiles <profiles> <profile> <activation> <jdk>[1.3,1.6)</jdk> </activation> ... </profile> <profile> <activation> <property> <name>environment</name> <value>test</value> </property> </activation> ... </profile> </profiles> 25
  • 24. Exigen Services confidential Mojo • Plugin • Executing action • Mojo – magical charm in hoodoo • Just a Goal • Plugin consists of Mojos • Some parameters • MOJO aka POJO (Plain-old-Java-object) 27
  • 25. Exigen Services confidential Mojo • When we should use mojos? • Run from command line • Different execution parameters for different configurations • Group of mojos from same plugin with different configuration 28
  • 26. Exigen Services confidential Execution blocks Plugin:time <plugin> <groupId>com.mycompany.example</groupId> <artifactId>plugin</artifactId> <version>1.0</version> <executions> <execution> <id>first</id> <phase>test</phase> <goals> <goal>time</goal> </goals> <configuration> … </configuration> </execution> <execution> <id>default</id> … <!– No phase block --> </execution> </executions> </plugin> 29
  • 27. Exigen Services confidential SCM SourceCodeManagement • CVS, Mercurial, Perforce, Subversion, etc. • Commit/update • scm:bootstrap – build project • Maven Release Plugin • Snapshot  Version • Check everything • Commit 30
  • 28. Exigen Services confidential Maven archetypes • Create folders, poms, general stuff • Archetype  Project • For creating project: • archetype:generate • Select archetype from list • Set up groupId, artifactId, version, … • Get all project structure and draft files • maven-archetype-quickstart • For creating archetype: • archetype:create-from-project 31
  • 29. Exigen Services confidential Provided Arhetypes • maven-archetype-archetype • Sample archetype • maven-archetype-j2ee-simple • Simplified sample J2EE application • maven-archetype-plugin • Sample Maven plugin • maven-archetype-quickstart • Sample Maven project • maven-archetype-webapp • Sample Maven Webapp project • More information: http://maven.apache.org/archetype/maven-archetype-bundles/ 32
  • 30. Exigen Services confidential archetype:create-from-project • Sample project • mvn archetype:create-from-project • src catalog • Pom.xml (maven-archetype) • Some resources • Modify code (…targetgenerated-sourcesarchetype) • archetype-metadata.xml • Update properties and default values; review • Go to target, run “mvn install” • To test archetype “mvn archetype:generate -DarchetypeCatalog=local” 33
  • 31. Exigen Services confidential NEXUS SETTING.XML Good configuration - great advantage 34
  • 32. Exigen Services confidential Sonatype Nexus • Artifact repository • Nexus and Nexus Pro • Rather simple • Widely used • Other Maven Repository Managers • Apache Archiva • Artifactory • Comparison http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Fe ature+Matrix 35
  • 33. Exigen Services confidential Nexus hints • Nexus configuration + local configuration • Proxy repositories • Add everything and cache it! • Add to Public Repositories group • Restrictions on uploading artifacts • UI: Artifact Upload 36
  • 34. Exigen Services confidential Settings.xml • Servers <servers> <server> <id>nexus</id> <username>…</username> <password>…</password> </server> </servers> • Mirrors (2.0.9) <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://localserver:8081/nexus/content/groups/public/ </url> </mirror> </mirrors> • Active Profile <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> • Profile <profiles> <profile> <id>nexus</id> <repositories> <repository> <id>central</id> <url>http://central</url> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> … </pluginRepositories> </profile> </profiles> 37
  • 35. Exigen Services confidential updatePolicy • UpdatePolicy • Always • Daily (default) • Interval:X (X – integer in minutes) • Never • Repository Snapshots • Enabled true/false 38
  • 36. Exigen Services confidential LICENSE, ORGANIZATION, DEVELOPERS, CONTRIBUTORS When you have free time… 39
  • 37. Exigen Services confidential Licenses • How your project could be used? <licenses> <license> <name>The Apache Software License, Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <distribution>repo</distribution> <comments>A business-friendly OSS license</comments> </license> </licenses> 40
  • 38. Exigen Services confidential Organization • Just tell everybody! <organization> <name>Exigen Services</name> <url>http://www.exigenservices.ru/</url> </organization> 41
  • 39. Exigen Services confidential Developers & Contributors block • Id, name, email • Organization, organizationUrl • Roles • Timezone • Properties • Contributors don’t have Id 42
  • 40. Exigen Services confidential Developers block <developers> <developer> <id>anatoly.k</id> <name>Anatoly</name> <email>Anatoly.Kondratiev@exigenservices.com</email> <organization>Exigen</organization> <organizationUrl>http://www.exigenservices.ru/</organizationUrl> <roles> <role>Configuration Manager</role> <role>Developer</role> </roles> <timezone>+3</timezone> <properties> <skype>anatoly.kondratyev</skype> </properties> </developer> </developers>
  • 41. Exigen Services confidential Final notes • A great amount of plugins • Ant-run • Mirrors on local repo, not on computer 44