Using Ant in Eclipse Dwight Deugo Nesa Matic

Slides:



Advertisements
Similar presentations
© Paradigm Publishing, Inc Excel 2013 Level 2 Unit 2Managing and Integrating Data and the Excel Environment Chapter 7Automating Repetitive Tasks.
Advertisements

Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
ANT: Another Nice Tool Ali Beyad October 1, 2003.
ANT – Another Neat Tool Representation and Management of Data on the Internet.
ANT: Another Nice Tool Ali Beyad October 1, 2003.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Eclipse Architecture Dwight Deugo Nesa Matic
1 Ant – Another Neat Tool Representation and Management of Data on the Internet.
CSC 395 – Software Engineering Lecture 24: Apache Ant –or– Programming the results of programming Based upon a talk by Anthony Wat.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Fall 2007CS 2251 Programming Tools Eclipse JUnit Testing make and ant.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Java Development Tools project.
Eclipse Introduction Dwight Deugo Nesa Matic
Eclipse Introduction Dwight Deugo Nesa Matic
Customizing Outlook. Forms Window in which you enter and view information in Outlook Outlook Form Designer The environment in which you create and customize.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Views Dwight Deugo Nesa Matic
Creating a Console Application with Visual Studio
Using Ant to build J2EE Applications Kumar
Customizing Microsoft Project
A First Program Using C#
Computer Literacy BASICS: A Comprehensive Guide to IC 3, 5 th Edition Lesson 3 Windows File Management 1 Morrison / Wells / Ruffolo.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Apache Ant Java-Based Build Tool. Making your builds boring… Building projects should be easy and standardized. You should not be spending a substantial.
Workbench Overview Dwight Deugo Nesa Matic
Microsoft Office Word 2013 Expert Microsoft Office Word 2013 Expert Courseware # 3251 Lesson 3: Customizing Document Elements.
Research & Learning For Libraries and Patrons that need to stay Ahead of the Learning Curve Presenter Name Here Books24x7® for Libraries.
Renesas Technology America Inc. 1 SKP8CMINI Tutorial 2 Creating A New Project Using HEW.
XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Debugging Dwight Deugo Nesa Matic
Dreamweaver MX. 2 Overview of Templates n Templates represent a web page design or _______ that will be common to multiple pages. n There are two situations.
Active-HDL Interfaces Debugging C Code Course 10.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
July 2011CMSC 341 CVS/Ant 1 CMSC 341 Java Packages Ant CVS Project Submission.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
9/2/ CS171 -Math & Computer Science Department at Emory University.
Ant Presentation by: Bart Taylor. What is Ant? The simple definition: A Java-based build tool The Official Definition: “Apache Ant is a Java-based build.
Ant & Jar Ant – Java-based build tool Jar – pkzip archive, that contains metadata (a manifest file) that the JRE understands.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Liferay Installation Prepared by: Do Xuan Hai 8 August 2011.
JUnit Dwight Deugo Nesa Matic
Javadoc Dwight Deugo Nesa Matic
Live and Learn – ant. Resources  Ant User Manual  Skip the book, most of the material is right here  Apache.
Chapter 3 Understanding Ant datatypes and properties.
®® Microsoft Windows 7 for Power Users Tutorial 3 Managing Folders and Files.
Chapter 1 Introducing Ant. What is ant? Ant is a build tool  Automate the tasks of compiling code, running test, and packaging the results for redistribution.
Computer Literacy BASICS: A Comprehensive Guide to IC 3, 5 th Edition Lesson 3 Windows File Management 1 Morrison / Wells / Ruffolo.
Introduction to Eclipse Programming with an Integrated Development Environment.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
® IBM Software Group © 2006 IBM Corporation Rational Asset Manager v7.2 Using Scripting Tutorial for using command line and scripting using Ant Tasks Carlos.
New Project Model UI Primary Author: Mikhail Sennikovsky Major contributors: Mikhail Voronin, Oleg Krasilnikov, Leo Treggiari Intel Corporation September,
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security.
Software Development Tools COMP220 Seb Coope Ant: Datatypes and Properties These slides are mainly based on “Java Development with Ant” - E. Hatcher &
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
SG Introduction to ANT scmGalaxy Author: Rajesh Kumar
Java IDE Dwight Deugo Nesa Matic
An Introduction to Ant. What is Ant? How do you use it? Why would you want to?
C Copyright © 2009, Oracle. All rights reserved. Using SQL Developer.
Business rules.
Ant.
Nilanjan Banerjee Java Packages Ant CVS Project Submission
Using Templates and Library Items
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Presentation transcript:

Using Ant in Eclipse Dwight Deugo Nesa Matic

2 © , Espirity Inc. Additional Contributors None as of September, 2004

3 © , Espirity Inc. Module Overview 1.What is Ant? 2.Ant Build File 3.Running Ant

4 © , Espirity Inc. Module Road Map 1.What is Ant?  Goals  Motivation  Terminology 2.Build File 3.Running Ant

5 © , Espirity Inc. What is Ant? Ant is an open source project   Java-based build tool  Used on any Java 1.1+ system  Command line driven  Integrated with IDEs  Uses XML files to describe the build process

6 © , Espirity Inc. Ant’s Design Goals Simple to use Easy to understand Can be extended

7 © , Espirity Inc. Ant Motivation Build, test and deploy Java Projects Workflow engine Web publishing engine Support.Net and other languages Automation

8 © , Espirity Inc. Projects and Properties Project  Defines one or more targets and any number of properties Property  A property has a name and a value  Ant has built-in properties

9 © , Espirity Inc. Targets and Tasks Target  Defines a sequence or block of tasks to execute Task defines the actual commands that Ant executes  Core Tasks: tasks shipped with Ant  Optional Tasks: a task from a third party that require an additional JAR  User-Defined Tasks: tasks developed by the user

10 © , Espirity Inc. PatternSet Datatype Filter files or directories using a pattern  * match >= 0 characters  ** match >= 0 directories recursively  ? match 1 character Get all java files except those with broken in the name

11 © , Espirity Inc. Fileset Datatype Groups files based on patterns Different forms  Using attributes  Using nested patternset  Using patternset elements

12 © , Espirity Inc. Other Datatypes Description – project description DirSet – directory set FileMapper – filename translation FileReader – call to filter out files FilterChain – series of FilterReaders Filterset – filter groups..

13 © , Espirity Inc. Module Road Map 1.What is Ant 2.Ant Build File  Conceptual build file  Real build file  Properties 3.Running Ant

14 © , Espirity Inc. Conceptual Project Build File YourProject: Project initialize: Target : Task compile: Target : Task deploy: Target : Task document: Target : Task

15 © , Espirity Inc. Real Build File… <jar destfile="bin/myproject.jar" basedir="build/classes" />

16 © , Espirity Inc. <java classname="FirstClass" classpath="build/classes"> …Real Build File

17 © , Espirity Inc. Important Tags: Attributes  default : the default target to run  name : the name of the project  basedir : the base directory of the project  description : a description of the project <project name=“MYPROJECT" default="compile" basedir=". " description="This is a demo project">

18 © , Espirity Inc. Important Tags: Container tag for tasks Attributes  name : the name of the target  depends : dependent targets  if : execute only if property is set  unless : execute only if property is not set  description : description of the target <target name="compile" depends="init" description="Compile everything">

19 © , Espirity Inc. Important Tags: The tag reads the build number from a file and sets the property build.number Attributes  file : the name of the file with the build number

20 © , Espirity Inc. Important Tags: Copy a file or set of files Attributes  file : source file  tofile : target file  todir : target directory  overwrite : boolean to overwrite destination files (f)  includeEmptyDirs : boolean to copy empty directories(t)  failonerror : stop if file not found (t)  verbose : list files copied (f)

21 © , Espirity Inc. Important Tags: Delete a file or set of files Attributes  file : file to delete  dir : directory to delete  includeEmptyDirs : delete empty directories(t)  failonerror : stop on error (t)  verbose : list files deleted (f)

22 © , Espirity Inc. Important Tags: Create a directory Attributes  dir : the name of the directory to create

23 © , Espirity Inc. Important Tags: Write a message to System.out Attributes  message : text to write  file : output file  append : append rather than overwrite a file Time to go

24 © , Espirity Inc. Important Tags: Make a jar file Attributes  destfile : the JAR file name  basedir : directory of files to be JARed  includes : pattern of files to be JARed  excludes : patterns of files to be excluded

25 © , Espirity Inc. Important Tags: Execute a java class Attributes  classname : the name of class to run  jar : name of JAR containing the class  classpath : classpath to use  fork : run the class in a new VM  failonerror : stop if error occurs  output : output file  append : append or overwrite default file

26 © , Espirity Inc. Important Tags: Compile a java file or set of files Attributes  srcdir: base of source tree  destdir: output directory  includes: pattern of files to compile  excludes: pattern of files to exclude  classpath: classpath to use  debug: include debug information  optimize: use optimization  verbose: provide verbose output  failonerror: stop on error

27 © , Espirity Inc. Important Tags: … Name-value pair Predefined properties  java.class.pat  os.name  os.version  user.name  user.home  ant.version  ant.file  ant.project.name

28 © , Espirity Inc. …Important Tags: … Attributes  name : name of property  value : value of property Use properties as follows #setting

29 © , Espirity Inc. …Important Tags: Property file  Create a file build.properties  Use standard Java properties file format  Read property file as follows # build.properties report_name=report.txt report_location=C:/reportdir

30 © , Espirity Inc. Module Road Map 1.What is Ant? 2.Ant Build File 3.Running Ant  Running the build file  Modifying the classpath  Adding new tasks and types  Using a different version of Ant

31 © , Espirity Inc. Running an Ant Build File In the Navigator view, select an XML file From the file's pop-up menu, select Run Ant

32 © , Espirity Inc. Select Targets Select one or more targets from the Targets tab  Targets are run in order of selection  Order displayed in the Target execution order box at the bottom of the tab  Change the order of the targets by clicking the Order... button

33 © , Espirity Inc. Run the Build File Click Run to run Ant buildfile on the selected targets Console displays execution results

34 © , Espirity Inc. Ant Configuration Previous steps create a persisted launch configuration The configuration will appear in the launch history under Run  External Tools Configuration is available in the launch configuration dialog which is opened by clicking Run  External Tools  External Tools….

35 © , Espirity Inc. Updating Configuration Update targets under the target tab in the configuration window Run configuration again

36 © , Espirity Inc. Ant Classpath… Used to add extra libraries to the classpath  When using optional or custom tasks  Classpath can be modified globally or per launch configuration To modify the Ant classpath globally:  Click Window  Preferences  Expand Ant and select Runtime  If you are not on it already, click the Classpath tab

37 © , Espirity Inc. Modifying Ant Classpath… To modify the Ant classpath for a launch configuration:  Click Run -> External Tools -> External Tools...  Select the Ant configuration whose classpath you wish to modify  Select the Classpath tab  Uncheck the option to use the global classpath as specified in the preferences

38 © , Espirity Inc. …Modifying Ant Classpath To add a JAR file to the classpath:  Click Add Jar  Select the JAR file To add a folder to the classpath:  Click Add Folder  Select the folder To remove an item from the classpath:  Select the item  Click Remove To restore the classpath to the default:  Click Restore Defaults

39 © , Espirity Inc. Adding New Tasks and Types Click Window -> Preferences  Expand Ant and select Runtime  Click the Tasks tab or the Types tab  Click Add Task or Add Type  Provide a name and class for the task or type  Select the library where the task or type is declared  If the library is not present on the list, you must add it to the Ant classpath first

40 © , Espirity Inc. Using a Different Version of Ant Ant looks for the necessary classes on the Ant classpath  Classpath identifies the plug- ins contributing new tasks, types or libraries Ant requires JAR files:  ant.jar  optional.jar Remove these JARs and add the new ones To restore the Ant classpath to its original state, click Restore Defaults button on the properties page

41 © , Espirity Inc. Module Summary In this module we have:  Learned what Ant is and what it is used for  Described Ant build file and how to execute it  Described Ant’s integration with Eclipse

42 © , Espirity Inc. Labs Slide! Lab: Using Ant