ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob (Global Trade)" <Rob.Ander...@nike.com>
Subject RE: Taskdef
Date Tue, 16 May 2006 15:53:25 GMT
I'm not sure what you are trying to do with this code, or what the
context is. Where are you wrong? To start with, you have hardcoded a lot
of things into your code. Are you trying to write java code to use the
API rather than writing a build.xml?

-Rob A

> -----Original Message-----
> From: subir bhaumik [mailto:subir_05@yahoo.co.in] 
> Sent: Tuesday, May 16, 2006 6:44 AM
> To: user@ant.apache.org
> Subject: Taskdef
> 
> Hi
>       While i am executing the following the   method  
> setClasspath  of  Taskdef getting   NullPointerException, But 
> the same  method for Javac is O.K.
>   
>   Where i am wrong?
>   
>   My Code
>   
>   
>   
>   String base_dir = Host.getBuildTemp();
>   
>               Project p = new Project();
>               p.setName("Building");
>               p.setDefault("installer") ;
>               p.setBasedir(".");
>              
>                //org.apache.tools.ant.types.Reference 
> compile_class_path = new  
> org.apache.tools.ant.types.Reference(p,"compile_class_path");
>              
>                org.apache.tools.ant.types.Path class_path = 
> new  org.apache.tools.ant.types.Path(p);
>              
>                org.apache.tools.ant.types.FileSet fs = new  
> org.apache.tools.ant.types.FileSet();
>               File lib = new File(base_dir+"/"+"lib");
>               fs.setDir(lib);
>               fs.setIncludes("*.jar");
>               class_path.addFileset(fs);
>              
>              
>                org.apache.tools.ant.taskdefs.Taskdef 
> tinstaller = new  org.apache.tools.ant.taskdefs.Taskdef();
>               tinstaller.setProject(p);
>               tinstaller.setTaskName("izpack");
>               String cp=class_path.toString();
>               System.out.println("File Addition"+cp);
>               tinstaller.setClasspath(class_path); 
> //NullPointerException
>               System.out.println("File Test1");
>               
> tinstaller.setClassname("com.izforge.izpack.ant.IzPackTask");
>               System.out.println("File Addition"+cp);
>               IzPackTask izpack = new IzPackTask();
>               System.out.println("File Test2");
>               izpack.setInput("D:/subir/install.xml");
>               izpack.setOutput("D:/subir/out.jar");
>               System.out.println("Test3");
>               izpack.setBasedir(".");
>               Target installer = new Target();
>               installer.setName("installer");
>              
>               installer.addTask(tinstaller);
>               installer.addTask(izpack);
>               //System.out.println(compile.toString());
>                      
>               p.addTarget(installer);
>               DefaultLogger consoleLogger = new DefaultLogger();
>               consoleLogger.setErrorPrintStream(System.err);
>               consoleLogger.setOutputPrintStream(System.out);
>               consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
>               p.addBuildListener(consoleLogger);
>              
>   
>   Warm Regards
>   
>   Subir
>   
> 				
> ---------------------------------
>  Why was V. Sehwag warned by the BCCI? Share your knowledge 
> on Yahoo! Answers India  Send instant messages to your online 
> friends - NOW
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message