Wrox Programmer Forums
|
BOOK: Professional Java Tools for Extreme Programming
This is the forum to discuss the Wrox book Professional Java Tools for Extreme Programming: Ant, XDoclet, JUnit, Cactus,and Maven by Richard Hightower, Warner Onstine, Paul Visan, Damon Payne, Joseph D. Gradecki, Kate Rhodes, Robert Watkins, Erik Meade; ISBN: 9780764556173
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Java Tools for Extreme Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2017, 07:31 AM
Authorized User
 
Join Date: Mar 2012
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 30/putting it all together

Hi authors

The java program viz.ChapterAntProject.java shown in the page 582 seems to be having some errors since the code after compilation ok.does not create a build.xml as indicated.The codes are shown for your correction

Code:
package  org.apache.tools.ant;
import java.util.ArrayList;

import java.lang.String;
import java.lang.Class;
import org.apache.tools.ant.listener.Log4jListener;
import org.apache.tools.ant.Project;

import org.apache.tools.ant.util.SourceFileScanner;
import org.apache.tools.ant.Launcher;

import org.apache.tools.ant.Target;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Main;
import org.apache.tools.ant.XmlLogger;
import org.apache.tools.ant.AntClassLoader;

public class  ChapterAntProject extends  org.apache.tools.ant.Project{

 public void ChapterAntProjectinit()
    {
      super.init();
         }
    

public static  void main(String[] args)
{


ChapterAntProject  proj1=new ChapterAntProject();
Project  proj=new Project();



try
{
/*
Create the project object and add custom tag
*/
proj.setName("jomsproject");
GreetJon task=new GreetJon();
proj.addTaskDefinition("jonstask",task.getClass());
/*
create the Target Object as a child ofparent and addthe Task to it
*/

Target  targ=new Target(); 
  targ.setName("jonstarget");
  targ.addTask(task);
  proj.addTarget("jonstarget" , targ);
  proj.setDefaultTarget("jonstarget");
  /*
  Execute the Target
  */
  proj.executeTarget("jonstarget");
  }
  catch(Exception e)
  {

  };
  }
  }
  
  
  
  
  class GreetJon extends Task{
  
  public GreetJon(){
  ;}
  public void execte() throws  BuildException{
  System.out.println("Hello ");
  }
  }
***********************************
Error: Could not find or load main class org.apache.tools.ant.ChapterAntProject

****************************************
Shall be thankful if the same is corrected to produce results
Thanks
Cheers
muthukutta1





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 30: Report Custom Code - SqlConnection - Unable to Open Database fbuxo BOOK: Professional Visual Studio 2010 0 March 28th, 2013 11:49 AM
Chapter 30 questions and Issues Arkay_Mann BOOK: Professional Visual Studio 2010 15 June 6th, 2012 03:42 PM
Data Management Chapter Listing 8-30 jayeshsatam BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 July 2nd, 2010 01:25 PM
8-30 DataSet ralphbethke BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 0 July 9th, 2009 09:45 AM
Chapter 30, Registering Component Services slginps BOOK: Professional Visual Basic 2008 ISBN: 978-0-470-19136-1 1 April 25th, 2009 01:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.