From e1133df3bfcd9f702d9990c73d6442d8b1639610 Mon Sep 17 00:00:00 2001 From: Zalan Meggyesi Date: Thu, 17 Jun 2021 10:12:53 +0200 Subject: [PATCH 1/2] (#108) Step version in preparation of new feature --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a07ae07..ac5e318 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.os72 protoc-jar-maven-plugin maven-plugin - 3.11.4 + 3.12.0 protoc-jar-maven-plugin https://github.com/os72/protoc-jar-maven-plugin Protocol Buffers codegen plugin - based on protoc-jar executable JAR From dd5817799376a61aaeb82ae775b58601019a4743 Mon Sep 17 00:00:00 2001 From: Zalan Meggyesi Date: Thu, 17 Jun 2021 10:14:54 +0200 Subject: [PATCH 2/2] (#108) Add ability to suppress POM skipping Rationale: in certain use cases, it may happen that the plugin needs to operate on certain directories of an otherwise POM-packaged project. The new switch allows this to happen, while maintaining backwards compatibility by defaulting to the previous operation. --- .../os72/protocjar/maven/ProtocJarMojo.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/github/os72/protocjar/maven/ProtocJarMojo.java b/src/main/java/com/github/os72/protocjar/maven/ProtocJarMojo.java index 97711d7..2aeb9ad 100755 --- a/src/main/java/com/github/os72/protocjar/maven/ProtocJarMojo.java +++ b/src/main/java/com/github/os72/protocjar/maven/ProtocJarMojo.java @@ -170,6 +170,15 @@ public class ProtocJarMojo extends AbstractMojo */ private boolean cleanOutputFolder; + /** + * If this value is set to true, Maven projects with the packaging type POM will be exempted from the plugin run. + * + * Set this to false if you're using a monorepo and need to execute non-Java code generation in the parent project(s) as well. + * + * @parameter property="ignorePomPackaging" default-value="true" + */ + private boolean ignorePomPackaging; + /** * Path to the protoc plugin that generates code for the specified {@link #type}. *

@@ -317,11 +326,15 @@ public class ProtocJarMojo extends AbstractMojo private File tempRoot = null; public void execute() throws MojoExecutionException { - if (project.getPackaging() != null && "pom".equals(project.getPackaging().toLowerCase())) { - getLog().info("Skipping 'pom' packaged project"); - return; + if (ignorePomPackaging){ + if (project.getPackaging() != null && "pom".equals(project.getPackaging().toLowerCase())) { + getLog().info("Skipping 'pom' packaged project"); + return; + } + } else { + getLog().info("'pom' skipping is suppressed at the user's request..."); } - + if (outputTargets == null || outputTargets.length == 0) { OutputTarget target = new OutputTarget(); target.type = type;