Merge pull request #148 from marschall/dont-run-on-poms

Skip Plugin Exceution for POM Projects
This commit is contained in:
Leonid Shalupov
2012-12-05 07:21:06 -08:00
2 changed files with 19 additions and 0 deletions
@@ -25,6 +25,11 @@
<artifactId>maven-plugin-api</artifactId> <artifactId>maven-plugin-api</artifactId>
<version>${maven.version}</version> <version>${maven.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler</artifactId> <artifactId>kotlin-compiler</artifactId>
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.maven;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.google.common.io.Resources; import com.google.common.io.Resources;
import org.apache.maven.project.MavenProject;
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.MojoFailureException;
@@ -128,8 +129,21 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
*/ */
public String testModule; public String testModule;
/**
* The maven project.
*
* @parameter default-value="${project}"
* @required
* @readonly
*/
public MavenProject project;
@Override @Override
public void execute() throws MojoExecutionException, MojoFailureException { public void execute() throws MojoExecutionException, MojoFailureException {
if (project.getPackaging().equals("pom")) {
getLog().info( "Skipping Kotlin execution for POM projects" );
}
// Check sources // Check sources
List<String> sources = getSources(); List<String> sources = getSources();
if (sources != null && sources.size() > 0) { if (sources != null && sources.size() > 0) {