DOC PREVIEW
CMU ISM 95702 - Lecture

This preview shows page 1-2-21-22 out of 22 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 2A Introduction to ANTPowerPoint Presentation“Hello World” In AntUsing Ant with EclipseJava Example build.xmlMyJava.javaAnt ExecutionAnother Java Example build.xmlSomeCoolClass.javaSlide 10build.xmlbuild.xml (Continued)Slide 13Same Example Different build.xmlSlide 15Ant Example from “Ant The Definitive Guide” O’reillyInitial LayoutAfter ant allAfter ant all (continued)Slide 20Slide 21Slide 22195-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Lecture 2A Introduction to ANT• Written by James Duncan Davidson.• Like GNU Make but specifically for Java.• Good for bundling and delivery of groups of classes, jars, wars.• Handles dependencies automatically.• Written in XML. • Works on Unix or Windows.• Available from Apache.org.• Built in to Eclipse.295-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Ant Concepts•Exactly on project element is required.•There may be many properties, targets and tasks.•At least on target is required.•Targets describe broad goals.•Tasks are nested within targets.•Over 100 core tasks available (e.g. mkdir, javac).•Properties are name-value pairs.•Ant interprets the build file with a breadth first traversal across the XML elements under project•Inside a target, Ant performs a depth first traversal.•By default, Ant breaks at the first error.395-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.“Hello World” In Ant<?xml version="1.0" encoding="UTF-8"?><project name="Hello OCT" default = "Both" basedir ="."><property name = "HelloText" value="Hello"/><property name = "HelloOCT" value="OCT"/><target name="Hello"><echo>${HelloText}</echo></target><target name = "OCT"> <echo>${HelloOCT}</echo></target><target name ="Both" depends = "Hello,OCT"/></project>495-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Using Ant with EclipseCreate a Workspace and a Project.Right click the project and select new file.Enter text for build.xml.Save.Right click the file and run as Ant build.595-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Java Example build.xml<?xml version="1.0"?><project basedir="." default="run"> <target name="compile"> <javac srcdir="." destdir="." classpath=".” /> </target> <target name="run" depends="compile"> <java classname="MyJava" /> </target></project>695-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.MyJava.javapublic class MyJava { public static void main(String a[]) { System.out.println("Hello world"); }}795-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Ant ExecutionD:\McCarthy\www\95-733\examples\ant2>antBuildfile: build.xmlcompile: [javac] Compiling 1 source file to D:\McCarthy\www\95-733 \examples\ant2run: [java] Hello worldBUILD SUCCESSFULTotal time: 17 seconds895-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Another Java Example build.xmlexamples | --- antdir | | | --- SomeCoolClass.class | --- SomeCoolClass.java --- ant2 | --- build.xml --- MyClass.javaThe build file needs tocompile MyClass.javaand needs SomeCoolClassin its classpath.995-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.SomeCoolClass.javaD:\McCarthy\www\95-733\examples\antdir>type SomeCoolClass.javapublic class SomeCoolClass { int x; public SomeCoolClass() { x = 3; } public int getX() { return x; }}1095-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.MyJava.javaD:\McCarthy\www\95-733\examples\ant2>type MyJava.javapublic class MyJava { public static void main(String a[]) { SomeCoolClass p = new SomeCoolClass(); System.out.println("Hello world x == " + p.getX()); }}1195-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.build.xmlD:\McCarthy\www\95-733\examples\ant2>type build.xml<?xml version="1.0"?><project basedir="." default="run"> <target name="compile"> <javac srcdir="." destdir="." > <classpath> <pathelement path="../antdir/"/> <pathelement path="."/> </classpath> </javac> </target>1295-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.build.xml (Continued) <target name="run" depends="compile"> <java classname="MyJava"> <classpath> <pathelement path="../antdir/"/> <pathelement path="."/> </classpath> </java> </target></project>1395-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Ant ExecutionD:\McCarthy\www\95-733\examples\ant2>antBuildfile: build.xmlcompile:run: [java] Hello world x == 3BUILD SUCCESSFULTotal time: 3 seconds1495-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Same Example Different build.xml<?xml version="1.0"?><project basedir="." default="run"> <path id="project.class.path"> <pathelement path="."/> <pathelement path="../antdir/"/> </path> <target name="compile"> <javac srcdir="." destdir="." > <classpath refid="project.class.path"/> </javac> </target>1595-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.<target name="run" depends="compile"> <java classname="MyJava"> <classpath refid="project.class.path"/> </java> </target></project>1695-702 OCT Information Systems ManagementQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Ant Example from “Ant The Definitive Guide”


View Full Document

CMU ISM 95702 - Lecture

Documents in this Course
Homework

Homework

12 pages

Lecture

Lecture

25 pages

Lecture

Lecture

21 pages

Lecture

Lecture

24 pages

Exam

Exam

11 pages

Homework

Homework

16 pages

Homework

Homework

38 pages

lecture

lecture

38 pages

review

review

7 pages

lecture

lecture

18 pages

review

review

8 pages

Chapter2

Chapter2

32 pages

Lecture 4

Lecture 4

47 pages

Naming

Naming

26 pages

lecture

lecture

34 pages

lecture

lecture

42 pages

lecture

lecture

112 pages

Lecture

Lecture

33 pages

Axis

Axis

43 pages

lecture

lecture

32 pages

review

review

17 pages

Lecture

Lecture

53 pages

Lecture

Lecture

80 pages

Lab

Lab

14 pages

Load more
Download Lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?