package tiger;
import java.io.File;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
public class AntTest {
private Project project;
public void init(String _buildFile, String _baseDir) throws Exception {
project = new Project();
project.init();
DefaultLogger consoleLogger = new DefaultLogger();
consoleLogger.setErrorPrintStream(System.err);
consoleLogger.setOutputPrintStream(System.out);
consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
project.addBuildListener(consoleLogger);
// Set the base directory. If none is given, "." is used.
if (_baseDir == null)
_baseDir = new String(".");
project.setBasedir(_baseDir);
if (_buildFile == null)
_buildFile = new String(
"E:/JEE/Workspaces/MyEclipse 8.6/Study/src/tiger/a.xml");
//ProjectHelper.getProjectHelper().parse(project, new File(_buildFile));
// 关键点
ProjectHelper.configureProject(project, new File(_buildFile));
}
public void runTarget(String _target) throws Exception {
// Test if the project exists
if (project == null)
throw new Exception(
"No target can be launched because the project has not been initialized. Please call the 'init' method first !");
// If no target is specified, run the default one.
if (_target == null)
_target = project.getDefaultTarget();
// Run the target
project.executeTarget(_target);
}
public static void main(String args[]) {
try {
AntTest mytest = new AntTest();
mytest.init(
"E:/JEE/Workspaces/MyEclipse 8.6/Study/src/tiger/c.xml",
".");
mytest.runTarget(null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
a.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="runtests" name="TestA">
<target name="runtests" depends="">
<echo message="Tiger" />
</target>
</project>
c.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="runtests" name="TestC">
<import file="a.xml" />
</project>
分享到:
相关推荐
Que (March 20, 2004) <br>Language: English <br>ISBN-10: 0789731088 <br>ISBN-13: 978-0789731081 <br><br><br><br>The A+ certification is the most popular certification program in the world, certifying ...
新的版本又发布了,下载地址,<br>http://www.wholetomato.com/binaries/VA_X_Setup1640.exe<br><br>这个版本已经是正式版了,稳定性没的说,中文的问题已经得到了很好的解决,已经可以正常显示了,只是包含有中文的...
============================================<br><br>Out of the box, Tomcat 5.5 requires the Java 2 Standard Edition Runtime<br>Environment (JRE) version 5.0 or later. However, you can also run Tomcat...
有些服务器的MDAC版本还是2.5的,如果MDAC的版本太低的话,会有如下出错信息:<br> The .Net Data OLE DB Provider(System.Data.OleDb) requires Microsoft Data Access Components(MDAC) version 2.6 or later....
Subclipse 1.4.x requires Subversion 1.5.0 version of JavaHL/SVNKit <br><br>Links for 1.4.x Release:<br>Changelog: http://subclipse.tigris.org/subclipse_1.4.x/changes.html<br>Eclipse update site URL: ...
<br><br> m_hDC = CreateCompatibleDC(0) <br> If (m_hDC <> 0) Then <br> If (CreateDIB(m_hDC, lWidth, lHeight, m_hDIb)) Then <br> m_hBmpOld = SelectObject(m_hDC, m_hDIb) <br> Create = True <br> Else <br...
过滤器的格式是一个这样的串:<tag>[:priority],其中 `<tag>` 表示 log 的 component,tag (或者使用 `*` 表示所有),priority 如下所示: * `V`:Verbose * `D`:Debug * `I`:Info * `W`:Warn * `E`:Error * `...
<br><br> m_hDC = CreateCompatibleDC(0) <br> If (m_hDC <> 0) Then <br> If (CreateDIB(m_hDC, lWidth, lHeight, m_hDIb)) Then <br> m_hBmpOld = SelectObject(m_hDC, m_hDIb) <br> Create = True <br> Else <br...
<END><br>12 , telnet.zip<br>Telnet Application<END><br>13 , validip.zip<br>Validate an IP address<br>14 , dmvbtest.zip<br>This is a complete email sending client in Visual Basic<END><br>15 , ...
template<> struct Printer<std::string> { void print(std::string s) { std::cout << "Printing string: " << s << '\n'; } }; ``` ##### 3.7 使用多个 Concepts 有时需要组合多个概念来形成更复杂的类型约束...
resizable7segment_source.zip<br>An Active-X control that simulates a 7 segment L.E.D display.<END><br>18 , xartery1.zip<br>20 image digital art gallery in 2 galleries, housed in an mdiform.<END><br>...
解决方法包括重启adb服务器(通过命令`adb kill-server`和`adb start-server`),检查系统是否有其他占用adb端口的应用,并确保系统资源充足。 再者,当设备无法连接到电脑时,检查USB连接的稳定性是必要的。尝试...
<END><br>10,DXHelp.zip<br>Gives some meaningful error codes instead of the traditional archaic automation errors.<END><br>11,ColDet.zip<br>Detecting collisions between polygons.<END> <br>12,AscPlay....
Windows 95 must be OSR2 or later version<br><br>32MB (or more) of RAM<br><br>10GB (or more) hard disk is recommended (a 74 minute CD image requires 650-700MB)<br><br>One or more bus-mastering SCSI ...
- `nvm install <version>`:安装指定版本的Node.js。 - `nvm uninstall <version>`:卸载指定版本的Node.js。 - `nvm use <version>`:切换到指定版本的Node.js。 - `nvm current`:查看当前正在使用的Node.js版本...
Build 1616<br>requires software maintenance through 2007.11.08. (Release candidate.) <br>New! Create VA Snippet from selection. <br>.NET references are now parsed even when 'parse all files' is ...
(case=9436) <br>STL list<> and vector<> member lists appear correctly following a "using namespace std::list" or "using namespace std::vector" directive. (case=12345) 7226 <br>Empty C++ preprocessor ...