You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2014/04/13 10:26:29 UTC
svn commit: r1586934 - in /maven/plugins/trunk/maven-checkstyle-plugin:
pom.xml
src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
Author: rfscholte
Date: Sun Apr 13 08:26:28 2014
New Revision: 1586934
URL: http://svn.apache.org/r1586934
Log:
[MCHECKSTYLE-225] headerLocation no longer sets checkstyle.header.file
Make it M2 compatible
Modified:
maven/plugins/trunk/maven-checkstyle-plugin/pom.xml
maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
Modified: maven/plugins/trunk/maven-checkstyle-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/pom.xml?rev=1586934&r1=1586933&r2=1586934&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/pom.xml Sun Apr 13 08:26:28 2014
@@ -84,6 +84,11 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>${mavenVersion}</version>
</dependency>
Modified: maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java?rev=1586934&r1=1586933&r2=1586934&view=diff
==============================================================================
--- maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java (original)
+++ maven/plugins/trunk/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleViolationCheckMojo.java Sun Apr 13 08:26:28 2014
@@ -29,6 +29,7 @@ import org.apache.maven.model.Dependency
import org.apache.maven.model.Plugin;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
@@ -313,6 +314,10 @@ public class CheckstyleViolationCheckMoj
@Parameter( defaultValue= "${plugin}" )
private PluginDescriptor plugin;
+ // remove when requiring Maven 3.x, just use #plugin
+ @Parameter( defaultValue= "${mojoExecution}" )
+ private MojoExecution mojoExecution;
+
/**
* If <code>null</code>, the Checkstyle plugin will display violations on stdout.
* Otherwise, a text file will be created with the violations.
@@ -696,6 +701,12 @@ public class CheckstyleViolationCheckMoj
private List<Artifact> collectArtifacts( String hint )
{
+ if ( plugin == null || plugin.getGroupId() == null )
+ {
+ // Maven 2.x workaround
+ plugin = mojoExecution.getMojoDescriptor().getPluginDescriptor();
+ }
+
List<Artifact> artifacts = new ArrayList<Artifact>();
Plugin checkstylePlugin =