ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From subir bhaumik <subir...@yahoo.co.in>
Subject Taskdef
Date Tue, 16 May 2006 13:43:38 GMT
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
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message