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 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;