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,62 +57,71 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- 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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</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>
<profiles>
<profile>
<id>release</id>
<build>
<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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</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>
</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,62 +101,99 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin><!-- maven-compiler-plugin --> </plugin><!-- maven-compiler-plugin -->
<!-- plugin sequence: javadoc, sources, gpg, deploy -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>properties-maven-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version> <version>${properties-maven-plugin.version}</version>
<executions> <executions>
<execution> <execution>
<id>attach-javadocs</id>
<phase>verify</phase>
<goals> <goals>
<goal>jar</goal> <goal>set-system-properties</goal>
</goals> </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> </execution>
</executions> </executions>
</plugin><!-- maven-javadoc-plugin --> </plugin><!-- properties-maven-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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</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>
<profiles>
<profile>
<id>release</id>
<build>
<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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</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>
</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)
); );

89
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,27 +63,69 @@
</developer> </developer>
</developers> </developers>
<build> <profiles>
<plugins> <profile>
<plugin> <id>release</id>
<groupId>org.apache.maven.plugins</groupId> <build>
<artifactId>maven-gpg-plugin</artifactId> <plugins>
<version>${maven-gpg-plugin.version}</version> <!-- plugin sequence: javadoc, sources, gpg, deploy -->
<configuration> <plugin>
<passphrase>${gpg.passphrase}</passphrase> <groupId>org.apache.maven.plugins</groupId>
</configuration> <artifactId>maven-javadoc-plugin</artifactId>
<executions> <version>${maven-javadoc-plugin.version}</version>
<execution> <executions>
<id>sign-artifacts</id> <execution>
<phase>verify</phase> <id>attach-javadocs</id>
<goals> <phase>verify</phase>
<goal>sign</goal> <goals>
</goals> <goal>jar</goal>
</execution> </goals>
</executions> </execution>
</plugin><!-- maven-gpg-plugin --> </executions>
</plugins> </plugin><!-- maven-javadoc-plugin -->
</build>
<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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</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>
</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>