diff --git a/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java b/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java
index 9f7eaba..55b178e 100644
--- a/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java
+++ b/plugin-sample/src/main/java/net/kemitix/checkstyle/sample/Sample.java
@@ -27,6 +27,9 @@ package net.kemitix.checkstyle.sample;
/**
* Sample class to test the Kemitix Checkstyle Ruleset Maven Plugin against.
*
+ *
This sample is deliberately only valid for level 1-layout and 2-naming. The plugin should report errors for levels
+ * 3-javadoc and above.
+ *
* @author Paul Campbell (paul.campbell@hubio.com)
*/
public class Sample {
diff --git a/plugin/pom.xml b/plugin/pom.xml
index eb53577..c9fb04c 100644
--- a/plugin/pom.xml
+++ b/plugin/pom.xml
@@ -30,6 +30,11 @@
2.2.0
1.16.12
1.0.0
+
+ 1.0.0
+ 2.17
+ 7.5.1
+ 1.23.0
@@ -96,6 +101,34 @@
1.8
+
+ org.codehaus.mojo
+ properties-maven-plugin
+ ${properties-maven-plugin.version}
+
+
+
+ set-system-properties
+
+
+
+
+ maven-checkstyle-plugin.version
+ ${maven-checkstyle-plugin.version}
+
+
+ checkstyle.version
+ ${checkstyle.version}
+
+
+ sevntu.version
+ ${sevntu.version}
+
+
+
+
+
+
diff --git a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java
index fabc414..fbb72f1 100644
--- a/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java
+++ b/plugin/src/main/java/net/kemitix/checkstyle/ruleset/plugin/AbstractCheckMojo.java
@@ -62,19 +62,7 @@ public abstract class AbstractCheckMojo extends AbstractMojo {
private static final String CONFIG_LOCATION = "configLocation";
@Setter
- @Parameter(defaultValue = "2.17")
- private String mavenCheckstylePluginVersion;
-
- @Setter
- @Parameter(defaultValue = "7.4")
- private String checkstyleVersion;
-
- @Setter
- @Parameter(defaultValue = "1.23.0")
- private String sevntuVersion;
-
- @Setter
- @Parameter(defaultValue = "2.1.0-SNAPSHOT")
+ @Parameter(defaultValue = "${project.version}")
private String rulesetVersion;
@Setter
@@ -97,6 +85,12 @@ public abstract class AbstractCheckMojo extends AbstractMojo {
* @throws MojoFailureException on execution failure
*/
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 sevntu = MojoExecutor.dependency(SEVNTU_GROUPID, SEVNTU_ARTIFACTID, sevntuVersion);
val ruleset = MojoExecutor.dependency(KEMITIX_GROUPID, KEMITIX_ARTIFACTID, rulesetVersion);
@@ -107,8 +101,9 @@ public abstract class AbstractCheckMojo extends AbstractMojo {
val configLocation =
MojoExecutor.element(CONFIG_LOCATION, String.format("net/kemitix/checkstyle-%s.xml", level));
- getLog().info(
- String.format("Running Checkstyle %s (sevntu: %s) with %s", checkstyleVersion, sevntuVersion, level));
+ getLog().info(String.format("Running Checkstyle %s (sevntu: %s) with ruleset %s (%s)", checkstyleVersion,
+ sevntuVersion, level, rulesetVersion
+ ));
MojoExecutor.executeMojo(checkstylePlugin, "check", MojoExecutor.configuration(configLocation),
MojoExecutor.executionEnvironment(mavenProject, mavenSession, pluginManager)
);