当前位置: 首页>>代码示例>>Java>>正文


Java ProjectComponent.getProject方法代码示例

本文整理汇总了Java中org.apache.tools.ant.ProjectComponent.getProject方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectComponent.getProject方法的具体用法?Java ProjectComponent.getProject怎么用?Java ProjectComponent.getProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.ProjectComponent的用法示例。


在下文中一共展示了ProjectComponent.getProject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDefaultInstance

import org.apache.tools.ant.ProjectComponent; //导入方法依赖的package包/类
/**
 * Returns the default ivy settings of this classloader. If it doesn't exist yet, a new one is
 * created using the given project to back the VariableContainer.
 *
 * @param task
 *            TODO add text.
 * @return An IvySetting instance.
 */
public static IvyAntSettings getDefaultInstance(ProjectComponent task) {
    Project project = task.getProject();
    Object defaultInstanceObj = project.getReference("ivy.instance");
    if (defaultInstanceObj != null
            && defaultInstanceObj.getClass().getClassLoader() != IvyAntSettings.class
                    .getClassLoader()) {
        task.log("ivy.instance reference an ivy:settings defined in an other classloader.  "
                + "An new default one will be used in this project.", Project.MSG_WARN);
        defaultInstanceObj = null;
    }
    if (defaultInstanceObj != null && !(defaultInstanceObj instanceof IvyAntSettings)) {
        throw new BuildException("ivy.instance reference a "
                + defaultInstanceObj.getClass().getName()
                + " an not an IvyAntSettings.  Please don't use this reference id ()");
    }
    if (defaultInstanceObj == null) {
        task.log("No ivy:settings found for the default reference 'ivy.instance'.  "
                + "A default instance will be used", Project.MSG_VERBOSE);

        IvyAntSettings settings = new IvyAntSettings();
        settings.setProject(project);
        project.addReference("ivy.instance", settings);
        settings.createIvyEngine(task);
        return settings;
    } else {
        return (IvyAntSettings) defaultInstanceObj;
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:37,代码来源:IvyAntSettings.java

示例2: bindToComponent

import org.apache.tools.ant.ProjectComponent; //导入方法依赖的package包/类
/**
 * Bind the runner to a project component.
 * Properties, targets and references are all added as beans;
 * project is bound to project, and self to the component.
 * @param component to become <code>self</code>
 */
public void bindToComponent(ProjectComponent component) {
    project = component.getProject();
    addBeans(project.getProperties());
    addBeans(project.getUserProperties());
    addBeans(project.getCopyOfTargets());
    addBeans(project.getCopyOfReferences());
    addBean("project", project);
    addBean("self", component);
}
 
开发者ID:apache,项目名称:ant,代码行数:16,代码来源:ScriptRunnerBase.java

示例3: createIvyEngine

import org.apache.tools.ant.ProjectComponent; //导入方法依赖的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();
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:53,代码来源:IvyAntSettings.java

示例4: bindToComponentMinimum

import org.apache.tools.ant.ProjectComponent; //导入方法依赖的package包/类
/**
 * Bind the runner to a project component.
 * The project and self are the only beans set.
 * @param component to become <code>self</code>
 */
public void bindToComponentMinimum(ProjectComponent component) {
    project = component.getProject();
    addBean("project", project);
    addBean("self", component);
}
 
开发者ID:apache,项目名称:ant,代码行数:11,代码来源:ScriptRunnerBase.java


注:本文中的org.apache.tools.ant.ProjectComponent.getProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。