本文整理汇总了Java中org.apache.tools.ant.taskdefs.Property.execute方法的典型用法代码示例。如果您正苦于以下问题:Java Property.execute方法的具体用法?Java Property.execute怎么用?Java Property.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.taskdefs.Property
的用法示例。
在下文中一共展示了Property.execute方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doScanSuite
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private static void doScanSuite(Map<String,Entry> entries, File suite, Map<String,Object> properties, Project project) throws IOException {
Project fakeproj = new Project();
fakeproj.setBaseDir(suite); // in case ${basedir} is used somewhere
Property faketask = new Property();
faketask.setProject(fakeproj);
faketask.setFile(new File(suite, "nbproject/private/private.properties".replace('/', File.separatorChar)));
faketask.execute();
faketask.setFile(new File(suite, "nbproject/project.properties".replace('/', File.separatorChar)));
faketask.execute();
String modulesS = fakeproj.getProperty("modules");
if (modulesS == null) {
throw new IOException("No definition of modules in " + suite);
}
String[] modules = Path.translatePath(fakeproj, modulesS);
for (int i = 0; i < modules.length; i++) {
File module = new File(modules[i]);
if (!module.isDirectory()) {
throw new IOException("No such module " + module + " referred to from " + suite);
}
if (!scanPossibleProject(module, entries, properties, null, ModuleType.SUITE, project, null)) {
throw new IOException("No valid module found in " + module + " referred to from " + suite);
}
}
}
示例2: updateProject
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
/**
* Updates the Ant Project used in this container with variables set in Ivy.
*
* All variables defined in Ivy will be set in the Ant project under two names:
* <ul>
* <li>the name of the variable</li>
* <li>the name of the variable suffixed with a dot + the given id, if the given id is not null
* </li>
* </ul>
*
* @param id
* The identifier of the settings in which the variables have been set, which should
* be used as property names suffix
*/
public void updateProject(String id) {
Map<String, String> r = new HashMap<>(super.getVariables());
r.putAll(overwrittenProperties);
for (Map.Entry<String, String> entry : r.entrySet()) {
setPropertyIfNotSet(entry.getKey(), entry.getValue());
if (id != null) {
setPropertyIfNotSet(entry.getKey() + "." + id, entry.getValue());
}
}
if (getEnvironmentPrefix() != null) {
Property propTask = new Property();
propTask.setProject(project);
propTask.setEnvironment(getEnvironmentPrefix());
propTask.init();
propTask.execute();
}
}
示例3: handlePropertyParameter
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private void handlePropertyParameter() {
if (isRequired() && getProject().getProperty(property) == null) {
throw new BuildException("expected property '" + property + "': " + description);
}
if (!possibleValues.isEmpty()) {
String currentValue = getProject().getProperty(property);
if (!possibleValues.contains(currentValue)) {
throw new BuildException("current value of property '" + property
+ "' doesn't match with possible values : " + possibleValues.toString());
}
}
if (defaultValue != null && getProject().getProperty(property) == null) {
Property propTask = new Property();
propTask.setProject(getProject());
propTask.setTaskName(getTaskName());
propTask.setName(property);
propTask.setValue(defaultValue);
propTask.execute();
}
}
示例4: overrideProperties
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
/**
* Override the properties in the new project with the one explicitly defined
* as nested elements here.
*
* @exception BuildException Description of the Exception
*/
private void overrideProperties() throws BuildException {
Enumeration e = properties.elements();
while ( e.hasMoreElements() ) {
Property p = (Property)e.nextElement();
p.setProject( newProject );
p.execute();
}
getProject().copyInheritedProperties( newProject );
}
示例5: setPropertyValue
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
protected final void setPropertyValue(String value) {
if (value != null) {
if (override) {
if (getProject().getUserProperty(property) == null)
getProject().setProperty(property, value);
else
getProject().setUserProperty(property, value);
} else {
Property p = (Property) project.createTask("property");
p.setName(property);
p.setValue(value);
p.execute();
}
}
}
示例6: overrideProperties
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
/**
* Override the properties in the new project with the one explicitly
* defined as nested elements here.
*
* @exception BuildException
* Description of the Exception
*/
private void overrideProperties() throws BuildException {
Enumeration e = properties.elements();
while (e.hasMoreElements()) {
Property p = (Property) e.nextElement();
p.setProject(newProject);
p.execute();
}
getProject().copyInheritedProperties(newProject);
}
示例7: setResultPropertyValue
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
protected final void setResultPropertyValue(Project project, String value) {
if (value != null) {
if (override) {
if (project.getUserProperty(resultproperty) == null)
project.setProperty(resultproperty, value);
else
project.setUserProperty(resultproperty, value);
} else {
Property p = (Property) project.createTask("property");
p.setName(resultproperty);
p.setValue(value);
p.execute();
}
}
}
示例8: createAntProperty
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private Property createAntProperty( String name, String value )
{
Property property = new Property();
property.setProject( antProject() );
property.setName( name );
property.setValue( value );
property.execute();
return property;
}
示例9: setProperty
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
private void setProperty(final String name, final String value) {
final Property property = (Property) getProject().createTask("property");
property.setOwningTarget(getOwningTarget());
property.init();
property.setName(name);
property.setValue(value);
property.execute();
}
示例10: execute
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
public void execute() {
validate();
final byte[] bytes = readFully();
final String input = new String(bytes);
final String output = performMatching(input);
if (output != null) {
Property p = (Property) getProject().createTask("property");
p.setName(property);
p.setValue(output);
p.execute();
}
}
示例11: execute
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
public void execute() throws BuildException {
try {
super.execute();
} catch (final BuildException be) {
if (failonerror) throw be;
if (null != failonerrorProperty) {
final Property property = (Property) getProject().createTask("property");
property.setOwningTarget(getOwningTarget());
property.init();
property.setName(failonerrorProperty);
property.setValue("true");
property.execute();
}
}
}
示例12: createIvyEngine
import org.apache.tools.ant.taskdefs.Property; //导入方法依赖的package包/类
void createIvyEngine(final ProjectComponent task) {
Project project = task.getProject();
Property prop = new Property() {
public void execute() throws BuildException {
addProperties(getDefaultProperties(task));
}
};
prop.setProject(project);
prop.init();
prop.execute();
IvyAntVariableContainer ivyAntVariableContainer = new IvyAntVariableContainer(project);
IvySettings settings = new IvySettings(ivyAntVariableContainer);
settings.setBaseDir(project.getBaseDir());
if (file == null && url == null) {
defineDefaultSettingFile(ivyAntVariableContainer, task);
}
if (antWorkspaceResolver != null) {
settings.addConfigured(antWorkspaceResolver.getResolver());
}
Ivy ivy = Ivy.newInstance(settings);
try {
ivy.pushContext();
AntMessageLogger.register(task, ivy);
Message.showInfo();
configureURLHandler();
if (file != null) {
if (!file.exists()) {
throw new BuildException("settings file does not exist: " + file);
}
ivy.configure(file);
} else {
if (url == null) {
throw new AssertionError(
"ivy setting should have either a file, either an url,"
+ " and if not defineDefaultSettingFile must set it.");
}
ivy.configure(url);
}
ivyAntVariableContainer.updateProject(id);
ivyEngine = ivy;
} catch (ParseException | IOException e) {
throw new BuildException("impossible to configure ivy:settings with given "
+ (file != null ? "file: " + file : "url: " + url) + " : " + e, e);
} finally {
ivy.popContext();
}
}