當前位置: 首頁>>代碼示例>>Java>>正文


Java ProjectHelperRepository類代碼示例

本文整理匯總了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");
}
 
開發者ID:apache,項目名稱:ant-easyant-core,代碼行數:8,代碼來源:ModuleIvyProjectHelperTest.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:ant,代碼行數:68,代碼來源:ImportTask.java

示例3: execute

import org.apache.tools.ant.ProjectHelperRepository; //導入依賴的package包/類
@Override
public void execute() throws BuildException {
    projectHelpers.stream().map(ProjectHelper::getClass).forEach(
        ProjectHelperRepository.getInstance()::registerProjectHelper);
}
 
開發者ID:apache,項目名稱:ant,代碼行數:6,代碼來源:ProjectHelperTask.java


注:本文中的org.apache.tools.ant.ProjectHelperRepository類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。