-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
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-runtimepublished to Maven Central (version 0.11.15 available) - ✅ Gradle plugin
com.hedera.pbj.pbj-compilerpublished to Gradle Plugin Portal - ❌
pbj-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:
- The
pbj-compilerJAR 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 -jaror programmatically viaPbjCompiler.compileFilesIn() - Custom Integration: Users can integrate PBJ into custom build pipelines
- Consistent Versioning: Keep
pbj-compilerandpbj-runtimeversions 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
- Gradle Plugin: https://plugins.gradle.org/plugin/com.hedera.pbj.pbj-compiler
- Maven Central pbj-runtime: https://repo1.maven.org/maven2/com/hedera/pbj/pbj-runtime/
- Maven Central pbj-compiler (outdated): https://repo1.maven.org/maven2/com/hedera/pbj/pbj-compiler/
Metadata
Metadata
Assignees
Labels
No labels