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

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

Introduction

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

Prototype

public static Project getProject(JellyContext context) 

Source Link

Document

A helper method which will attempt to find a project in the current context or install one if need be.

Usage

From source file:org.apache.cactus.integration.maven.CactusScannerTag.java

/**
 * @param theXmlOutput the xml to hold the tag being made
 * @see TagSupport#doTag(XMLOutput)/*  w  w w  . j  av  a2  s.c o  m*/
 * @throws JellyTagException when proccess fails
 */
public void doTag(XMLOutput theXmlOutput) throws JellyTagException {
    this.cactusScanner.setProject(AntTagLibrary.getProject(context));
    this.cactusScanner.clear();

    // run the body first to configure the task via nested tags
    invokeBody(theXmlOutput);

    // Process the fileset to extract Cactus test cases. We need to pass
    // the project dependency classpath as the CactusScanner will need
    // to load the cactus test classes to decide whether they are Cactus
    // test case or not and that needs the dependent jars to be in the
    // classpath.
    Path cp = this.classpath;
    if (this.classpathref != null) {
        cp = (Path) AntTagLibrary.getProject(context).getReference(this.classpathref);
    }

    this.cactusScanner.processFileSet(this.fileset, cp);

    // output the cactusScanner
    if (var == null) {
        throw new MissingAttributeException("var");
    }
    context.setVariable(var, cactusScanner);
}

From source file:org.apache.cactus.integration.maven.CactusScannerTag.java

/**
 * @return a newly created and empty {@link Path} object
 *//*from  w ww.ja  va2s .c  om*/
public Path createClasspath() {
    log.debug("Creating classpath");
    if (this.classpath == null) {
        this.classpath = new Path(AntTagLibrary.getProject(context));
    }
    return this.classpath.createPath();
}