本文整理匯總了Java中org.apache.tools.ant.ProjectHelperRepository類的典型用法代碼示例。如果您正苦於以下問題:Java ProjectHelperRepository類的具體用法?Java ProjectHelperRepository怎麽用?Java ProjectHelperRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ProjectHelperRepository類屬於org.apache.tools.ant包,在下文中一共展示了ProjectHelperRepository類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUp
import org.apache.tools.ant.ProjectHelperRepository; //導入依賴的package包/類
@Before
public void setUp() {
// ProjectHelperRepository.getInstance().registerProjectHelper("org.apache.easyant.core.ant.EasyAntProjectHelper");
ProjectHelperRepository.getInstance().registerProjectHelper(
"org.apache.easyant.core.ant.helper.ModuleIvyProjectHelper");
}
示例2: importResource
import org.apache.tools.ant.ProjectHelperRepository; //導入依賴的package包/類
private void importResource(ProjectHelper helper,
Resource importedResource) {
getProject().log("Importing file " + importedResource + " from "
+ getLocation().getFileName(), Project.MSG_VERBOSE);
if (!importedResource.isExists()) {
String message =
"Cannot find " + importedResource + " imported from "
+ getLocation().getFileName();
if (optional) {
getProject().log(message, Project.MSG_VERBOSE);
return;
}
throw new BuildException(message);
}
if (!isInIncludeMode() && hasAlreadyBeenImported(importedResource,
helper.getImportStack())) {
getProject().log(
"Skipped already imported file:\n "
+ importedResource + "\n", Project.MSG_VERBOSE);
return;
}
// nested invocations are possible like an imported file
// importing another one
String oldPrefix = ProjectHelper.getCurrentTargetPrefix();
boolean oldIncludeMode = ProjectHelper.isInIncludeMode();
String oldSep = ProjectHelper.getCurrentPrefixSeparator();
try {
String prefix;
if (isInIncludeMode() && oldPrefix != null
&& targetPrefix != null) {
prefix = oldPrefix + oldSep + targetPrefix;
} else if (isInIncludeMode()) {
prefix = targetPrefix;
} else if (ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX.equals(targetPrefix)) {
prefix = oldPrefix;
} else {
prefix = targetPrefix;
}
setProjectHelperProps(prefix, prefixSeparator,
isInIncludeMode());
ProjectHelper subHelper = ProjectHelperRepository.getInstance().getProjectHelperForBuildFile(
importedResource);
// push current stacks into the sub helper
subHelper.getImportStack().addAll(helper.getImportStack());
subHelper.getExtensionStack().addAll(helper.getExtensionStack());
getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, subHelper);
subHelper.parse(getProject(), importedResource);
// push back the stack from the sub helper to the main one
getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
helper.getImportStack().clear();
helper.getImportStack().addAll(subHelper.getImportStack());
helper.getExtensionStack().clear();
helper.getExtensionStack().addAll(subHelper.getExtensionStack());
} catch (BuildException ex) {
throw ProjectHelper.addLocationToBuildException(
ex, getLocation());
} finally {
setProjectHelperProps(oldPrefix, oldSep, oldIncludeMode);
}
}
示例3: execute
import org.apache.tools.ant.ProjectHelperRepository; //導入依賴的package包/類
@Override
public void execute() throws BuildException {
projectHelpers.stream().map(ProjectHelper::getClass).forEach(
ProjectHelperRepository.getInstance()::registerProjectHelper);
}