From 590847a93397b3fcdaf8d101e7a8a327fbf0c4f4 Mon Sep 17 00:00:00 2001 From: domkun <1139208+domkun@users.noreply.github.com> Date: Mon, 19 Feb 2024 11:14:41 +0100 Subject: [PATCH 1/2] GH-5: Add ability to configure the plugin using system properties --- README.adoc | 22 +++++++++++++++++++ .../gitlab/codequality/GenerateMojo.java | 10 ++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/README.adoc b/README.adoc index f43f7ee..e4fb071 100644 --- a/README.adoc +++ b/README.adoc @@ -219,6 +219,28 @@ build: - merged-gl-code-quality-report.json ---- +== CLI usage + +The plugin may also be used and configured using the Maven CLI. Available configuration properties are: + +* `glcqp.spotbugsEnabled` +* `glcqp.spotbugsInputFile` +* `glcqp.checkstyleEnabled` +* `glcqp.checkstyeInputFile` +* `glcqp.outputFile` + +They are used like this: + +[source,shell] +---- +mvn de.chkal.maven:gitlab-code-quality-plugin:{version_stable}:check \ + -Dglcqp.spotbugsEnabled=true \ + -Dglcqp.spotbugsInputFile=target/spotbugsXml.xml \ + -Dglcqp.checkstyleEnabled=true \ + -Dglcqp.checkstyeInputFile=target/checkstyle-result.xml \ + -Dglcqp.outputFile=target/gl-code-quality-report.json +---- + == Using the latest snapshots The latest snapshots of this plugin are deployed to the Sonatype OSSRH repository. diff --git a/src/main/java/de/chkal/maven/gitlab/codequality/GenerateMojo.java b/src/main/java/de/chkal/maven/gitlab/codequality/GenerateMojo.java index 883b39d..be9ccb2 100644 --- a/src/main/java/de/chkal/maven/gitlab/codequality/GenerateMojo.java +++ b/src/main/java/de/chkal/maven/gitlab/codequality/GenerateMojo.java @@ -20,19 +20,19 @@ @Mojo(name = "generate", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true) public class GenerateMojo extends AbstractMojo { - @Parameter(defaultValue = "true") + @Parameter(property = "glcqp.spotbugsEnabled", defaultValue = "true") public boolean spotbugsEnabled; - @Parameter(defaultValue = "${project.build.directory}/spotbugsXml.xml") + @Parameter(property = "glcqp.spotbugsInputFile", defaultValue = "${project.build.directory}/spotbugsXml.xml") public File spotbugsInputFile; - @Parameter(defaultValue = "true") + @Parameter(property = "glcqp.checkstyleEnabled", defaultValue = "true") public boolean checkstyleEnabled; - @Parameter(defaultValue = "${project.build.directory}/checkstyle-result.xml") + @Parameter(property = "glcqp.checkstyeInputFile", defaultValue = "${project.build.directory}/checkstyle-result.xml") public File checkstyleInputFile; - @Parameter(defaultValue = "${project.build.directory}/gl-code-quality-report.json") + @Parameter(property = "glcqp.outputFile", defaultValue = "${project.build.directory}/gl-code-quality-report.json") public File outputFile; @Parameter(defaultValue = "${project}", readonly = true, required = true) From 8e40676bf9a9fa373b428df44e11db9608d216d4 Mon Sep 17 00:00:00 2001 From: Dominik Kunz <1139208+domkun@users.noreply.github.com> Date: Tue, 20 Feb 2024 11:26:02 +0100 Subject: [PATCH 2/2] Fix README.adoc to allow replacement of version placeholder Co-authored-by: Christian Kaltepoth --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index e4fb071..f8af27d 100644 --- a/README.adoc +++ b/README.adoc @@ -231,7 +231,7 @@ The plugin may also be used and configured using the Maven CLI. Available config They are used like this: -[source,shell] +[source,shell,subs="+attributes"] ---- mvn de.chkal.maven:gitlab-code-quality-plugin:{version_stable}:check \ -Dglcqp.spotbugsEnabled=true \