| 1 23 24 package com.rift.coad.lib.thirdparty.ant; 26 27 import java.io.File ; 29 import org.apache.tools.ant.BuildException; 30 31 import org.apache.tools.ant.Project; 33 import org.apache.tools.ant.Target; 34 import org.apache.tools.ant.taskdefs.Jar; 35 import org.apache.tools.ant.types.Path; 36 37 42 public class JAR extends Jar { 43 44 50 public JAR(File source, File dest) { 51 project = new Project(); 52 53 project.init(); 54 taskType = "jar"; 55 taskName = "jar"; 56 target = new Target(); 57 Path path = new Path(project); 58 this.setBasedir(source); 59 this.setDestFile(dest); 60 } 61 62 63 68 public void archive() throws AntException { 69 AntListener listener = new AntListener(); 70 project.addBuildListener(listener); 71 try { 72 super.execute(); 73 } catch (Exception ex) { 74 throw new AntException("Failed to archive :" + ex.getMessage() 75 + " [" + listener.getMessage() + "]",ex); 76 } 77 } 78 } 79 | Popular Tags |