You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Upstream service propagating context to downstream service via a Nats Message
@@ -50,3 +50,22 @@ public void onMessage(Message msg, Object message)
50
50
}
51
51
}
52
52
```
53
+
## Updating Java Code Generated from Protobuf Files
54
+
55
+
Java classes inside `./src/main/java/org/mskcc/smile/commons/generated/` are manually generated.
56
+
57
+
To update existing or create new classes, follow these steps:
58
+
- Obtain or construct the `.proto` file
59
+
- Ensure that the correct `protoc` version is installed (see more in notes below)
60
+
- Run `$ protoc [path to .proto file] --java_out=[directory to write the Java generated code to]`
61
+
- Ensure the newly generated Java classes are saved at `./src/main/java/org/mskcc/smile/commons/generated/`
62
+
- Update `pom.xml` if there are changes to the Protobuf Java version
63
+
64
+
### Version of `protoc` to Use
65
+
Per the [Protobuf docs](https://protobuf.dev/support/version-support/#java):
66
+
> The protoc version can be inferred from the Protobuf Java minor version number. Example: Protobuf Java version 3.**25**.x uses protoc version **25**.x.".
67
+
68
+
Based on this, follow these steps to determine the correct `protoc` version to use:
69
+
- Note the Java version of the Java application needing the Protobuf Java classes (e.g. Java 21)
70
+
- Find the Protobuf Java version that is compatible with the Java application (e.g. Protobuf Java 4.26.1 supports Java 21)
71
+
- Determine the protoc version needed from the Protobuf Java minor version number (e.g. Protobuf Java 4.26.1 uses protoc 26.x)
0 commit comments