本文整理汇总了Java中org.apache.tools.ant.taskdefs.Echo.setMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Echo.setMessage方法的具体用法?Java Echo.setMessage怎么用?Java Echo.setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.taskdefs.Echo
的用法示例。
在下文中一共展示了Echo.setMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
示例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();
}
示例5: 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();
}
}
示例6: 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);
}