-
I am using our own proto plugin inside this protobuf maven plugin using the configuration jvmMavenPlugin. Is there any way I can pass args into the main method of my custom plugin? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 16 replies
-
The best way to do this is to use the "option" functionality within the Protobuf API itself. This is able to be passed in via a string within the e.g. <plugin>
...
<configuration>
...
<jvmMavenPlugins>
<jvmMavenPlugin>
...
<options>--debug</options>
</jvmMavenPlugin>
</jvmMavenPlugins>
</configuration>
</plugin> This is consistently supported between binary plugins and JAR-based plugins. I have seen the Salesforce libraries support passing command line arguments directly but this appears to be just for debugging outside of being invoked via protoc directly, so I wouldn't advise you rely on that as I am not aware of a way of consistently passing those through when the plugin is actually used at runtime. Hope that helps! 😄 |
Beta Was this translation helpful? Give feedback.
Just looking through the other Maven plugin's code... looks like the arguments you describe are actually embedded in the executable that gets created to bootstrap the JVM from protoc (see https://github.com/xolstice/protobuf-maven-plugin/blob/master/src/main/java/org/xolstice/maven/plugin/protobuf/ProtocPluginAssembler.java#L154).
Right now, I don't explicitly support a way of doing this, only the parameters support that protoc provides out of the box, but I could implement this fairly easily as a new feature if you need this functionality? Worth noting that unlike the Xolstice plugin, we don't create binary executables on Windows but instead we create shell scripts or batch scripts based…