SlideShare a Scribd company logo
Java Build Tools
Sujit Kumar
Zenolocity LLC © 2013-2023
Manual Development Tasks In Eclipse
•
•
•
•
•
•
•
•
•

Clean Code – remove all your class files
Compile Code
Run your application
Run JUnit tests
Package jars
Package wars
Deploy wars to an application server
**** How do u automate all the above? ***
Batch file on windows or Shell Scripts for Unix
and Mac. Not portable.
Available Tools for Automation
•
•
•
•

ANT
Maven
Gradle
All the above (Ant, Maven, Gradle) are
portable options built on top of the JVM.
ANT
• Based on XML.
• Tasks to automate nearly everything that you
can do from a shell script or batch file.
• You can even do procedural flow control using
XML.
Setting up ANT environment variables
on Windows
• set ANT_HOME=C:Userssujitdevappsapacheant-1.8.2
• set PATH=%ANT_HOME%bin;%PATH%
• Verify ANT version by running:
ant –version
• Ant itself needs JAVA_HOME and JDK_HOME to
be set.
Set up environment variables on Unix
• Add the following lines in your ~/.bashrc
• export
ANT_HOME={PATH_TO_PARENT_DIR_OF_ANT
}/apache-ant-1.8.2
• export PATH=$ANT_HOME/bin:$PATH
• Verify ANT version by running:
ant -version
ANT Core tasks Categories – Part 1
• Compile Tasks: javac, depend, jspc, apt
• Execution Tasks: ant, antcall, exec, java,
parallel, sequential
• File Tasks: copy, delete, mkdir, move, replace,
touch, chmod, chgrp, concat,
• Mail Tasks: mail
• SCM Tasks: Cvs, Svn, Clearcase, PVCS.
• Testing Tasks: Junit, JUnitReport.
ANT Core Task Categories – Part 2
• Property Tasks: Property, LoadProperties,
XMLProperty, Dirname, Basename, Condition,
Uptodate, Available, etc.
• Remote Tasks: ftp, scp, telnet, etc.
• Pre-process Tasks: import, include, etc.
• Miscellaneous Tasks: Echo, Fail, Taskdef,
Typedef, Tstamp, etc.
• Archive Tasks: jar, unjar, war, unwar, zip,
unzip, tar, untar, gzip, gunzip.
Flow Control with ANT
• Execute flow control logical tasks like if, for,
foreach, switch, assert, trycatch, etc.
• http://ant-contrib.sourceforge.net/tasks
Maven
• Software project management tool. Manage
project’s build, dependencies & documentation.
• Based on the concept of a project object model
(POM).
• Efficient dependency management by using
repositories of dependent jars.
• Extensible with lot of plugins in java.
• Uses the Convention over configuration design
pattern – minimizes code & decision making
without losing flexibility.
Simple ANT build.xml file
Simple Maven pom.xml file
• <project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.sonatype.mavenbook</groupId>
<artifactId>my-project</artifactId>
<version>1.0</version>
• </project>
• See how simple the pom xml file looks like.
• Where Ant had to be explicit about the process, there was
something "built-in" to Maven that just knew where the source
code was and how it should be processed.
• Convention over configuration reduces amount of code and
configuration.
Maven Configuration Files
•
•
•
•
•

JAVA_HOME where JDK is installed.
Add JAVA_HOME/bin to the PATH.
M2_HOME where Maven is installed.
Add M2_HOME/bin to the PATH.
2 locations where a settings.xml file may live:
Global: ${M2_HOME}/conf/settings.xml
Local: ${HOME}/.m2/settings.xml
• If both files exist, contents are merged & local
overrides global.
Maven Repositories
• Local
• Central
• Remote
Local Repository
• Project’s dependent jars are downloaded and
stored in the local repository.
• Default location: {HOME_DIR}/.m2
• Change location of local repository in
{M2_HOME}confsetting.xml, update
localRepository to something else.
Maven Build Life Cycle
• Conventional process for building & distributing
an artifact.
• Defined by a list of build phases. A phase is a
stage in the build process.
• 3 built in build life cycles: default, clean & site.
• Build phases are executed sequentially.
• When a build phase is executed, it will execute
not only that build phase, but also every build
phase prior to the called build phase.
Default Build Life Cycle
•
•
•
•
•
•
•
•
•
•
•
•

validate: validate the project is correct and all necessary information is available.
initialize: initialize build state, eg. Set properties or create directories.
generate-resources: generate resources for inclusion in the package.
process-resources: copy and process the resources into the destination directory.
compile: compile the source code of the project.
test-compile: compile the test source code of the project.
test: test the compiled source code using a suitable unit testing framework. These
tests should not require the code be packaged or deployed
package: take the compiled code and package it in its distributable format, such as
a JAR.
integration-test: process and deploy the package if necessary into an environment
where integration tests can be run
verify: run any checks to verify the package is valid and meets quality criteria
install: install the package into the local repository, for use as a dependency in
other projects locally
deploy: done in an integration or release environment, copies the final package to
the remote repository for sharing with other developers and projects.
Life Cycle Reference
• List in the previous slide not a complete list.
• Full list available here:
• https://maven.apache.org/guides/introductio
n/introduction-to-thelifecycle.html#Lifecycle_Reference
Maven Goals & Phases
• Goals are executed in phases which helps determine the order
goals get executed in.
• Compile phase goals will always be executed before the Test phase
goals which will always be executed before the Package phase goals
and so on.
• When you create a plugin execution in your Maven build file and
you only specify the goal then it will bind that goal to a given
default phase. For example, the jaxb:xjc goal binds by default to the
generate-resources phase. However, when you specify the
execution you can also explicitly specify the phase for that goal as
well.
• If you specify a goal when you execute Maven then it will still run all
phases up to the phase for that goal. In other words, if you specify
the jar goal it will run all phases up to the package phase (and all
goals in those phases), and then it will run the jar goal.
Differences between ANT and Maven –
part 1
• Ant doesn't have formal conventions like a common
project directory structure. You have to tell Ant exactly
where to find the source and where to put the output.
Informal conventions have emerged over time, but
they haven't been codified into the product.
• Ant is procedural, you have to tell Ant exactly what to
do and when to do it. You had to tell it to compile, then
copy, then compress.
• Ant doesn't have a lifecycle, you have to define goals
and goal dependencies. You have to attach a sequence
of tasks to each goal manually.
Differences between ANT and Maven –
part 2
• Maven has conventions, it knows where your source code
is because you followed the convention. It puts the byte
code in target/classes, and it created a JAR file in target.
• Maven is declarative. All you had to do was create a
pom.xml file and put your source in the default directory.
Maven took care of the rest.
• Maven has a lifecycle, which you invoked when you
executed “mvn” install. This command tells Maven to
execute a sequence of steps until it reached the lifecycle.
As a side-effect of this journey through the lifecycle, Maven
executed a number of default plugin goals which did things
like compile and create a JAR.
Differences between ANT and Mavenpart 3
• Maven has intelligence about common
project tasks. To run tests, simple execute mvn
test, as long as the files are in the default
location. In Ant, you would first have to
specify the location of the JUnit JAR file, then
create a classpath that includes the JUnit JAR,
then tell Ant where it should look for test
source code, write a goal that compiles the
test source and then finally execute the unit
tests with JUnit.
Comparison with Gradle
• http://xpanxionsoftware.wordpress.com/2012
/05/11/ant-maven-and-gradle-a-side-by-sidecomparison/

More Related Content

What's hot

Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonEclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonVladLica
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
Dmitry Bakaleinik
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
Smita Prasad
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
David Noble
 
Maven
MavenMaven
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
MD Sayem Ahmed
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to MavenVadym Lotar
 
Maven ppt
Maven pptMaven ppt
Maven ppt
natashasweety7
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
Angel Ruiz
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
php-user-group-minsk
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
Sid Anand
 
Gerência de Configuração com Maven
Gerência de Configuração com MavenGerência de Configuração com Maven
Gerência de Configuração com Mavenelliando dias
 
Jenkins Meetup Pune
Jenkins Meetup PuneJenkins Meetup Pune
Jenkins Meetup Pune
Umesh Kumhar
 
Maven: from Scratch to Production (.pdf)
Maven: from Scratch to Production (.pdf)Maven: from Scratch to Production (.pdf)
Maven: from Scratch to Production (.pdf)
Johan Mynhardt
 
Using Maven 2
Using Maven 2Using Maven 2
Using Maven 2
andyhot
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal info
Synapseindiappsdevelopment
 
Drupal & Continous Integration - SF State Study Case
Drupal & Continous Integration - SF State Study CaseDrupal & Continous Integration - SF State Study Case
Drupal & Continous Integration - SF State Study Case
Emanuele Quinto
 
Introduce fuego
Introduce fuegoIntroduce fuego
Introduce fuego
s60030
 

What's hot (20)

Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/HudsonEclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
Eclipse DemoCamp Bucharest 2014 - Continuous Integration Jenkins/Hudson
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
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
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 
Maven ppt
Maven pptMaven ppt
Maven ppt
 
Maven 2 features
Maven 2 featuresMaven 2 features
Maven 2 features
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
 
Hands On with Maven
Hands On with MavenHands On with Maven
Hands On with Maven
 
Gerência de Configuração com Maven
Gerência de Configuração com MavenGerência de Configuração com Maven
Gerência de Configuração com Maven
 
Jenkins Meetup Pune
Jenkins Meetup PuneJenkins Meetup Pune
Jenkins Meetup Pune
 
Maven: from Scratch to Production (.pdf)
Maven: from Scratch to Production (.pdf)Maven: from Scratch to Production (.pdf)
Maven: from Scratch to Production (.pdf)
 
Using Maven 2
Using Maven 2Using Maven 2
Using Maven 2
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal info
 
Using Maven2
Using Maven2Using Maven2
Using Maven2
 
Drupal & Continous Integration - SF State Study Case
Drupal & Continous Integration - SF State Study CaseDrupal & Continous Integration - SF State Study Case
Drupal & Continous Integration - SF State Study Case
 
Introduce fuego
Introduce fuegoIntroduce fuego
Introduce fuego
 

Viewers also liked

Java Build Tools
Java Build ToolsJava Build Tools
Java Build Tools
­Avishek A
 
Java input output package
Java input output packageJava input output package
Java input output packageSujit Kumar
 
Unit testing principles
Unit testing principlesUnit testing principles
Unit testing principlesSujit Kumar
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
Sujit Kumar
 

Viewers also liked (6)

Java Build Tools
Java Build ToolsJava Build Tools
Java Build Tools
 
Java input output package
Java input output packageJava input output package
Java input output package
 
Jdbc
JdbcJdbc
Jdbc
 
Unit testing principles
Unit testing principlesUnit testing principles
Unit testing principles
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
 
Java file paths
Java file pathsJava file paths
Java file paths
 

Similar to Java build tools

Mavennotes.pdf
Mavennotes.pdfMavennotes.pdf
Mavennotes.pdf
AnkurSingh656748
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
Gourav Varma
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
Ankur Goyal
 
Apache ANT vs Apache Maven
Apache ANT vs Apache MavenApache ANT vs Apache Maven
Apache ANT vs Apache Maven
Mudit Gupta
 
Maven
MavenMaven
Maven
Shraddha
 
Maven
MavenMaven
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
Mert Çalışkan
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
Hsi-Kai Wang
 
Introduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOpsIntroduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOps
SISTechnologies
 
Build Tools & Maven
Build Tools & MavenBuild Tools & Maven
Build Tools & Maven
David Simons
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
Eric Wyles
 
Jenkins_1679702972.pdf
Jenkins_1679702972.pdfJenkins_1679702972.pdf
Jenkins_1679702972.pdf
MahmoudAlnmr1
 
jenkins.pdf
jenkins.pdfjenkins.pdf
jenkins.pdf
shahidafrith
 
Apache Maven
Apache MavenApache Maven
Apache Maven
eurosigdoc acm
 
Maven
MavenMaven
4 maven junit
4 maven junit4 maven junit
4 maven junit
Honnix Liang
 
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
Scheidt & Bachmann
 
Devops
DevopsDevops
Devops
JyothirmaiG4
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
Mert Çalışkan
 
maven
mavenmaven
maven
akd11
 

Similar to Java build tools (20)

Mavennotes.pdf
Mavennotes.pdfMavennotes.pdf
Mavennotes.pdf
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
Ci jenkins maven svn
Ci jenkins maven svnCi jenkins maven svn
Ci jenkins maven svn
 
Apache ANT vs Apache Maven
Apache ANT vs Apache MavenApache ANT vs Apache Maven
Apache ANT vs Apache Maven
 
Maven
MavenMaven
Maven
 
Maven
MavenMaven
Maven
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
Learning Maven by Example
Learning Maven by ExampleLearning Maven by Example
Learning Maven by Example
 
Introduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOpsIntroduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOps
 
Build Tools & Maven
Build Tools & MavenBuild Tools & Maven
Build Tools & Maven
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
 
Jenkins_1679702972.pdf
Jenkins_1679702972.pdfJenkins_1679702972.pdf
Jenkins_1679702972.pdf
 
jenkins.pdf
jenkins.pdfjenkins.pdf
jenkins.pdf
 
Apache Maven
Apache MavenApache Maven
Apache Maven
 
Maven
MavenMaven
Maven
 
4 maven junit
4 maven junit4 maven junit
4 maven junit
 
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
 
Devops
DevopsDevops
Devops
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
 
maven
mavenmaven
maven
 

More from Sujit Kumar

SFDC Database Basics
SFDC Database BasicsSFDC Database Basics
SFDC Database Basics
Sujit Kumar
 
SFDC Database Security
SFDC Database SecuritySFDC Database Security
SFDC Database Security
Sujit Kumar
 
SFDC Social Applications
SFDC Social ApplicationsSFDC Social Applications
SFDC Social Applications
Sujit Kumar
 
SFDC Other Platform Features
SFDC Other Platform FeaturesSFDC Other Platform Features
SFDC Other Platform Features
Sujit Kumar
 
SFDC Outbound Integrations
SFDC Outbound IntegrationsSFDC Outbound Integrations
SFDC Outbound Integrations
Sujit Kumar
 
SFDC Inbound Integrations
SFDC Inbound IntegrationsSFDC Inbound Integrations
SFDC Inbound Integrations
Sujit Kumar
 
SFDC UI - Advanced Visualforce
SFDC UI - Advanced VisualforceSFDC UI - Advanced Visualforce
SFDC UI - Advanced Visualforce
Sujit Kumar
 
SFDC UI - Introduction to Visualforce
SFDC UI -  Introduction to VisualforceSFDC UI -  Introduction to Visualforce
SFDC UI - Introduction to Visualforce
Sujit Kumar
 
SFDC Deployments
SFDC DeploymentsSFDC Deployments
SFDC Deployments
Sujit Kumar
 
SFDC Batch Apex
SFDC Batch ApexSFDC Batch Apex
SFDC Batch Apex
Sujit Kumar
 
SFDC Data Loader
SFDC Data LoaderSFDC Data Loader
SFDC Data Loader
Sujit Kumar
 
SFDC Advanced Apex
SFDC Advanced Apex SFDC Advanced Apex
SFDC Advanced Apex
Sujit Kumar
 
SFDC Introduction to Apex
SFDC Introduction to ApexSFDC Introduction to Apex
SFDC Introduction to Apex
Sujit Kumar
 
SFDC Database Additional Features
SFDC Database Additional FeaturesSFDC Database Additional Features
SFDC Database Additional Features
Sujit Kumar
 
Introduction to SalesForce
Introduction to SalesForceIntroduction to SalesForce
Introduction to SalesForce
Sujit Kumar
 
More about java strings - Immutability and String Pool
More about java strings - Immutability and String PoolMore about java strings - Immutability and String Pool
More about java strings - Immutability and String Pool
Sujit Kumar
 
Hibernate First and Second level caches
Hibernate First and Second level cachesHibernate First and Second level caches
Hibernate First and Second level caches
Sujit Kumar
 
Java equals hashCode Contract
Java equals hashCode ContractJava equals hashCode Contract
Java equals hashCode ContractSujit Kumar
 
Java Comparable and Comparator
Java Comparable and ComparatorJava Comparable and Comparator
Java Comparable and ComparatorSujit Kumar
 
Java Web services
Java Web servicesJava Web services
Java Web servicesSujit Kumar
 

More from Sujit Kumar (20)

SFDC Database Basics
SFDC Database BasicsSFDC Database Basics
SFDC Database Basics
 
SFDC Database Security
SFDC Database SecuritySFDC Database Security
SFDC Database Security
 
SFDC Social Applications
SFDC Social ApplicationsSFDC Social Applications
SFDC Social Applications
 
SFDC Other Platform Features
SFDC Other Platform FeaturesSFDC Other Platform Features
SFDC Other Platform Features
 
SFDC Outbound Integrations
SFDC Outbound IntegrationsSFDC Outbound Integrations
SFDC Outbound Integrations
 
SFDC Inbound Integrations
SFDC Inbound IntegrationsSFDC Inbound Integrations
SFDC Inbound Integrations
 
SFDC UI - Advanced Visualforce
SFDC UI - Advanced VisualforceSFDC UI - Advanced Visualforce
SFDC UI - Advanced Visualforce
 
SFDC UI - Introduction to Visualforce
SFDC UI -  Introduction to VisualforceSFDC UI -  Introduction to Visualforce
SFDC UI - Introduction to Visualforce
 
SFDC Deployments
SFDC DeploymentsSFDC Deployments
SFDC Deployments
 
SFDC Batch Apex
SFDC Batch ApexSFDC Batch Apex
SFDC Batch Apex
 
SFDC Data Loader
SFDC Data LoaderSFDC Data Loader
SFDC Data Loader
 
SFDC Advanced Apex
SFDC Advanced Apex SFDC Advanced Apex
SFDC Advanced Apex
 
SFDC Introduction to Apex
SFDC Introduction to ApexSFDC Introduction to Apex
SFDC Introduction to Apex
 
SFDC Database Additional Features
SFDC Database Additional FeaturesSFDC Database Additional Features
SFDC Database Additional Features
 
Introduction to SalesForce
Introduction to SalesForceIntroduction to SalesForce
Introduction to SalesForce
 
More about java strings - Immutability and String Pool
More about java strings - Immutability and String PoolMore about java strings - Immutability and String Pool
More about java strings - Immutability and String Pool
 
Hibernate First and Second level caches
Hibernate First and Second level cachesHibernate First and Second level caches
Hibernate First and Second level caches
 
Java equals hashCode Contract
Java equals hashCode ContractJava equals hashCode Contract
Java equals hashCode Contract
 
Java Comparable and Comparator
Java Comparable and ComparatorJava Comparable and Comparator
Java Comparable and Comparator
 
Java Web services
Java Web servicesJava Web services
Java Web services
 

Recently uploaded

TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 

Recently uploaded (20)

TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 

Java build tools

  • 1. Java Build Tools Sujit Kumar Zenolocity LLC © 2013-2023
  • 2. Manual Development Tasks In Eclipse • • • • • • • • • Clean Code – remove all your class files Compile Code Run your application Run JUnit tests Package jars Package wars Deploy wars to an application server **** How do u automate all the above? *** Batch file on windows or Shell Scripts for Unix and Mac. Not portable.
  • 3. Available Tools for Automation • • • • ANT Maven Gradle All the above (Ant, Maven, Gradle) are portable options built on top of the JVM.
  • 4. ANT • Based on XML. • Tasks to automate nearly everything that you can do from a shell script or batch file. • You can even do procedural flow control using XML.
  • 5. Setting up ANT environment variables on Windows • set ANT_HOME=C:Userssujitdevappsapacheant-1.8.2 • set PATH=%ANT_HOME%bin;%PATH% • Verify ANT version by running: ant –version • Ant itself needs JAVA_HOME and JDK_HOME to be set.
  • 6. Set up environment variables on Unix • Add the following lines in your ~/.bashrc • export ANT_HOME={PATH_TO_PARENT_DIR_OF_ANT }/apache-ant-1.8.2 • export PATH=$ANT_HOME/bin:$PATH • Verify ANT version by running: ant -version
  • 7. ANT Core tasks Categories – Part 1 • Compile Tasks: javac, depend, jspc, apt • Execution Tasks: ant, antcall, exec, java, parallel, sequential • File Tasks: copy, delete, mkdir, move, replace, touch, chmod, chgrp, concat, • Mail Tasks: mail • SCM Tasks: Cvs, Svn, Clearcase, PVCS. • Testing Tasks: Junit, JUnitReport.
  • 8. ANT Core Task Categories – Part 2 • Property Tasks: Property, LoadProperties, XMLProperty, Dirname, Basename, Condition, Uptodate, Available, etc. • Remote Tasks: ftp, scp, telnet, etc. • Pre-process Tasks: import, include, etc. • Miscellaneous Tasks: Echo, Fail, Taskdef, Typedef, Tstamp, etc. • Archive Tasks: jar, unjar, war, unwar, zip, unzip, tar, untar, gzip, gunzip.
  • 9. Flow Control with ANT • Execute flow control logical tasks like if, for, foreach, switch, assert, trycatch, etc. • http://ant-contrib.sourceforge.net/tasks
  • 10. Maven • Software project management tool. Manage project’s build, dependencies & documentation. • Based on the concept of a project object model (POM). • Efficient dependency management by using repositories of dependent jars. • Extensible with lot of plugins in java. • Uses the Convention over configuration design pattern – minimizes code & decision making without losing flexibility.
  • 12. Simple Maven pom.xml file • <project> <modelVersion>4.0.0</modelVersion> <groupId>org.sonatype.mavenbook</groupId> <artifactId>my-project</artifactId> <version>1.0</version> • </project> • See how simple the pom xml file looks like. • Where Ant had to be explicit about the process, there was something "built-in" to Maven that just knew where the source code was and how it should be processed. • Convention over configuration reduces amount of code and configuration.
  • 13. Maven Configuration Files • • • • • JAVA_HOME where JDK is installed. Add JAVA_HOME/bin to the PATH. M2_HOME where Maven is installed. Add M2_HOME/bin to the PATH. 2 locations where a settings.xml file may live: Global: ${M2_HOME}/conf/settings.xml Local: ${HOME}/.m2/settings.xml • If both files exist, contents are merged & local overrides global.
  • 14. Maven Repositories • Local • Central • Remote
  • 15. Local Repository • Project’s dependent jars are downloaded and stored in the local repository. • Default location: {HOME_DIR}/.m2 • Change location of local repository in {M2_HOME}confsetting.xml, update localRepository to something else.
  • 16. Maven Build Life Cycle • Conventional process for building & distributing an artifact. • Defined by a list of build phases. A phase is a stage in the build process. • 3 built in build life cycles: default, clean & site. • Build phases are executed sequentially. • When a build phase is executed, it will execute not only that build phase, but also every build phase prior to the called build phase.
  • 17. Default Build Life Cycle • • • • • • • • • • • • validate: validate the project is correct and all necessary information is available. initialize: initialize build state, eg. Set properties or create directories. generate-resources: generate resources for inclusion in the package. process-resources: copy and process the resources into the destination directory. compile: compile the source code of the project. test-compile: compile the test source code of the project. test: test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed package: take the compiled code and package it in its distributable format, such as a JAR. integration-test: process and deploy the package if necessary into an environment where integration tests can be run verify: run any checks to verify the package is valid and meets quality criteria install: install the package into the local repository, for use as a dependency in other projects locally deploy: done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
  • 18. Life Cycle Reference • List in the previous slide not a complete list. • Full list available here: • https://maven.apache.org/guides/introductio n/introduction-to-thelifecycle.html#Lifecycle_Reference
  • 19. Maven Goals & Phases • Goals are executed in phases which helps determine the order goals get executed in. • Compile phase goals will always be executed before the Test phase goals which will always be executed before the Package phase goals and so on. • When you create a plugin execution in your Maven build file and you only specify the goal then it will bind that goal to a given default phase. For example, the jaxb:xjc goal binds by default to the generate-resources phase. However, when you specify the execution you can also explicitly specify the phase for that goal as well. • If you specify a goal when you execute Maven then it will still run all phases up to the phase for that goal. In other words, if you specify the jar goal it will run all phases up to the package phase (and all goals in those phases), and then it will run the jar goal.
  • 20. Differences between ANT and Maven – part 1 • Ant doesn't have formal conventions like a common project directory structure. You have to tell Ant exactly where to find the source and where to put the output. Informal conventions have emerged over time, but they haven't been codified into the product. • Ant is procedural, you have to tell Ant exactly what to do and when to do it. You had to tell it to compile, then copy, then compress. • Ant doesn't have a lifecycle, you have to define goals and goal dependencies. You have to attach a sequence of tasks to each goal manually.
  • 21. Differences between ANT and Maven – part 2 • Maven has conventions, it knows where your source code is because you followed the convention. It puts the byte code in target/classes, and it created a JAR file in target. • Maven is declarative. All you had to do was create a pom.xml file and put your source in the default directory. Maven took care of the rest. • Maven has a lifecycle, which you invoked when you executed “mvn” install. This command tells Maven to execute a sequence of steps until it reached the lifecycle. As a side-effect of this journey through the lifecycle, Maven executed a number of default plugin goals which did things like compile and create a JAR.
  • 22. Differences between ANT and Mavenpart 3 • Maven has intelligence about common project tasks. To run tests, simple execute mvn test, as long as the files are in the default location. In Ant, you would first have to specify the location of the JUnit JAR file, then create a classpath that includes the JUnit JAR, then tell Ant where it should look for test source code, write a goal that compiles the test source and then finally execute the unit tests with JUnit.
  • 23. Comparison with Gradle • http://xpanxionsoftware.wordpress.com/2012 /05/11/ant-maven-and-gradle-a-side-by-sidecomparison/