SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Ali Bahu
12/24/2012
APACHE ANT
INTRODUCTION
 A build tool can be used to automate certain repetitive tasks for
example compiling source code, running software tests and
creating files and documentation for the software deployment.
 Build tools typically run without a graphical user interface.
 Popular build tools used by Java developers are Apache Ant and
Maven.
APACHE ANT OVERVIEW
 Apache Ant (Ant) is a general purpose build tool. Ant is an abbreviation for
“Another Neat Tool”.
 Ant is primarily used for building and deploying Java projects.
 A Java build process typically includes:
 the compilation of the Java source code into Java bytecode
 creation of the .jar file for the distribution of the code
 creation of the Javadoc documentation
 Ant uses an xml file for its configuration. This file is usually called build.xml.
Ant builds are based on three blocks: tasks, targets and extension points.
 A task is a unit of work which should be performed and are small, atomic
steps, for example compile source code or create Javadoc. Tasks can be
grouped into targets.
 A target can be directly invoked via Ant. Targets can specify their
dependencies. Ant will automatically execute dependent targets. For example
if target A depends on B, than Ant will first perform B and then A. You can
specify the default target in your build.xml file. Ant will execute this target, if
no explicit target is specified.
HOW TO USE APACHE ANT
 Create a Java Project called com.fedex.build.ant.first in Eclipses.
Create a package called test.
package test;
public class MyTest
{
public int multi(int number1, int number2)
{
return number1 * number2;
}
}
package test;
import test.MyTest;
public class Main
{
public static void main(String[] args) {
MyTest test = new MyTest();
System.out.println("Result is: " + test.multi(5,
10));
}
}
CREATE BUILD.XML FILE & RUN FROM
ECLIPSE
 Click on the build.xml file to review and understand it.
 Running from Eclipse i.e.
 Running From Command Line:
Open a command line and switch
to your project directory. Type in
"ant" or "ant -f build.xml" to start
the build process.
APACHE ANT CLASSPATH
 Ant also allows to create classpath containers and use them in
tasks. The following build_classpath.xml from a project called
com.fedex.build.ant.classpath demonstrates this concept:
 To print the classpath for debugging:
<!-- Write the classpath to the console. Helpful for debugging -->
<!-- Create one line per classpath element-->
<pathconvert pathsep="${line.separator}" property="echo.classpath" refid="junit.class.path">
</pathconvert>
<!-- Write the result to the console -->
<echo message="The following classpath is associated with junit.class.path" />
<echo message="${echo.classpath}" />
RUNNING JUNITS VIA ANT
 Ant allows to run JUnit tests. Ant defines JUnit task. You only need to
include the junit.jar and the compiled classes into the classpath for
Ant and then you can run JUnit tests. Below is an example:
 You can run this JUnit unit test via the following build_junit.xml. This
example assumes that the JUnit jar "junit.jar" is located in “lib” folder.
package test;
import math.MyMath;
import org.junit.Test;
import static
org.junit.Assert.assertEquals;
public class MyMathTest {
@Test
public void testMulti() {
MyMath math = new MyMath();
assertEquals(50, math.multi(5, 10));
}
}
ANT TIPS
 Eclipse has an ant editor which make the editing of ant file very easy by
providing syntax checking of the build file. Eclipse has also a ant view. In this
view you execute ant files via double-clicking on the target.
 Apache Ant allows to convert relative paths to absolute paths i.e.
<property name="my.config" value="../my-config.xml"/>
<makeurl file="${my.config}" property="my.config.url"/>
 Ant can be used to replace text based on regular expressions i.e.
<target name="regular-expressions">
<!-- Replace tabs with two spaces -->
<replaceregexp flags="gs">
<regexp pattern="(t)" />
<substitution expression=" " />
<fileset dir="${outputtmp.dir}/">
<include name="**/*" /> </fileset>
</replaceregexp>
</target>

Weitere ähnliche Inhalte

Was ist angesagt?

EclipseMAT
EclipseMATEclipseMAT
EclipseMATAli Bahu
 
Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Matthew McCullough
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architectureondrejbalas
 
Introduction To Ant1
Introduction To  Ant1Introduction To  Ant1
Introduction To Ant1Rajesh Kumar
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat ToolKanika2885
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingDougal Campbell
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 
Django Introduction & Tutorial
Django Introduction & TutorialDjango Introduction & Tutorial
Django Introduction & Tutorial之宇 趙
 
Web develop in flask
Web develop in flaskWeb develop in flask
Web develop in flaskJim Yeh
 
Building a Dynamic Website Using Django
Building a Dynamic Website Using DjangoBuilding a Dynamic Website Using Django
Building a Dynamic Website Using DjangoNathan Eror
 
Django for Beginners
Django for BeginnersDjango for Beginners
Django for BeginnersJason Davies
 
Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Robert Munteanu
 
RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversBrian Gesiak
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Djangocolinkingswood
 

Was ist angesagt? (19)

EclipseMAT
EclipseMATEclipseMAT
EclipseMAT
 
Apache ant
Apache antApache ant
Apache ant
 
Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3Mastering Maven 2.0 In 1 Hour V1.3
Mastering Maven 2.0 In 1 Hour V1.3
 
Ant tutorial
Ant tutorialAnt tutorial
Ant tutorial
 
Maven 3.0 at Øredev
Maven 3.0 at ØredevMaven 3.0 at Øredev
Maven 3.0 at Øredev
 
Creating a Plug-In Architecture
Creating a Plug-In ArchitectureCreating a Plug-In Architecture
Creating a Plug-In Architecture
 
Introduction To Ant1
Introduction To  Ant1Introduction To  Ant1
Introduction To Ant1
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat Tool
 
dJango
dJangodJango
dJango
 
Deploy Flex with Apache Ant
Deploy Flex with Apache AntDeploy Flex with Apache Ant
Deploy Flex with Apache Ant
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
Django Introduction & Tutorial
Django Introduction & TutorialDjango Introduction & Tutorial
Django Introduction & Tutorial
 
Web develop in flask
Web develop in flaskWeb develop in flask
Web develop in flask
 
Building a Dynamic Website Using Django
Building a Dynamic Website Using DjangoBuilding a Dynamic Website Using Django
Building a Dynamic Website Using Django
 
Django for Beginners
Django for BeginnersDjango for Beginners
Django for Beginners
 
Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...
 
RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the Covers
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 

Andere mochten auch

Apache ANT vs Apache Maven
Apache ANT vs Apache MavenApache ANT vs Apache Maven
Apache ANT vs Apache MavenMudit Gupta
 
Apache Ant
Apache AntApache Ant
Apache Antteejug
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basicsWalid Ashraf
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and AntDavid Noble
 
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native MiddlewareTrends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native MiddlewareKai Wähner
 
Blockchain + Streaming Analytics with Ethereum and TIBCO StreamBase
Blockchain + Streaming Analytics with Ethereum and TIBCO StreamBase Blockchain + Streaming Analytics with Ethereum and TIBCO StreamBase
Blockchain + Streaming Analytics with Ethereum and TIBCO StreamBase Kai Wähner
 
Flogo - A Golang-powered Open Source IoT Integration Framework (Gophercon)
Flogo - A Golang-powered Open Source IoT Integration Framework (Gophercon)Flogo - A Golang-powered Open Source IoT Integration Framework (Gophercon)
Flogo - A Golang-powered Open Source IoT Integration Framework (Gophercon)Kai Wähner
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with dockerRuoshi Ling
 
Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker, Inc.
 

Andere mochten auch (16)

ANT
ANTANT
ANT
 
Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
 
Apache ANT vs Apache Maven
Apache ANT vs Apache MavenApache ANT vs Apache Maven
Apache ANT vs Apache Maven
 
Manen Ant SVN
Manen Ant SVNManen Ant SVN
Manen Ant SVN
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
docker installation and basics
docker installation and basicsdocker installation and basics
docker installation and basics
 
Apache ANT
Apache ANTApache ANT
Apache ANT
 
Java Builds with Maven and Ant
Java Builds with Maven and AntJava Builds with Maven and Ant
Java Builds with Maven and Ant
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native MiddlewareTrends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
 
Blockchain + Streaming Analytics with Ethereum and TIBCO StreamBase
Blockchain + Streaming Analytics with Ethereum and TIBCO StreamBase Blockchain + Streaming Analytics with Ethereum and TIBCO StreamBase
Blockchain + Streaming Analytics with Ethereum and TIBCO StreamBase
 
Flogo - A Golang-powered Open Source IoT Integration Framework (Gophercon)
Flogo - A Golang-powered Open Source IoT Integration Framework (Gophercon)Flogo - A Golang-powered Open Source IoT Integration Framework (Gophercon)
Flogo - A Golang-powered Open Source IoT Integration Framework (Gophercon)
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with docker
 
Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016
 

Ähnlich wie Apache Ant

Comparative Development Methodologies
Comparative Development MethodologiesComparative Development Methodologies
Comparative Development Methodologieselliando dias
 
Junit and cactus
Junit and cactusJunit and cactus
Junit and cactusHimanshu
 
Testing Options in Java
Testing Options in JavaTesting Options in Java
Testing Options in JavaMichael Fons
 
Maven and j unit introduction
Maven and j unit introductionMaven and j unit introduction
Maven and j unit introductionSergii Fesenko
 
Jack borden jb471909_junit1
Jack borden jb471909_junit1Jack borden jb471909_junit1
Jack borden jb471909_junit1jborden33
 
Jack borden jb471909_junit
Jack borden jb471909_junitJack borden jb471909_junit
Jack borden jb471909_junitjborden33
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1sotlsoc
 
Unit Testing RPG with JUnit
Unit Testing RPG with JUnitUnit Testing RPG with JUnit
Unit Testing RPG with JUnitGreg.Helton
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCFAKHRUN NISHA
 
Integrate UFT with Jenkins Guide
Integrate UFT with Jenkins GuideIntegrate UFT with Jenkins Guide
Integrate UFT with Jenkins GuideYu Tao Zhang
 
J unit presentation
J unit presentationJ unit presentation
J unit presentationPriya Sharma
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and DebuggingRich Helton
 
Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015Buşra Deniz, CSM
 

Ähnlich wie Apache Ant (20)

Comparative Development Methodologies
Comparative Development MethodologiesComparative Development Methodologies
Comparative Development Methodologies
 
Java ant tutorial
Java ant tutorialJava ant tutorial
Java ant tutorial
 
Database Management Assignment Help
Database Management Assignment Help Database Management Assignment Help
Database Management Assignment Help
 
Junit and cactus
Junit and cactusJunit and cactus
Junit and cactus
 
N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
 
8-testing.pptx
8-testing.pptx8-testing.pptx
8-testing.pptx
 
Testing Options in Java
Testing Options in JavaTesting Options in Java
Testing Options in Java
 
Maven and j unit introduction
Maven and j unit introductionMaven and j unit introduction
Maven and j unit introduction
 
Jack borden jb471909_junit1
Jack borden jb471909_junit1Jack borden jb471909_junit1
Jack borden jb471909_junit1
 
Jack borden jb471909_junit
Jack borden jb471909_junitJack borden jb471909_junit
Jack borden jb471909_junit
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
 
Unit Testing RPG with JUnit
Unit Testing RPG with JUnitUnit Testing RPG with JUnit
Unit Testing RPG with JUnit
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Integrate UFT with Jenkins Guide
Integrate UFT with Jenkins GuideIntegrate UFT with Jenkins Guide
Integrate UFT with Jenkins Guide
 
J unit presentation
J unit presentationJ unit presentation
J unit presentation
 
JUnit Presentation
JUnit PresentationJUnit Presentation
JUnit Presentation
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and Debugging
 
Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015Unit Testing on Android - Droidcon Berlin 2015
Unit Testing on Android - Droidcon Berlin 2015
 
Junit and testNG
Junit and testNGJunit and testNG
Junit and testNG
 

Kürzlich hochgeladen

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Kürzlich hochgeladen (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

Apache Ant

  • 2. INTRODUCTION  A build tool can be used to automate certain repetitive tasks for example compiling source code, running software tests and creating files and documentation for the software deployment.  Build tools typically run without a graphical user interface.  Popular build tools used by Java developers are Apache Ant and Maven.
  • 3. APACHE ANT OVERVIEW  Apache Ant (Ant) is a general purpose build tool. Ant is an abbreviation for “Another Neat Tool”.  Ant is primarily used for building and deploying Java projects.  A Java build process typically includes:  the compilation of the Java source code into Java bytecode  creation of the .jar file for the distribution of the code  creation of the Javadoc documentation  Ant uses an xml file for its configuration. This file is usually called build.xml. Ant builds are based on three blocks: tasks, targets and extension points.  A task is a unit of work which should be performed and are small, atomic steps, for example compile source code or create Javadoc. Tasks can be grouped into targets.  A target can be directly invoked via Ant. Targets can specify their dependencies. Ant will automatically execute dependent targets. For example if target A depends on B, than Ant will first perform B and then A. You can specify the default target in your build.xml file. Ant will execute this target, if no explicit target is specified.
  • 4. HOW TO USE APACHE ANT  Create a Java Project called com.fedex.build.ant.first in Eclipses. Create a package called test. package test; public class MyTest { public int multi(int number1, int number2) { return number1 * number2; } } package test; import test.MyTest; public class Main { public static void main(String[] args) { MyTest test = new MyTest(); System.out.println("Result is: " + test.multi(5, 10)); } }
  • 5. CREATE BUILD.XML FILE & RUN FROM ECLIPSE  Click on the build.xml file to review and understand it.  Running from Eclipse i.e.  Running From Command Line: Open a command line and switch to your project directory. Type in "ant" or "ant -f build.xml" to start the build process.
  • 6. APACHE ANT CLASSPATH  Ant also allows to create classpath containers and use them in tasks. The following build_classpath.xml from a project called com.fedex.build.ant.classpath demonstrates this concept:  To print the classpath for debugging: <!-- Write the classpath to the console. Helpful for debugging --> <!-- Create one line per classpath element--> <pathconvert pathsep="${line.separator}" property="echo.classpath" refid="junit.class.path"> </pathconvert> <!-- Write the result to the console --> <echo message="The following classpath is associated with junit.class.path" /> <echo message="${echo.classpath}" />
  • 7. RUNNING JUNITS VIA ANT  Ant allows to run JUnit tests. Ant defines JUnit task. You only need to include the junit.jar and the compiled classes into the classpath for Ant and then you can run JUnit tests. Below is an example:  You can run this JUnit unit test via the following build_junit.xml. This example assumes that the JUnit jar "junit.jar" is located in “lib” folder. package test; import math.MyMath; import org.junit.Test; import static org.junit.Assert.assertEquals; public class MyMathTest { @Test public void testMulti() { MyMath math = new MyMath(); assertEquals(50, math.multi(5, 10)); } }
  • 8. ANT TIPS  Eclipse has an ant editor which make the editing of ant file very easy by providing syntax checking of the build file. Eclipse has also a ant view. In this view you execute ant files via double-clicking on the target.  Apache Ant allows to convert relative paths to absolute paths i.e. <property name="my.config" value="../my-config.xml"/> <makeurl file="${my.config}" property="my.config.url"/>  Ant can be used to replace text based on regular expressions i.e. <target name="regular-expressions"> <!-- Replace tabs with two spaces --> <replaceregexp flags="gs"> <regexp pattern="(t)" /> <substitution expression=" " /> <fileset dir="${outputtmp.dir}/"> <include name="**/*" /> </fileset> </replaceregexp> </target>