Feature Request: Publish pbj-compiler JAR to Maven Central
Summary
Request to publish pbj-compiler as a standalone JAR artifact to Maven Central, separate from the Gradle plugin, to enable usage in Maven builds and other build systems.
Current Situation
Currently, PBJ provides:
- ✅
pbj-runtime published to Maven Central (version 0.11.15 available)
- ✅ Gradle plugin
com.hedera.pbj.pbj-compiler published to Gradle Plugin Portal
- ❌
pbj-compiler JAR last published to Maven Central at version 0.7.5 (August 2023)
Problem
Projects using Maven or other build systems cannot easily use PBJ for code generation because:
- The
pbj-compiler JAR is not published to Maven Central for recent versions (0.8.0+)
- The compiler is only available as a Gradle plugin
- This forces Maven projects to either:
- Use outdated pbj-compiler (0.7.5)
- Clone and build pbj-compiler from source using Gradle
- Commit generated code to version control
- Use Gradle just for code generation (mixing build tools)
Proposed Solution
Publish pbj-compiler as a standalone JAR artifact to Maven Central alongside pbj-runtime, similar to how protoc is published separately from protobuf-maven-plugin.
Benefits
- Build Tool Agnostic: Maven, Gradle, Ant, or any JVM build tool can use PBJ
- Direct Invocation: Can be invoked via
java -jar or programmatically via PbjCompiler.compileFilesIn()
- Custom Integration: Users can integrate PBJ into custom build pipelines
- Consistent Versioning: Keep
pbj-compiler and pbj-runtime versions in sync
Suggested Structure
com.hedera.pbj:pbj-compiler:0.11.15 (the compiler library JAR)
com.hedera.pbj:pbj-compiler-gradle-plugin:0.11.15 (optional: the Gradle plugin wrapper)
com.hedera.pbj:pbj-runtime:0.11.15 (already published)
Use Case
A small POC project is using Maven. We need PBJ code generation but cannot use the Gradle plugin. The PbjCompiler class already has a clean API:
PbjCompiler.compileFilesIn(
sourceFiles,
mainOutputDir,
testOutputDir,
javaPackageSuffix,
generateTestClasses
);
This could easily be invoked from Maven via exec-maven-plugin if the JAR were published.
Alternative Workarounds
If publishing the JAR is not feasible, alternatives include:
- Provide a CLI wrapper with main() method
- Publish documentation on building pbj-compiler locally
- Provide Maven plugin alongside Gradle plugin
References
Feature Request: Publish pbj-compiler JAR to Maven Central
Summary
Request to publish
pbj-compileras a standalone JAR artifact to Maven Central, separate from the Gradle plugin, to enable usage in Maven builds and other build systems.Current Situation
Currently, PBJ provides:
pbj-runtimepublished to Maven Central (version 0.11.15 available)com.hedera.pbj.pbj-compilerpublished to Gradle Plugin Portalpbj-compilerJAR last published to Maven Central at version 0.7.5 (August 2023)Problem
Projects using Maven or other build systems cannot easily use PBJ for code generation because:
pbj-compilerJAR is not published to Maven Central for recent versions (0.8.0+)Proposed Solution
Publish
pbj-compileras a standalone JAR artifact to Maven Central alongsidepbj-runtime, similar to howprotocis published separately fromprotobuf-maven-plugin.Benefits
java -jaror programmatically viaPbjCompiler.compileFilesIn()pbj-compilerandpbj-runtimeversions in syncSuggested Structure
Use Case
A small POC project is using Maven. We need PBJ code generation but cannot use the Gradle plugin. The
PbjCompilerclass already has a clean API:This could easily be invoked from Maven via exec-maven-plugin if the JAR were published.
Alternative Workarounds
If publishing the JAR is not feasible, alternatives include:
References