All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.mojo.apt.ProcessMojo Maven / Gradle / Ivy

There is a newer version: 1.0-alpha-5
Show newest version
package org.codehaus.mojo.apt;

/*
 * The MIT License
 *
 * Copyright 2006-2008 The Codehaus.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do
 * so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

import java.io.File;
import java.util.List;
import java.util.Set;

import org.apache.maven.model.Resource;

/**
 * Executes apt on project sources.
 * 
 * @author Juraj Burian
 * @author Mark Hobson
 * @version $Id: ProcessMojo.java 11632 2010-01-12 17:17:35Z mark $
 * @goal process
 * @phase generate-resources
 * @requiresDependencyResolution compile
 */
public class ProcessMojo extends AbstractAptMojo
{
    // read-only parameters ---------------------------------------------------

    /**
     * The source directories containing the sources to be processed.
     * 
     * @parameter expression="${project.compileSourceRoots}"
     * @required
     * @readonly
     */
    private List compileSourceRoots;

    /**
     * The project's resources.
     * 
     * @parameter expression="${project.resources}"
     * @required
     * @readonly
     */
    private List resources;
    
    /**
     * The project's classpath.
     * 
     * @parameter expression="${project.compileClasspathElements}"
     * @required
     * @readonly
     */
    private List classpathElements;

    // configurable parameters ------------------------------------------------

    /**
     * A set of inclusion filters for apt. Default value is **/*.java.
     * 
     * @parameter
     */
    private Set includes;

    /**
     * A set of exclusion filters for apt.
     * 
     * @parameter
     */
    private Set excludes;

    /**
     * The directory to place processor and generated class files. This is equivalent to the -d argument
     * for apt.
     * 
     * @parameter default-value="${project.build.directory}/generated-resources/apt"
     */
    private File outputDirectory;

    /**
     * The directory root under which processor-generated source files will be placed; files are placed in
     * subdirectories based on package namespace. This is equivalent to the -s argument for apt.
     * 
     * @parameter default-value="${project.build.directory}/generated-sources/apt"
     */
    private File sourceOutputDirectory;
    
    // AbstractAptMojo methods ------------------------------------------------

    /**
     * {@inheritDoc}
     */
    @Override
    protected List getCompileSourceRoots()
    {
        return compileSourceRoots;
    }
    
    /**
     * {@inheritDoc}
     */
    @Override
    protected List getResources()
    {
        return resources;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected List getClasspathElements()
    {
        return classpathElements;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Set getIncludes()
    {
        return includes;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Set getExcludes()
    {
        return excludes;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected File getOutputDirectory()
    {
        return outputDirectory;
    }
    
    /**
     * {@inheritDoc}
     */
    @Override
    protected File getSourceOutputDirectory()
    {
        return sourceOutputDirectory;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy