本文整理了Java中org.apache.tools.ant.Project.getDefaultTarget()
方法的一些代码示例,展示了Project.getDefaultTarget()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getDefaultTarget()
方法的具体详情如下:
包路径:org.apache.tools.ant.Project
类名称:Project
方法名:getDefaultTarget
[英]Return the name of the default target of the project.
[中]返回项目的默认目标的名称。
代码示例来源:origin: org.apache.ant/ant
final String defaultTarget = project.getDefaultTarget();
if (defaultTarget != null && !defaultTarget.isEmpty()) {
代码示例来源:origin: org.apache.ant/ant
if (project.getDefaultTarget() != null) {
targets.addElement(project.getDefaultTarget());
代码示例来源:origin: org.apache.ant/ant
String defaultTarget = newProject.getDefaultTarget();
if (defaultTarget != null) {
locals.add(defaultTarget);
代码示例来源:origin: stackoverflow.com
File buildFile = new File("build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: stackoverflow.com
File buildFile = new File("build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui
public boolean isDefaultTarget() {
String targetName = fTarget.getName();
if (targetName == null) {
return false;
}
return targetName.equals(fTarget.getProject().getDefaultTarget());
}
代码示例来源:origin: io.github.gitbucket/solidbase
@Override
public void migrate(String moduleId, String version, Map<String, Object> context) throws Exception {
String path = this.path;
if(path == null){
path = moduleId + "_" + version + ".xml";
}
Path tempFilePath = Files.createTempFile("solidbase_ant-", ".xml");
try {
ClassLoader classLoader = (ClassLoader) context.get(Solidbase.CLASSLOADER);
String source = MigrationUtils.readResourceAsString(classLoader, path);
Files.write(tempFilePath, source.getBytes("UTF-8"));
Project project = new Project();
project.setProperty("ant.file", path);
project.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference("ant.projectHelper", helper);
helper.parse(project, tempFilePath.toFile());
System.out.println(project.getDefaultTarget());
project.executeTarget(project.getDefaultTarget());
} finally {
ignoreException(() -> Files.delete(tempFilePath));
}
}
代码示例来源:origin: stackoverflow.com
File buildFile = new File("build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: org.gosu-lang.aardvark/aardvark-core
targets.addAll(targetCalls.keySet());
else if (_project.getDefaultTarget() != null) {
targets.add(_project.getDefaultTarget());
代码示例来源:origin: stackoverflow.com
File buildFile = new File("build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: stackoverflow.com
File buildFile = new File("build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: gitbucket/solidbase
@Override
public void migrate(String moduleId, String version, Map<String, Object> context) throws Exception {
String path = this.path;
if(path == null){
path = moduleId + "_" + version + ".xml";
}
Path tempFilePath = Files.createTempFile("solidbase_ant-", ".xml");
try {
ClassLoader classLoader = (ClassLoader) context.get(Solidbase.CLASSLOADER);
String source = MigrationUtils.readResourceAsString(classLoader, path);
Files.write(tempFilePath, source.getBytes("UTF-8"));
Project project = new Project();
project.setProperty("ant.file", path);
project.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference("ant.projectHelper", helper);
helper.parse(project, tempFilePath.toFile());
System.out.println(project.getDefaultTarget());
project.executeTarget(project.getDefaultTarget());
} finally {
ignoreException(() -> Files.delete(tempFilePath));
}
}
代码示例来源:origin: stackoverflow.com
File buildFile = new File("build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: stackoverflow.com
File buildFile = new File("/home/sai/Jan5WS/AntTest", "build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: stackoverflow.com
File buildFile = new File("build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: stackoverflow.com
String buildXml = "build.xml";
Project p = new Project();
p.setUserProperty("ant.file", buildXml);
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
InputStream inputStream = new FileInputStream(buildXml);
helper.parse(p, inputStream);
p.executeTarget(p.getDefaultTarget());
代码示例来源:origin: stackoverflow.com
public final void launch(final String antScriptFile) {
/* configure Ant and execute the task */
final File buildFile = new File(antScriptFile);
final Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
final DefaultLogger consoleLogger = new DefaultLogger();
consoleLogger.setErrorPrintStream(System.err);
consoleLogger.setOutputPrintStream(System.out);
consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
p.addBuildListener(consoleLogger);
try {
p.fireBuildStarted();
p.init();
final ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.executeTarget(p.getDefaultTarget());
p.fireBuildFinished(null);
} catch (final BuildException e) {
p.fireBuildFinished(e);
}
/* exit the current VM */
System.exit(0);
代码示例来源:origin: eu.mihosoft.vrl/vrl
public static void main(String[] args) {
File buildFile = new File("/home/miho/tmp/anttest/build.xml");
Project p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.setProperty("name", "World");
DefaultLogger consoleLogger = new DefaultLogger();
consoleLogger.setErrorPrintStream(System.err);
consoleLogger.setOutputPrintStream(System.out);
consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
p.addBuildListener(consoleLogger);
try {
p.fireBuildStarted();
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, buildFile);
p.createClassLoader(ClassLoader.getSystemClassLoader(),new Path(p));
p.executeTarget(p.getDefaultTarget());
p.fireBuildFinished(null);
} catch (BuildException e) {
p.fireBuildFinished(e);
}
}
}
代码示例来源:origin: dita-ot/dita-ot
ProjectHelper.configureProject(project, buildFile);
final Vector<String> targets = new Vector<>();
targets.addElement(project.getDefaultTarget());
project.executeTargets(targets);
代码示例来源:origin: eu.mihosoft.vrl/vrl
public static VBuildResult build(VProjectController vpc, boolean overwriteBuildScript) {
Project p = prepare(vpc, overwriteBuildScript);
ProjectBuildListener buildListener = new ProjectBuildListener(vpc);
p.addBuildListener(buildListener);
BuildException exception = null;
try {
p.fireBuildStarted();
p.init();
ProjectHelper helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
helper.parse(p, getBuildFile(vpc));
p.executeTarget(p.getDefaultTarget());
p.fireBuildFinished(null);
} catch (BuildException e) {
p.fireBuildFinished(e);
exception = e;
}
return buildListener.getBuildResult();
}
内容来源于网络,如有侵权,请联系作者删除!