String classname = definition.className; if (classname == null) { instance = getProject().createTask(definition.type); if (instance == null) { instance = getProject().createDataType(definition.type);
/** * Creates a named task and configures it up to the init() stage. * * @param ue The UnknownElement to create the real task for. * Must not be <code>null</code>. * @param w Ignored. * * @return the task specified by the given unknown element, or * <code>null</code> if the task name is not recognised. */ protected Task makeTask(UnknownElement ue, RuntimeConfigurable w) { Task task = getProject().createTask(ue.getTag()); if (task != null) { task.setLocation(getLocation()); // UnknownElement always has an associated target task.setOwningTarget(getOwningTarget()); task.init(); } return task; }
@Override public void execute() throws BuildException { findbugsEngine = (Java) getProject().createTask("java");
/** * Generate the client jar corresponding to the jar file passed as parameter * the method uses the BorlandGenerateClient task. * @param sourceJar java.io.File representing the produced jar file */ private void generateClient(File sourceJar) { getTask().getProject().addTaskDefinition("internal_bas_generateclient", org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class); BorlandGenerateClient gentask; log("generate client for " + sourceJar, Project.MSG_INFO); try { Project project = getTask().getProject(); gentask = (BorlandGenerateClient) project.createTask("internal_bas_generateclient"); gentask.setEjbjar(sourceJar); gentask.setDebug(java2iiopdebug); Path classpath = getCombinedClasspath(); if (classpath != null) { gentask.setClasspath(classpath); } gentask.setVersion(version); gentask.setTaskName("generate client"); gentask.execute(); } catch (Exception e) { //TO DO : delete the file if it is not a valid file. throw new BuildException("Exception while calling " + VERIFY, e); } }
task = helperImpl.project.createTask(tag); } catch (BuildException e) {
public Task createTask(final String name) throws BuildException { assert name != null; return getAnt().createTask(name); }
private void removeUITests() { File existingFile = new File(installedDirectory + "/src/test/resources/web-tests.xml"); if (existingFile.exists()) { parseXMLFile(existingFile, pojoName); // Remove tests in run-all-tests target Replace replace = (Replace) antProject.createTask("replace"); replace.setFile(existingFile); replace.setToken("," + pojoName + "Tests"); replace.execute(); } }
private void installStrutsViews() { Copy copy = (Copy) antProject.createTask("copy"); copy.setFile(new File(sourceDirectory + "/src/main/webapp/WEB-INF/pages/" + pojoName + "Form.jsp")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/WEB-INF/pages/" + pojoNameLower + "Form.jsp")); copy.execute(); copy.setFile(new File(sourceDirectory + "/src/main/webapp/WEB-INF/pages/" + pojoName + "List.jsp")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/WEB-INF/pages/" + pojoNameLower + "List.jsp")); copy.execute(); }
private void installStripesViews() { Copy copy = (Copy) antProject.createTask("copy"); copy.setFile(new File(sourceDirectory + "/src/main/webapp/" + pojoName + "Form.jsp")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/" + pojoNameLower + "Form.jsp")); copy.execute(); copy.setFile(new File(sourceDirectory + "/src/main/webapp/" + pojoName + "List.jsp")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/" + pojoNameLower + "List.jsp")); copy.execute(); }
private void installJSFViews() { Copy copy = (Copy) antProject.createTask("copy"); copy.setFile(new File(sourceDirectory + "/src/main/webapp/" + pojoName + "Form.xhtml")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/" + pojoNameLower + "Form.xhtml")); copy.execute(); copy.setFile(new File(sourceDirectory + "/src/main/webapp/" + pojoName + "s.xhtml")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/" + util.getPluralForWord(pojoNameLower) + ".xhtml")); copy.execute(); }
private void installSpringViews() { Copy copy = (Copy) antProject.createTask("copy"); copy.setFile(new File(sourceDirectory + "/src/main/webapp/WEB-INF/pages/" + pojoName + "form.jsp")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/WEB-INF/pages/" + pojoNameLower + "form.jsp")); copy.execute(); copy.setFile(new File(sourceDirectory + "/src/main/webapp/WEB-INF/pages/" + pojoName + "s.jsp")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/WEB-INF/pages/" + util.getPluralForWord(pojoNameLower) + ".jsp")); copy.execute(); }
private void installSpringFreemarkerViews() { Copy copy = (Copy) antProject.createTask("copy"); copy.setFile(new File(sourceDirectory + "/src/main/webapp/" + pojoName + "form.ftl")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/" + pojoNameLower + "form.ftl")); copy.execute(); copy.setFile(new File(sourceDirectory + "/src/main/webapp/" + pojoName + "list.ftl")); copy.setTofile(new File(destinationDirectory + "/src/main/webapp/" + util.getPluralForWord(pojoNameLower) + ".ftl")); copy.execute(); }
private void installTapestryViews() { Copy copy = (Copy) antProject.createTask("copy"); copy.setFile(new File(sourceDirectory + "/src/main/webapp/" + pojoName + "Form.tml")); copy.setTodir(new File(destinationDirectory + "/src/main/webapp")); copy.execute(); copy.setFile(new File(sourceDirectory + "/src/main/webapp/" + pojoName + "List.tml")); copy.execute(); log("Installing menu..."); createLoadFileTask("src/main/webapp/" + pojoName + "-menu.tml", "tapestry-menu").execute(); File existingFile = new File(destinationDirectory + "/src/main/resources/" + project.getGroupId().replace(".", "/") + "/webapp/components/Layout.tml"); parseXMLFile(existingFile, pojoName, "<!-- Add new menu items here -->", "tapestry-menu"); }
/** * This method will remove files from the source directory. * * @param installedDirectory The destination directory to copy to. * @param removePattern The file pattern to match to locate files to copy. */ protected void removeGeneratedFiles(final String installedDirectory, final String removePattern) { Delete deleteTask = (Delete) antProject.createTask("delete"); FileSet fileSet = AntUtils.createFileset(installedDirectory, removePattern, new ArrayList()); log("Removing generated files (pattern: " + removePattern + ")..."); deleteTask.addFileset(fileSet); deleteTask.execute(); }
Project p = new Project(); p.init(); p.addBuildListener( new SimpleBuildListener() ); p.setBaseDir( new File( "." ).getAbsoluteFile() ); Javac task = (Javac) p.createTask( "javac" ); task.srcdir( srcDirPath ); // Filsets can be built this way FileSet set = new FileSet(); set.setDir( srcDirPath ); set.setIncludes( "**/*.java" ); task.addFileset( set );
protected void installLiberty(File jarFile) throws Exception { Java java = (Java) getProject().createTask("java"); java.setJar(jarFile); java.setFork(true); java.createArg().setValue("-acceptLicense"); java.createArg().setValue(baseDir); int exitCode = java.executeJava(); if (exitCode != 0) { throw new BuildException("Error installing Liberty."); } }
private void loadDeliveryList() { Property property = (Property) getProject().createTask("property"); property.setOwningTarget(getOwningTarget()); property.init(); property.setFile(deliveryList); property.perform(); }
private void onlineDownload(URL source, File dest) throws IOException { Get get = (Get) getProject().createTask("get"); DownloadProgress progress = null; if (verbose) { progress = new Get.VerboseProgress(System.out); } get.setUseTimestamp(true); get.setUsername(username); get.setPassword(password); get.setMaxTime(maxDownloadTime); get.doGet(source, dest, Project.MSG_INFO, progress); }
private void appendDeliveryList(String msg) { Echo echo = (Echo) getProject().createTask("echo"); echo.setOwningTarget(getOwningTarget()); echo.init(); echo.setFile(deliveryList); echo.setMessage(msg + "\n"); echo.setAppend(true); echo.perform(); }
/** * Call the selected ant task. */ private void antcall (String taskName) { CallTarget callee; callee = (CallTarget) getProject().createTask("antcall"); callee.setOwningTarget(getOwningTarget()); callee.setTaskName(getTaskName()); callee.setLocation(getLocation()); callee.init(); callee.setTarget(taskName); callee.execute(); }