本文整理匯總了Java中org.apache.tools.ant.Project.setProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Project.setProperty方法的具體用法?Java Project.setProperty怎麽用?Java Project.setProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tools.ant.Project
的用法示例。
在下文中一共展示了Project.setProperty方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.apache.tools.ant.Project; //導入方法依賴的package包/類
@Override
public void execute() {
Project p = getProject();
Properties props = readProperties(propertyFile);
toolName = props.getProperty("tool.name");
if (toolName != null) {
toolArgs = props.getProperty(toolName + ".args", "");
}
if (toolProperty == null ||
askIfUnset && (toolName == null
|| (argsProperty != null && toolArgs == null))) {
showGUI(props);
}
// finally, return required values, if any
if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
p.setProperty(toolProperty, toolName);
if (argsProperty != null && toolArgs != null)
p.setProperty(argsProperty, toolArgs);
}
}
示例2: execute
import org.apache.tools.ant.Project; //導入方法依賴的package包/類
/**
* Executes the task. If the source property was specified, its value is
* evaluated and set as the value of the target property. Otherwise the literal
* string value is used.
*/
public void execute() {
final Project project = getProject();
final String string = (source != null) ?
project.getProperty(Utils.resolveProperty(source, project)) :
value;
final String resolved = Utils.resolveProperty(string, project);
log("Setting " + property + " to " + resolved);
project.setProperty(property, resolved);
}
示例3: setUp
import org.apache.tools.ant.Project; //導入方法依賴的package包/類
@Override
protected void setUp() throws Exception {
clearWorkDir();
String prop = System.getProperty("nb_all");
assertNotNull("${nb_all} defined", prop);
nball = new File(prop);
File baseDir = new File(getWorkDir(), "basedir");
baseDir.mkdirs();
File destDir = new File(getWorkDir(), "destdir");
destDir.mkdirs();
p = new Project();
p.init();
p.setBaseDir(nball);
p.setProperty("netbeans.dest.dir", destDir.getAbsolutePath());
p.setProperty("nb_all", nball.getAbsolutePath());
File clusters = new File(new File(nball, "nbbuild"), "cluster.properties");
assertTrue("cluster.properties file exists", clusters.exists());
Properties clusterProps = new Properties();
try (FileInputStream is = new FileInputStream(clusters)) {
clusterProps.load(is);
}
for (Entry<Object, Object> en : clusterProps.entrySet()) {
p.setProperty(en.getKey().toString(), en.getValue().toString());
}
}
示例4: testDependencies
import org.apache.tools.ant.Project; //導入方法依賴的package包/類
public void testDependencies() throws Exception {
CreateDependencies d = new CreateDependencies();
Project prj = new Project();
DirSet ds = new DirSet();
File dependencies = new File(nb_all, "dependencies");
ds.setProject(prj);
ds.setDir(nb_all);
prj.addReference("x", ds);
prj.setProperty("nb_all", nb_all.getAbsolutePath());
d.setProject(prj);
d.getProject();
d.setRefid("x");
d.setDependencies(dependencies);
d.execute();
assertFileContent(dependencies,
"This project's dependencies\n" +
"\n" +
"\n" +
"Runtime dependencies:\n" +
"=====================\n" +
"\n" +
"From: XC\n" +
" - XA: XB (XD)\n" +
" License: Test license\n" +
"\n");
}
示例5: testCompileTimeDependencies
import org.apache.tools.ant.Project; //導入方法依賴的package包/類
public void testCompileTimeDependencies() throws Exception {
CreateDependencies d = new CreateDependencies();
Project prj = new Project();
DirSet ds = new DirSet();
File dependencies = new File(nb_all, "dependencies");
ds.setProject(prj);
ds.setDir(nb_all);
prj.addReference("x", ds);
prj.setProperty("nb_all", nb_all.getAbsolutePath());
d.setProject(prj);
d.getProject();
d.setRefid("x");
d.setDependencies(dependencies);
d.setSourceDependencies(true);
d.execute();
assertFileContent(dependencies,
"This project's dependencies\n" +
"\n" +
"\n" +
"Runtime dependencies:\n" +
"=====================\n" +
"\n" +
"From: XC\n" +
" - XA: XB (XD)\n" +
" License: Test license\n" +
"\n" +
"\n" +
"Compile time dependencies:\n" +
"==========================\n" +
"\n" +
"From: XC2\n" +
" - XA2: XB2 (XD2)\n" +
" License: Test license2\n" +
"\n");
}
示例6: execute
import org.apache.tools.ant.Project; //導入方法依賴的package包/類
@Override
public void execute() throws BuildException {
if (classpath == null) {
throw new BuildException("Classpath must be set.");
}
if (targetProperty == null) {
throw new BuildException("Target property must be set.");
}
Project p = getProject();
String translated = translate(classpath);
p.setProperty(targetProperty, translated);
}
示例7: createProperties
import org.apache.tools.ant.Project; //導入方法依賴的package包/類
private void createProperties(IEclipseProject project) {
Project p = getProject();
p.setProperty(PROP_PROJECTNAME, project.getName());
// Variables for all dependent projects directories
for (IEclipseProject d : project.getDependencies()) {
String name = d.getName();
p.setProperty(PROP_PROJECT_PREFIX + name + PROP_DIR_SUFFIX, d
.getLocation().toString());
p.setProperty(PROP_WORK_PREFIX + name + PROP_DIR_SUFFIX,
getWorkDir(name).toString());
p.setProperty(PROP_PACKAGE_PREFIX + name + PROP_DIR_SUFFIX,
getPackageDir(name).toString());
name = ESS_PREFIX + name;
p.setProperty(
PROP_PROJECT_PREFIX + name + PROP_DIR_SUFFIX,
d.getLocation()
.toString()
.replace(SEPARATOR + OSCM_PREFIX,
SEPARATOR + ESS_PREFIX + OSCM_PREFIX)
.replace(ESS_BUILD, OSCM_BUILD));
p.setProperty(
PROP_WORK_PREFIX + name + PROP_DIR_SUFFIX,
getWorkDir(name)
.toString()
.replace(SEPARATOR + OSCM_PREFIX,
SEPARATOR + ESS_PREFIX + OSCM_PREFIX)
.replace(ESS_BUILD, OSCM_BUILD));
p.setProperty(
PROP_PACKAGE_PREFIX + name + PROP_DIR_SUFFIX,
getPackageDir(name)
.toString()
.replace(SEPARATOR + OSCM_PREFIX,
SEPARATOR + ESS_PREFIX + OSCM_PREFIX)
.replace(ESS_BUILD, OSCM_BUILD));
}
}