Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#108) handle Pom projects #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>3.11.4</version>
<version>3.12.0</version>
<name>protoc-jar-maven-plugin</name>
<url>https://github.com/os72/protoc-jar-maven-plugin</url>
<description>Protocol Buffers codegen plugin - based on protoc-jar executable JAR</description>
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/com/github/os72/protocjar/maven/ProtocJarMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
* <p>
Expand Down Expand Up @@ -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;
Expand Down