org.codehaus.mojo.groovy.compile.TestCompileMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of groovy-maven-plugin Show documentation
Show all versions of groovy-maven-plugin Show documentation
Provides support for execution, compilation and other facets of Groovy development.
The newest version!
/*
* Copyright (C) 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.mojo.groovy.compile;
import java.io.File;
import java.util.List;
import java.util.Set;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.shared.model.fileset.FileSet;
/**
* Compiles Groovy test sources.
*
* @goal testCompile
* @phase test-compile
* @requiresDependencyResolution test
* @since 1.0-alpha-1
*
* @version $Id: TestCompileMojo.java 5428 2007-10-22 22:54:27Z user57 $
* @author Jason Dillon
*/
public class TestCompileMojo
extends AbstractCompileMojo
{
/**
* The directory where generated Java class files will be placed.
*
* @parameter default-value="${project.build.testOutputDirectory}"
* @required
*
* @noinspection UnusedDeclaration
*/
private File outputDirectory;
/**
* Flag to allow test compiliation to be skipped.
*
* @parameter expression="${maven.test.skip}" default-value="false"
*
* @noinspection UnusedDeclaration
*/
private boolean skip;
protected List getProjectClasspathElements() throws DependencyResolutionRequiredException {
return project.getTestClasspathElements();
}
protected File getOutputDirectory() {
return outputDirectory;
}
protected List getSourceRoots() {
return project.getTestCompileSourceRoots();
}
protected FileSet[] getDefaultSources() {
FileSet set = new FileSet();
File basedir = new File(project.getBasedir(), "src/test/groovy");
set.setDirectory(basedir.getAbsolutePath());
set.addInclude("**/*.groovy");
return new FileSet[] { set };
}
protected Set getForcedCompileSources() {
return compileState.getForcedCompilationTestSources(true);
}
protected void doExecute() throws Exception {
if (skip) {
log.info("Test compiliation is skipped");
}
else {
super.doExecute();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy