• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Echo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tools.ant.taskdefs.Echo的典型用法代码示例。如果您正苦于以下问题:Java Echo类的具体用法?Java Echo怎么用?Java Echo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Echo类属于org.apache.tools.ant.taskdefs包,在下文中一共展示了Echo类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: extracted

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
private Target extracted(Project p) {

		Target target = new Target() {
			//			@Override
			//			public Project getProject() {
			//				return p;
			//			}
		};
		target.setProject(p);

		target.setName("Hello build");
		target.setDescription("Runtime Adding Target");

		Echo echo = new Echo();
		echo.setMessage("Hello ant build");
		echo.setProject(p);
		target.addTask(echo);
		return target;
	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:20,代码来源:AntJavaCompilerTest.java


示例2: getEchoTask

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public Echo getEchoTask() {
    Project project = new Project();
    project.setName("testProject");

    Target target = new Target();
    target.setName("testTarget");
    target.setProject(project);

    Echo.EchoLevel level = new Echo.EchoLevel();
    level.setValue("error");
    Echo echoTask = new Echo();
    echoTask.setOwningTarget(target);
    echoTask.setLevel(level);
    echoTask.setTaskName("echo");
    echoTask.setTaskType("echo");
    echoTask.setMessage("This is a sample message.");

    return echoTask;
}
 
开发者ID:ModelN,项目名称:build-management,代码行数:20,代码来源:ReportTest.java


示例3: execute

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public void execute() {
    Project project = getProject();
    String buildoptions = project.getProperty("buildoptions");
    Pattern p = Pattern.compile("\\s");
    String[] commands = p.split(buildoptions);
    for(int i=0; i<commands.length; i++){
        project.setProperty("command"+i,commands[i]);
        Echo echo = (Echo) project.createTask("echo");
        echo.setMessage("command"+i+": "+commands[i]);
        echo.perform(); 	
    }
    project.setProperty("numberofcommands",""+commands.length);
}
 
开发者ID:webdsl,项目名称:webdsl,代码行数:14,代码来源:TaskBuildOptions.java


示例4: appendDeliveryList

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
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();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:10,代码来源:IvyDeliver.java


示例5: testPlainTask

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
@Test
public void testPlainTask() {
    buildRule.executeTarget("testPlainTask");
    Echo e = (Echo) buildRule.getProject().getReference("echo");
    assertFalse(e.getLocation() == Location.UNKNOWN_LOCATION);
    assertFalse(e.getLocation().getLineNumber() == 0);
}
 
开发者ID:apache,项目名称:ant,代码行数:8,代码来源:LocationTest.java


示例6: testStandaloneType

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
@Test
public void testStandaloneType() {
    buildRule.executeTarget("testStandaloneType");
    Echo e = (Echo) buildRule.getProject().getReference("echo2");
    FileSet f = (FileSet) buildRule.getProject().getReference("fs");
    assertFalse(f.getLocation() == Location.UNKNOWN_LOCATION);
    assertEquals(e.getLocation().getLineNumber() + 1,
                 f.getLocation().getLineNumber());
}
 
开发者ID:apache,项目名称:ant,代码行数:10,代码来源:LocationTest.java


示例7: testMacrodefWrappedTask

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
@Test
public void testMacrodefWrappedTask() {
    buildRule.executeTarget("testMacrodefWrappedTask");
    Echo e = (Echo) buildRule.getProject().getReference("echo3");
    assertTrue(buildRule.getLog().indexOf("Line: "
                                + (e.getLocation().getLineNumber() + 1))
               > -1);
}
 
开发者ID:apache,项目名称:ant,代码行数:9,代码来源:LocationTest.java


示例8: testPresetdefWrappedTask

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
@Test
public void testPresetdefWrappedTask() {
    buildRule.executeTarget("testPresetdefWrappedTask");
    Echo e = (Echo) buildRule.getProject().getReference("echo4");
    assertTrue(buildRule.getLog().indexOf("Line: "
                                + (e.getLocation().getLineNumber() + 1))
               > -1);
}
 
开发者ID:apache,项目名称:ant,代码行数:9,代码来源:LocationTest.java


示例9: writeTextToFile

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public static void writeTextToFile(String text, File file) {
        ensureParentFolderExists(file);

        Echo echo = new Echo();
        echo.setProject(new Project());
        echo.addText(text);
        echo.setFile(file);
        echo.execute();
}
 
开发者ID:rimerosolutions,项目名称:ant-wrapper,代码行数:10,代码来源:IOUtils.java


示例10: testNumberCriteria

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public void testNumberCriteria() throws Exception {
    Echo echoTask = getEchoTask();
    BuildEvent event = new BuildEvent(echoTask);
    event.setMessage("Population completed with 2 errors.", Project.MSG_INFO);

    ReportParseCriteria criteria = new ReportParseCriteria();

    // Verify that the regular expression parsing can find the match
    criteria.setText("with [1-9] errors");
    assertEquals(true, criteria.matches(event));

    // Verify that the regular expression does not produce false matches
    event.setMessage("Population completed with no errors.", Project.MSG_INFO);
    assertEquals(false, criteria.matches(event));
}
 
开发者ID:ModelN,项目名称:build-management,代码行数:16,代码来源:ReportTest.java


示例11: testJavadocCriteria

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public void testJavadocCriteria() throws Exception {
    Echo echoTask = getEchoTask();
    BuildEvent event = new BuildEvent(echoTask);
    event.setMessage("/path/SomeFile.java:28: warning - Tag @link: reference not found: com.xyz.SomeClass", Project.MSG_INFO);

    ReportParseCriteria criteria = new ReportParseCriteria();

    // Verify that the regular expression parsing can find the match
    criteria.setText(": warning -");
    assertEquals(true, criteria.matches(event));

    // Verify that the regular expression does not produce false matches
    event.setMessage("This is a false error: some error", Project.MSG_INFO);
    assertEquals(false, criteria.matches(event));
}
 
开发者ID:ModelN,项目名称:build-management,代码行数:16,代码来源:ReportTest.java


示例12: processReferencesAndOutput

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
/**
 * Processes a list of references, check references names and output to a file if requested.
 *
 * @param refList The list of references to process
 */
protected void processReferencesAndOutput(List<Ref> refList) {
        List<String> refNames = new ArrayList<String>(refList.size());

        for (Ref ref : refList) {
                refNames.add(GitTaskUtils.sanitizeRefName(ref.getName()));
        }

        if (!namesToCheck.isEmpty()) {
                if (!refNames.containsAll(namesToCheck)) {
                        List<String> namesCopy = new ArrayList<String>(namesToCheck);
                        namesCopy.removeAll(refNames);

                        throw new GitBuildException(String.format(MISSING_REFS_TEMPLATE, namesCopy.toString()));
                }
        }

        if (!GitTaskUtils.isNullOrBlankString(outputFilename)) {
                FileUtils fileUtils = FileUtils.getFileUtils();

                Echo echo = new Echo();
                echo.setProject(getProject());
                echo.setFile(fileUtils.resolveFile(getProject().getBaseDir(), outputFilename));

                for (int i = 0; i < refNames.size(); i++) {
                        String refName = refNames.get(i);
                        echo.addText(String.format(REF_NAME_TEMPLATE, refName));
                }

                echo.perform();
        }
}
 
开发者ID:rimerosolutions,项目名称:ant-git-tasks,代码行数:37,代码来源:TagListTask.java


示例13: execute

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public void execute() {
    Project project = getProject();

    String currentdir = project.getProperty("currentdir");
    String generatedir = project.getProperty("generate-dir");
    String webcontentdir = project.getProperty("webcontentdir");

    StringBuilder classpathFile = new StringBuilder();
    classpathFile.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    classpathFile.append("<classpath>\n");
    classpathFile.append("\t<classpathentry kind=\"src\" path=\".servletapp/src-template\"/>\n");
    classpathFile.append("\t<classpathentry kind=\"src\" path=\".servletapp/src-generated\"/>\n");
    classpathFile.append("\t<classpathentry kind=\"src\" path=\"nativejava\"/>\n");
    classpathFile.append("\t<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6\"/>\n");
    classpathFile.append("\t<classpathentry kind=\"con\" path=\"org.eclipse.jst.j2ee.internal.web.container\"/>\n");
    classpathFile.append("\t<classpathentry kind=\"con\" path=\"org.eclipse.jst.j2ee.internal.module.container\"/>\n");
    classpathFile.append("\t<classpathentry kind=\"output\" path=\"").append(generatedir).append("/WEB-INF/classes\"/>\n"); //must use relative path here

    String filedir = webcontentdir+"/WEB-INF/lib"; //must use absolute path here
    File appdir = new File(filedir);
    Echo echo = (Echo) project.createTask("echo");
    echo.setMessage(filedir);
    echo.perform();
    File[] libfiles = appdir.listFiles();
    for (int i = 0 ; i < libfiles.length ; i ++ ) {
        if ( libfiles[i].isFile ( ) ){
            classpathFile.append("\t<classpathentry kind=\"lib\" path=\"").append(generatedir).append("/WEB-INF/lib/").append(libfiles[i].getName()).append("\"/>\n"); //must use relative path here
        }
    }
    classpathFile.append("</classpath>\n");

    try {
        //write result
        FileWriter fw = new FileWriter(currentdir+"/.classpath");
        BufferedWriter bw = new BufferedWriter(fw);
        bw.write(classpathFile.toString());
        bw.close();
        fw.close();
    } catch (Exception e) {
        Echo ec = (Echo) project.createTask("echo");
        ec.setMessage(e.getMessage());
        ec.perform();
    }
}
 
开发者ID:webdsl,项目名称:webdsl,代码行数:45,代码来源:TaskFixClasspath.java


示例14: addNested

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public void addNested(Echo nestedEcho) {
    this.nestedEcho = nestedEcho;
}
 
开发者ID:apache,项目名称:ant,代码行数:4,代码来源:SpecialSeq.java


示例15: main

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public static void main(String[] args) {
	// global ant project settings
	Project project = new Project();
	project.setBaseDir(new File(System.getProperty("user.dir")));
	project.init();
	DefaultLogger logger = new DefaultLogger();
	project.addBuildListener(logger);
	logger.setOutputPrintStream(System.out);
	logger.setErrorPrintStream(System.err);
	logger.setMessageOutputLevel(Project.MSG_INFO);
	System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
	System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
	project.fireBuildStarted();

	Throwable caught = null;
	try {
		// an echo example
		Echo echo = new Echo();
		echo.setTaskName("Echo");
		echo.setProject(project);
		echo.init();
		echo.setMessage("Launching ...");
		echo.execute();

		
		/** initialize an java task **/
		Java javaTask = new Java();
		javaTask.setNewenvironment(true);
		javaTask.setTaskName("runjava");
		javaTask.setProject(project);
		javaTask.setFork(true);
		javaTask.setFailonerror(true);
		javaTask.setClassname(MyClassToLaunch.class.getName());
		
		// add some vm args
		Argument jvmArgs = javaTask.createJvmarg();
		jvmArgs.setLine("-Xms512m -Xmx512m");
		
		// added some args for to class to launch
		Argument taskArgs = javaTask.createArg();
		taskArgs.setLine("bla path=/tmp/");
		
		Path classPath = new Path(project, new File(System.getProperty("user.dir") + "/bin/test").getAbsolutePath());
		javaTask.setClasspath(classPath);
		
		javaTask.init();
		int ret = javaTask.executeJava();
		System.out.println("return code: " + ret);

	} catch (BuildException e) {
		caught = e;
	}
	project.log("finished");
	project.fireBuildFinished(caught);
}
 
开发者ID:th-schwarz,项目名称:pmcms,代码行数:56,代码来源:MyLauncher.java


示例16: execute

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
public void execute() {
	// Make sure we have all the required fields set.
	if (outFile == null) {
		throw new BuildException("The outFile attribute is required");
	}


	// First, populate all of the properties we care about for this task.
	if (getProject().getProperty("ant.build.native.toolchain") != null) {
		this.setToolchain(getProject().getProperty("ant.build.native.toolchain"));
	}

	if (getProject().getProperty("ant.build.native.host") != null) {
		this.setHost(getProject().getProperty("ant.build.native.host"));
	}


	// Setup the compiler.
	LinkerAdapter linker = ToolchainFactory.getLinker(toolchain);
	linker.setProject(getProject());
	linker.setOutFile(outFile);

	if (host != null && host.length() > 0) {
		// Prepend the host string to the executable.
		linker.setExecutable(host + '-' + linker.getExecutable());
	}

	for (AbstractFeature feat : features) {
		if (feat.isIfConditionValid() && feat.isUnlessConditionValid()) {
			linker.addArg(feat);
		}
	}

	long newest = 0;
	Iterator<File> inFile = linker.getInFiles();
	while (inFile.hasNext()) {
		long modified = inFile.next().lastModified();

		if (newest < modified) {
			newest = modified;
		}
	}

	if (newest >= outFile.lastModified()) {
		// Print the executed command.
		Echo echo = (Echo) getProject().createTask("echo");
		echo.setTaskName(this.getTaskName());
		echo.setAppend(true);

		// Create an exec task to run a shell.  Using the current shell to
		// execute commands is required for Windows support.
		ExecTask shell = (ExecTask) getProject().createTask("exec");
		shell.setTaskName(this.getTaskName());
		shell.setFailonerror(true);
		//shell.setDir(dir);

		echo.addText(linker.getExecutable());
		shell.setExecutable(linker.getExecutable());

		Iterator<String> args = linker.getArgs();
		while (args.hasNext()) {
			String arg = args.next();

			echo.addText(" " + arg);
			shell.createArg().setLine(arg);
		}

		echo.execute();
		shell.execute();
	}
}
 
开发者ID:kwhat,项目名称:jnitasks,代码行数:72,代码来源:LdTask.java


示例17: execute

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
@Override
public void execute() throws BuildException {
	// Set the command to execute along with any required arguments.
	StringBuilder command = new StringBuilder(AutoreconfTask.cmd);

	// Take care of the optional arguments.
	if (!this.quiet) {
		command.append(" --verbose");
	}

	if (this.force) {
		command.append(" --force");
	}

	if (this.install) {
		command.append(" --install");
	}

	// Include arguments for nested Include.
	Iterator<AutoreconfTask.Include> iterator = includes.iterator();
	while (iterator.hasNext()) {
		AutoreconfTask.Include include = iterator.next();

		if (include.isIfConditionValid() && include.isUnlessConditionValid()) {
			if (include.isPrepend()) {
				command.append(" -B").append(include.getPath());
			}
			else {
				command.append(" -I").append(include.getPath());
			}
		}
	}

	// Print the executed command.
	Echo echo = (Echo) getProject().createTask("echo");
	echo.addText(command.toString());
	echo.setTaskName(this.getTaskName());
	echo.execute();

	// Create an exec task to run a shell.  Using the current shell to
	// execute commands is required for Windows support.
	ExecTask shell = (ExecTask) getProject().createTask("exec");
	shell.setTaskName(this.getTaskName());

	shell.setDir(dir);
	shell.setExecutable("sh");
	shell.setFailonerror(true);

	shell.createArg().setValue("-c");
	shell.createArg().setValue(command.toString());

	shell.execute();
}
 
开发者ID:kwhat,项目名称:jnitasks,代码行数:54,代码来源:AutoreconfTask.java


示例18: setLevel

import org.apache.tools.ant.taskdefs.Echo; //导入依赖的package包/类
/**
 * Changes the current log level.
 * 
 * @param level the current log level
 */
public void setLevel(Echo.EchoLevel level) {
    this.logLevel = level.getLevel();
}
 
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:9,代码来源:SetLogLevelTask.java



注:本文中的org.apache.tools.ant.taskdefs.Echo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BsonNull类代码示例发布时间:2022-05-22
下一篇:
Java FullPrunedBlockStore类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap