本文整理了Java中org.apache.tools.ant.Project.addReference()
方法的一些代码示例,展示了Project.addReference()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.addReference()
方法的具体详情如下:
包路径:org.apache.tools.ant.Project
类名称:Project
方法名:addReference
[英]Add a reference to the project.
[中]添加对项目的引用。
代码示例来源:origin: org.apache.ant/ant
/**
* Sets the VM launcher to use for the given project.
*
* @param project Project
* @param launcher CommandLauncher
*/
public static void setVMLauncher(Project project,
CommandLauncher launcher) {
if (project != null) {
project.addReference(ANT_VM_LAUNCHER_REF_ID, launcher);
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Set the Executor instance for this Project.
* @param e the Executor to use.
*/
public void setExecutor(final Executor e) {
addReference(MagicNames.ANT_EXECUTOR_REFERENCE, e);
}
代码示例来源:origin: org.apache.ant/ant
/**
* Sets the shell launcher to use for the given project.
*
* @param project Project
* @param launcher CommandLauncher
*/
public static void setShellLauncher(Project project,
CommandLauncher launcher) {
if (project != null) {
project.addReference(ANT_SHELL_LAUNCHER_REF_ID, launcher);
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Scans an attribute list for the <code>id</code> attribute and
* stores a reference to the target object in the project if an
* id is found.
* <p>
* This method was moved out of the configure method to allow
* it to be executed at parse time.
*
* @see #configure(Object,AttributeList,Project)
*/
private void configureId(Object target, AttributeList attr) {
String id = attr.getValue("id");
if (id != null) {
project.addReference(id, target);
}
}
}
代码示例来源:origin: org.apache.ant/ant
/**
* Finds or creates the script repository - it is stored in the project.
* This method is synchronized on the project under {@link MagicNames#SCRIPT_REPOSITORY}
* @return the current script repository registered as a reference.
*/
private Map<String, ScriptDef> lookupScriptRepository() {
Map<String, ScriptDef> scriptRepository;
Project p = getProject();
synchronized (p) {
scriptRepository =
p.getReference(MagicNames.SCRIPT_REPOSITORY);
if (scriptRepository == null) {
scriptRepository = new HashMap<>();
p.addReference(MagicNames.SCRIPT_REPOSITORY,
scriptRepository);
}
}
return scriptRepository;
}
代码示例来源:origin: apache/groovy
public void execute() throws BuildException {
if (taskClasspath==null || taskClasspath.size()==0) {
throw new BuildException("no classpath given");
}
Project project = getProject();
AntClassLoader loader = new AntClassLoader(makeRoot(),true);
project.addReference(name,loader);
}
代码示例来源:origin: org.apache.ant/ant
cl = getUniqueClassLoaderForPath(p, path, reverseLoader);
if (loaderId != null && reuseLoader) {
p.addReference(loaderId, cl);
代码示例来源:origin: org.apache.ant/ant
/**
* Find a project component for a specific project, creating
* it if it does not exist.
* @param project the project.
* @return the project component for a specific project.
*/
public static ComponentHelper getComponentHelper(Project project) {
if (project == null) {
return null;
}
// Singleton for now, it may change (per/classloader)
ComponentHelper ph = project.getReference(COMPONENT_HELPER_REFERENCE);
if (ph != null) {
return ph;
}
ph = new ComponentHelper();
ph.setProject(project);
project.addReference(COMPONENT_HELPER_REFERENCE, ph);
return ph;
}
代码示例来源:origin: org.apache.ant/ant
/**
* Configures the project with the contents of the specified build file.
*
* @param project The project to configure. Must not be <code>null</code>.
* @param buildFile A build file giving the project's configuration.
* Must not be <code>null</code>.
*
* @exception BuildException if the configuration is invalid or cannot be read
*/
public static void configureProject(Project project, File buildFile) throws BuildException {
FileResource resource = new FileResource(buildFile);
ProjectHelper helper = ProjectHelperRepository.getInstance().getProjectHelperForBuildFile(resource);
project.addReference(PROJECTHELPER_REFERENCE, helper);
helper.parse(project, buildFile);
}
代码示例来源:origin: org.apache.ant/ant
newProject.addReference(newKey, copy);
代码示例来源:origin: org.apache.ant/ant
/**
* Get a localproperties for the given project.
* @param project the project to retrieve the localproperties for.
* @return the localproperties.
*/
public static synchronized LocalProperties get(Project project) {
LocalProperties l =
project.getReference(MagicNames.REFID_LOCAL_PROPERTIES);
if (l == null) {
l = new LocalProperties();
project.addReference(MagicNames.REFID_LOCAL_PROPERTIES, l);
PropertyHelper.getPropertyHelper(project).add(l);
}
return l;
}
代码示例来源:origin: org.apache.ant/ant
/**
* Factory method to create a property processor.
* Users can provide their own or replace it using "ant.PropertyHelper"
* reference. User tasks can also add themselves to the chain, and provide
* dynamic properties.
*
* @param project the project for which the property helper is required.
*
* @return the project's property helper.
*/
public static synchronized PropertyHelper getPropertyHelper(Project project) {
PropertyHelper helper = null;
if (project != null) {
helper = project.getReference(MagicNames.REFID_PROPERTY_HELPER);
}
if (helper != null) {
return helper;
}
helper = new PropertyHelper();
helper.setProject(project);
if (project != null) {
project.addReference(MagicNames.REFID_PROPERTY_HELPER, helper);
}
return helper;
}
代码示例来源:origin: micronaut-projects/micronaut-core
/**
* @return Factory method to create new Project instances
*/
@SuppressWarnings("unchecked")
protected static Project createAntProject() {
final Project project = new Project();
final ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty
addMicronautConsoleBuildListener(project);
project.init();
project.getBaseDir();
return project;
}
代码示例来源:origin: org.apache.ant/ant
getProject().addReference(id, value);
代码示例来源:origin: org.apache.ant/ant
log("Installing PropertyHelper " + propertyHelper, Project.MSG_DEBUG);
getProject().addReference(MagicNames.REFID_PROPERTY_HELPER, propertyHelper);
代码示例来源:origin: org.apache.ant/ant
helperImpl.project.addReference(name, helperImpl.project);
helperImpl.project.addReference(id, helperImpl.project);
代码示例来源:origin: apache/groovy
/**
* @return Factory method to create new Project instances
*/
protected static Project createProject() {
final Project project = new Project();
final ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty
final BuildLogger logger = new NoBannerLogger();
logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO);
logger.setOutputPrintStream(System.out);
logger.setErrorPrintStream(System.err);
project.addBuildListener(logger);
project.init();
project.getBaseDir();
return project;
}
代码示例来源:origin: org.apache.ant/ant
if (context == null) {
context = new AntXMLContext(project);
project.addReference(REFID_CONTEXT, context);
project.addReference(REFID_TARGETS, context.getTargets());
代码示例来源:origin: org.apache.ant/ant
getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, subHelper);
getProject().addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
helper.getImportStack().clear();
helper.getImportStack().addAll(subHelper.getImportStack());
代码示例来源:origin: org.apache.ant/ant
getProject().addReference(loader.getRefId(), cl);
内容来源于网络,如有侵权,请联系作者删除!