Merge branch 'release/2.1.0'

* release/2.1.0:
  CHANGELOG
  pom.xml: version set to 2.1.0
  plugin:pom.xml: upgrade dependencies
  builder:pom.xml: upgrade dependencies
  plugin:AbstractCheckMojo: load dependency versions from plugin pom.xml
  plugin:AbstractCheckMojo: include ruleset version on log line
  plugin:AbstractCheckMojo: use ruleset version from pom.xml
  plugin:AbstractCheckMojo: upgrade checkstyle to 7.5.1
  plugin-sample:Sample: add note clarifying ruleset level compliance
  plugin:AbstractCheckMojo: upgrade checkstyle to 7.4
  plugin-sample:pom.xml: fix name of plugin
  Add release profile for release-only plugins
  pom.xml: version set to 2.1.0-SNAPSHOT
This commit is contained in:
Paul Campbell 2017-02-08 12:27:52 +00:00
commit 7e96bd3558
10 changed files with 262 additions and 150 deletions

View file

@ -1,6 +1,11 @@
CHANGELOG CHANGELOG
========= =========
2.1.0
-----
* Upgrade dependencies, including checkstyle to 7.5.1
2.0.3 2.0.3
----- -----

View file

@ -35,7 +35,7 @@ The following goals implement increasingly strict rulesets:
```` ````
<properties> <properties>
<kemitix-checkstyle-ruleset.version>2.0.0</kemitix-checkstyle-ruleset.version> <kemitix-checkstyle-ruleset.version>2.1.0</kemitix-checkstyle-ruleset.version>
<kemitix-checkstyle-ruleset.level>5-complexity</kemitix-checkstyle-ruleset.level> <kemitix-checkstyle-ruleset.level>5-complexity</kemitix-checkstyle-ruleset.level>
</properties> </properties>

View file

@ -12,7 +12,7 @@
</parent> </parent>
<artifactId>kemitix-checkstyle-ruleset-builder</artifactId> <artifactId>kemitix-checkstyle-ruleset-builder</artifactId>
<version>2.0.4</version> <version>2.1.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Kemitix Checkstyle Ruleset Builder</name> <name>Kemitix Checkstyle Ruleset Builder</name>
@ -37,10 +37,10 @@
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>1.4.3.RELEASE</spring-boot.version> <spring-boot.version>1.5.1.RELEASE</spring-boot.version>
<lombok.version>1.16.12</lombok.version> <lombok.version>1.16.12</lombok.version>
<assertj.version>3.6.1</assertj.version> <assertj.version>3.6.2</assertj.version>
<mapstream.version>2.3.4</mapstream.version> <mapstream.version>2.3.5</mapstream.version>
<mapbuilder.version>1.0.0</mapbuilder.version> <mapbuilder.version>1.0.0</mapbuilder.version>
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version> <coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
</properties> </properties>

View file

@ -35,7 +35,7 @@ The following goals implement increasingly strict rulesets:
```` ````
<properties> <properties>
<kemitix-checkstyle-ruleset.version>2.0.0</kemitix-checkstyle-ruleset.version> <kemitix-checkstyle-ruleset.version>2.1.0</kemitix-checkstyle-ruleset.version>
<kemitix-checkstyle-ruleset.level>5-complexity</kemitix-checkstyle-ruleset.level> <kemitix-checkstyle-ruleset.level>5-complexity</kemitix-checkstyle-ruleset.level>
</properties> </properties>

View file

@ -8,9 +8,9 @@
<!-- don't use parent to avoid using grandparent's checkstyle configuration --> <!-- don't use parent to avoid using grandparent's checkstyle configuration -->
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset-plugin-sample</artifactId> <artifactId>kemitix-checkstyle-ruleset-plugin-sample</artifactId>
<version>2.0.4</version> <version>2.1.0</version>
<name>plugin-sample</name> <name>Kemitix Checkstyle Ruleset Plugin Sample</name>
<description>Sample usage of the Kemitix Checkstyle Ruleset Plugin</description> <description>Sample usage of the Kemitix Checkstyle Ruleset Plugin</description>
<url>https://github.com/kemitix/kemitix-checkstyle-ruleset</url> <url>https://github.com/kemitix/kemitix-checkstyle-ruleset</url>
<licenses> <licenses>
@ -57,6 +57,13 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<!-- plugin sequence: javadoc, sources, gpg, deploy --> <!-- plugin sequence: javadoc, sources, gpg, deploy -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -113,6 +120,8 @@
</plugin><!-- maven deploy-plugin --> </plugin><!-- maven deploy-plugin -->
</plugins> </plugins>
</build> </build>
</profile><!-- release -->
</profiles>
<pluginRepositories> <pluginRepositories>
<pluginRepository> <pluginRepository>

View file

@ -27,6 +27,9 @@ package net.kemitix.checkstyle.sample;
/** /**
* Sample class to test the Kemitix Checkstyle Ruleset Maven Plugin against. * Sample class to test the Kemitix Checkstyle Ruleset Maven Plugin against.
* *
* <p>This sample is deliberately only valid for level 1-layout and 2-naming. The plugin should report errors for levels
* 3-javadoc and above.</p>
*
* @author Paul Campbell (paul.campbell@hubio.com) * @author Paul Campbell (paul.campbell@hubio.com)
*/ */
public class Sample { public class Sample {

View file

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset-parent</artifactId> <artifactId>kemitix-checkstyle-ruleset-parent</artifactId>
<version>2.0.4</version> <version>2.1.0</version>
</parent> </parent>
<artifactId>kemitix-checkstyle-ruleset-maven-plugin</artifactId> <artifactId>kemitix-checkstyle-ruleset-maven-plugin</artifactId>
@ -20,7 +20,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.version>3.3.9</maven.version> <maven.version>3.3.9</maven.version>
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version> <maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
<maven-plugin-plugin.version>3.5</maven-plugin-plugin.version> <maven-plugin-plugin.version>3.5</maven-plugin-plugin.version>
<maven-plugin-annotations.version>3.5</maven-plugin-annotations.version> <maven-plugin-annotations.version>3.5</maven-plugin-annotations.version>
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version> <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
@ -30,6 +30,11 @@
<mojo-executor.version>2.2.0</mojo-executor.version> <mojo-executor.version>2.2.0</mojo-executor.version>
<lombok.version>1.16.12</lombok.version> <lombok.version>1.16.12</lombok.version>
<map-builder.version>1.0.0</map-builder.version> <map-builder.version>1.0.0</map-builder.version>
<properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
<maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version>
<checkstyle.version>7.5.1</checkstyle.version>
<sevntu.version>1.23.0</sevntu.version>
</properties> </properties>
<dependencies> <dependencies>
@ -96,6 +101,41 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin><!-- maven-compiler-plugin --> </plugin><!-- maven-compiler-plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>${properties-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>maven-checkstyle-plugin.version</name>
<value>${maven-checkstyle-plugin.version}</value>
</property>
<property>
<name>checkstyle.version</name>
<value>${checkstyle.version}</value>
</property>
<property>
<name>sevntu.version</name>
<value>${sevntu.version}</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin><!-- properties-maven-plugin -->
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<!-- plugin sequence: javadoc, sources, gpg, deploy --> <!-- plugin sequence: javadoc, sources, gpg, deploy -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -152,6 +192,8 @@
</plugin><!-- maven deploy-plugin --> </plugin><!-- maven deploy-plugin -->
</plugins> </plugins>
</build> </build>
</profile><!-- release -->
</profiles>
<pluginRepositories> <pluginRepositories>
<pluginRepository> <pluginRepository>
<id>sevntu-maven</id> <id>sevntu-maven</id>

View file

@ -62,19 +62,7 @@ public abstract class AbstractCheckMojo extends AbstractMojo {
private static final String CONFIG_LOCATION = "configLocation"; private static final String CONFIG_LOCATION = "configLocation";
@Setter @Setter
@Parameter(defaultValue = "2.17") @Parameter(defaultValue = "${project.version}")
private String mavenCheckstylePluginVersion;
@Setter
@Parameter(defaultValue = "7.3")
private String checkstyleVersion;
@Setter
@Parameter(defaultValue = "1.23.0")
private String sevntuVersion;
@Setter
@Parameter(defaultValue = "2.0.4")
private String rulesetVersion; private String rulesetVersion;
@Setter @Setter
@ -97,6 +85,12 @@ public abstract class AbstractCheckMojo extends AbstractMojo {
* @throws MojoFailureException on execution failure * @throws MojoFailureException on execution failure
*/ */
protected final void performCheck(final String level) throws MojoExecutionException, MojoFailureException { protected final void performCheck(final String level) throws MojoExecutionException, MojoFailureException {
// load versions from plugin's pom.xml
val properties = System.getProperties();
val mavenCheckstylePluginVersion = properties.getProperty("maven-checkstyle-plugin.version");
val checkstyleVersion = properties.getProperty("checkstyle.version");
val sevntuVersion = properties.getProperty("sevntu.version");
val checkstyle = MojoExecutor.dependency(CHECKSTYLE_GROUPID, CHECKSTYLE_ARTIFACTID, checkstyleVersion); val checkstyle = MojoExecutor.dependency(CHECKSTYLE_GROUPID, CHECKSTYLE_ARTIFACTID, checkstyleVersion);
val sevntu = MojoExecutor.dependency(SEVNTU_GROUPID, SEVNTU_ARTIFACTID, sevntuVersion); val sevntu = MojoExecutor.dependency(SEVNTU_GROUPID, SEVNTU_ARTIFACTID, sevntuVersion);
val ruleset = MojoExecutor.dependency(KEMITIX_GROUPID, KEMITIX_ARTIFACTID, rulesetVersion); val ruleset = MojoExecutor.dependency(KEMITIX_GROUPID, KEMITIX_ARTIFACTID, rulesetVersion);
@ -107,8 +101,9 @@ public abstract class AbstractCheckMojo extends AbstractMojo {
val configLocation = val configLocation =
MojoExecutor.element(CONFIG_LOCATION, String.format("net/kemitix/checkstyle-%s.xml", level)); MojoExecutor.element(CONFIG_LOCATION, String.format("net/kemitix/checkstyle-%s.xml", level));
getLog().info( getLog().info(String.format("Running Checkstyle %s (sevntu: %s) with ruleset %s (%s)", checkstyleVersion,
String.format("Running Checkstyle %s (sevntu: %s) with %s", checkstyleVersion, sevntuVersion, level)); sevntuVersion, level, rulesetVersion
));
MojoExecutor.executeMojo(checkstylePlugin, "check", MojoExecutor.configuration(configLocation), MojoExecutor.executeMojo(checkstylePlugin, "check", MojoExecutor.configuration(configLocation),
MojoExecutor.executionEnvironment(mavenProject, mavenSession, pluginManager) MojoExecutor.executionEnvironment(mavenProject, mavenSession, pluginManager)
); );

47
pom.xml
View file

@ -6,7 +6,7 @@
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset-parent</artifactId> <artifactId>kemitix-checkstyle-ruleset-parent</artifactId>
<version>2.0.4</version> <version>2.1.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Kemitix Checkstyle Ruleset (Parent)</name> <name>Kemitix Checkstyle Ruleset (Parent)</name>
@ -15,7 +15,10 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version> <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
</properties> </properties>
<modules> <modules>
@ -60,8 +63,42 @@
</developer> </developer>
</developers> </developers>
<profiles>
<profile>
<id>release</id>
<build> <build>
<plugins> <plugins>
<!-- plugin sequence: javadoc, sources, gpg, deploy -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin><!-- maven-javadoc-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin><!-- maven-source-plugin -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
@ -79,8 +116,16 @@
</execution> </execution>
</executions> </executions>
</plugin><!-- maven-gpg-plugin --> </plugin><!-- maven-gpg-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin><!-- maven deploy-plugin -->
</plugins> </plugins>
</build> </build>
</profile><!-- release -->
</profiles>
<distributionManagement> <distributionManagement>
<snapshotRepository> <snapshotRepository>

View file

@ -7,11 +7,11 @@
<parent> <parent>
<groupId>net.kemitix</groupId> <groupId>net.kemitix</groupId>
<artifactId>kemitix-checkstyle-ruleset-parent</artifactId> <artifactId>kemitix-checkstyle-ruleset-parent</artifactId>
<version>2.0.4</version> <version>2.1.0</version>
</parent> </parent>
<artifactId>kemitix-checkstyle-ruleset</artifactId> <artifactId>kemitix-checkstyle-ruleset</artifactId>
<version>2.0.4</version> <version>2.1.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Kemitix Checkstyle Ruleset</name> <name>Kemitix Checkstyle Ruleset</name>
@ -87,4 +87,17 @@
</build> </build>
</profile><!-- release --> </profile><!-- release -->
</profiles> </profiles>
<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project> </project>