Example usage for org.apache.commons.jelly.tags.ant AntTagLibrary setProject

List of usage examples for org.apache.commons.jelly.tags.ant AntTagLibrary setProject

Introduction

In this page you can find the example usage for org.apache.commons.jelly.tags.ant AntTagLibrary setProject.

Prototype

public static void setProject(JellyContext context, Project project) 

Source Link

Document

Sets the Ant Project to be used for this JellyContext.

Usage

From source file:org.apache.maven.AntProjectBuilder.java

/**
 * Initialize Ant./*w  w w .  j av  a  2  s . c o m*/
 * @param project a Maven project
 * @param context the maven context whose properties will be available to the Ant Project
 * @return an Ant project
 */
public static GrantProject build(final Project project, final MavenJellyContext context) {
    // Create the build listener.
    JellyBuildListener buildListener = new JellyBuildListener(context.getXMLOutput());
    buildListener.setDebug(context.getDebugOn().booleanValue());
    buildListener.setEmacsMode(context.getEmacsModeOn().booleanValue());

    // Create our ant project.
    GrantProject antProject = new GrantProject();
    antProject.setPropsHandler(new JellyPropsHandler(context));
    antProject.init();
    antProject.setBaseDir(project.getFile().getParentFile().getAbsoluteFile());
    antProject.addBuildListener(buildListener);

    try {
        antProject.addBuildListener(new UdpBuildEventPublisher());
    } catch (Exception e) {
        LogFactory.getLog("net.sourceforge.vulcan.maven")
                .error("Failed to add Vulcan BuildListener to Ant Project", e);
    }

    context.setAntProject(antProject);
    AntTagLibrary.setProject(context, antProject);

    Path p = new Path(antProject);
    p.setPath(project.getDependencyClasspath());
    antProject.addReference(MavenConstants.DEPENDENCY_CLASSPATH, p);

    return antProject;
}