1 18 19 20 package org.apache.tools.ant.taskdefs.rmic; 21 22 import org.apache.tools.ant.BuildException; 23 import org.apache.tools.ant.Project; 24 import org.apache.tools.ant.util.JavaEnvUtils; 25 import org.apache.tools.ant.taskdefs.Rmic; 26 import org.apache.tools.ant.taskdefs.Execute; 27 import org.apache.tools.ant.taskdefs.LogStreamHandler; 28 import org.apache.tools.ant.types.Commandline; 29 30 import java.io.IOException ; 31 32 41 public class ForkingSunRmic extends DefaultRmicAdapter { 42 43 46 public static final String COMPILER_NAME = "forking"; 47 48 53 public boolean execute() throws BuildException { 54 Rmic owner = getRmic(); 55 Commandline cmd = setupRmicCommand(); 56 Project project = owner.getProject(); 57 cmd.setExecutable(JavaEnvUtils.getJdkExecutable(getExecutableName())); 59 60 String [] args = cmd.getCommandline(); 62 63 try { 64 Execute exe = new Execute(new LogStreamHandler(owner, 65 Project.MSG_INFO, 66 Project.MSG_WARN)); 67 exe.setAntRun(project); 68 exe.setWorkingDirectory(project.getBaseDir()); 69 exe.setCommandline(args); 70 exe.execute(); 71 return !exe.isFailure(); 72 } catch (IOException exception) { 73 throw new BuildException("Error running " + getExecutableName() 74 + " -maybe it is not on the path", exception); 75 } 76 } 77 78 82 protected String getExecutableName() { 83 return SunRmic.RMIC_EXECUTABLE; 84 } 85 } 86 | Popular Tags |