{"id":39359590,"url":"https://github.com/leohilbert/protoc-gen-java-leo","last_synced_at":"2026-01-18T02:40:31.723Z","repository":{"id":55079802,"uuid":"215243640","full_name":"leohilbert/protoc-gen-java-leo","owner":"leohilbert","description":"custom protoc java compiler for mutable message-classes and other additional features","archived":false,"fork":false,"pushed_at":"2024-07-06T11:34:48.000Z","size":1718,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-06T12:29:04.350Z","etag":null,"topics":["protobuf","protobuf-java","protoc","protoc-java-compiler"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leohilbert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-15T08:12:48.000Z","updated_at":"2024-07-06T11:34:51.000Z","dependencies_parsed_at":"2022-08-14T11:20:52.484Z","dependency_job_id":null,"html_url":"https://github.com/leohilbert/protoc-gen-java-leo","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/leohilbert/protoc-gen-java-leo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohilbert%2Fprotoc-gen-java-leo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohilbert%2Fprotoc-gen-java-leo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohilbert%2Fprotoc-gen-java-leo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohilbert%2Fprotoc-gen-java-leo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leohilbert","download_url":"https://codeload.github.com/leohilbert/protoc-gen-java-leo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leohilbert%2Fprotoc-gen-java-leo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28526638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["protobuf","protobuf-java","protoc","protoc-java-compiler"],"created_at":"2026-01-18T02:40:31.623Z","updated_at":"2026-01-18T02:40:31.704Z","avatar_url":"https://github.com/leohilbert.png","language":"Java","readme":"Leo's custom java-compiler for Proto-files  \n==========================================\nbased on googles [protoc java compiler](https://github.com/protocolbuffers/protobuf/tree/master/src/google/protobuf/compiler/java).\n\nMotivation\n==========================================\nI want to use proto-messages both as my internal datamodel as well as the DTOs for my network.\nUsing protobuf as an internal datamodel has several benefits:\n1. **It's really fast.**  \nNo reflections or complex type-mappings. Just field-\u003ebytearray in plain java. Much faster than let's say Hybernate or Java-Ser.\n2. **No more wrapper-classes**  \nIn my current implementation every object in my datamodel has a \"toProto\" and \"fromProto\"-method that copies\nover the parsed Proto-Messages into the mutable \"business-logic\" javaclasses and vice-versa. The idea is to use the \nProto-Messages AS the internal \"business-logic\" classes as well.\n3. **It's simple**  \nWith serialization you can either have it the easy way (Hibernate, Java-Ser) or the fast way (writing your own serializers).\nSince I'm developing a game I need to go for the fast way, but also I do not want to do all the work. \nThat's why I'm just generating everything!\n\nGoogle's implementation of the protobuf java compiler has a few design-choices that are not matching my usecase.  \nThis is why I'm trying to build my own compiler by copying what google did and modifying it in a few areas so \nit fits my needs.\n\nFeatures\n------------------------------------------\nThese are the changes compared to Google's implementation:\n* All fields now have setters so you can modify them without building a whole new Message-Object\n    * This also makes builders optional, since you can directly set the fields on the Message itself.\n* Each Message-Class references to a \"{MESSAGE_NAME}Custom\"-class. \n    * You can use it to implement your own functionality without needing to wrap each Message-object.\n    * The Custom-class will not be generated, so your project will only compile \n    if you have them in your project.\n* It is possible to directly overwrite the content of an existing Message with another serialized message\n    * In googles implementation you always have to create a new message to deserialize a message-binary\n* javatype-fieldoption which allows you to directly parse your messages into the desired java-class\n    * e.g. a proto \"string id\" can be a java \"java.lang.UUID id\" in the generated java-class\n    * Converters need to be manually created when used. You will get a compile-error if they don't exist\n\nYou can take a look at `/java/src/test` to see it in action.\n\nUse it in your project\n==========================================\nMaven\n------------------------------------------\n\nThe easiest way to generated java-classes with this plugin, is by using the Maven-Plugin.  \nThis is inspired by how GRPC does it.\n\n```\n\u003cplugin\u003e\n    \u003cgroupId\u003eorg.xolstice.maven.plugins\u003c/groupId\u003e\n    \u003cartifactId\u003eprotobuf-maven-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e0.6.1\u003c/version\u003e\n\n    \u003cconfiguration\u003e\n        \u003cprotocArtifact\u003ecom.google.protobuf:protoc:3.12.0:exe:${os.detected.classifier}\u003c/protocArtifact\u003e\n    \u003c/configuration\u003e\n    \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cid\u003eleo\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003ecompile-custom\u003c/goal\u003e\n                \u003cgoal\u003etest-compile-custom\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n                \u003cpluginId\u003ejava-leo\u003c/pluginId\u003e\n                \u003cpluginArtifact\u003e\n                    de.leohilbert.protobuf:protobuf-java-leo:${protobufLeo.version}:exe:${os.detected.name}\n                \u003c/pluginArtifact\u003e\n            \u003c/configuration\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n\u003c/plugin\u003e\n```\n\nDocker\n------------------------------------------\n\nYou can also use a docker-image to build it.  \nTake a look at the `runAsDocker.sh`. You can also use the images I push to the [DockerHub](https://hub.docker.com/repository/docker/leohilbert/protoc-gen-java-leo).\n\nCompile-Guide\n==========================================\n* run `./configure.sh`\n    * this will download the protoc-libraries into the /protoc-folder\n* make sure you have protoc installed in the version used by the plugin \n    * see `/fetch/protoc_release.txt`\n    * if you don't want to download it you can copy the content of protoc to `/usr/local`  \n* run `./generate.sh` to compile the test-binaries\n\nUpdating to the current Protobuf-Release\n------------------------------------------\nFirst you need to make sure that the newest release is also build in my custom protobuf-compile repo [here](https://github.com/leohilbert/protobuf-compile/) \n\nAlso you need to clone google's protobuf-project somewhere locally.  \nAfter that you should only need to run \n`./mergeFromGoogle.sh /path/to/protobuf`. \nThis will\n1. checkout the latest release in you protobuf-repo \n2. diff the changes to the java-compiler compared to the last diffed release\n3. apply the diff to the  `/src/google/protobuf/compiler/java_leo` in this project\n4. write the newly fetched commit\u0026tag into the fetch-folder\n5. run the configure \u0026 generate script\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleohilbert%2Fprotoc-gen-java-leo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleohilbert%2Fprotoc-gen-java-leo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleohilbert%2Fprotoc-gen-java-leo/lists"}