[Maven-project] Incorporate maven-proto-plugin into build of Maven projects#535
[Maven-project] Incorporate maven-proto-plugin into build of Maven projects#535Thespica merged 7 commits intoapache:mainfrom
Conversation
|
If protobuf is in maven build already let's remove it from |
maven-projects/info/pom.xml
Outdated
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| <os.plugin.version>1.6.2</os.plugin.version> | ||
| <protobuf.plugin.version>0.6.1</protobuf.plugin.version> | ||
| <protobuf.version>3.21.1</protobuf.version> |
There was a problem hiding this comment.
I would suggest to pin the version not only for Maven builds but globally for the whole GraphAr. Otherwise we may face problem one day if we will try to serialize from java and, for example, read from cpp
There was a problem hiding this comment.
Yes, we can follow our doc and pin it at 1.32.0
There was a problem hiding this comment.
1.32.0 is the version of buf, not protoc.
Th actual version of protobuf that we are using is 3.27.1

(explanation: we are on proto3 syntax and the version of protobuf plugin for a minor version of protoc itself)
I mean, I have a strong feeling, that we need to pin it globally. Otherwise it may become hard to maintain it in two different places (Maven and buf.gen.yaml)
There was a problem hiding this comment.
1.32.0 is the version of buf, not
protoc.Th actual version of protobuf that we are using is
3.27.1(explanation: we are on
proto3syntax and the version of protobuf plugin for a minor version ofprotocitself)I mean, I have a strong feeling, that we need to pin it globally. Otherwise it may become hard to maintain it in two different places (Maven and buf.gen.yaml)
agree, we need to unify the protobuf version in project.
There was a problem hiding this comment.
So we need to decide which version of buf and protoc shoud we pin.
There was a problem hiding this comment.
The current protoc version is 3.27.1; at least we may pin it in Maven properties
If we are not going to use buf for generatign Java code, we do not need to touch buf version from this PR
maven-projects/info/pom.xml
Outdated
| </extensions> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.xolstice.maven.plugins</groupId> |
There was a problem hiding this comment.
While this xolostice plugin is more popular at the moment, I like this one more: https://github.com/ascopes/protobuf-maven-plugin
I found it more human-friendly and easier to work with.
There was a problem hiding this comment.
There is a good motivation: https://github.com/ascopes/protobuf-maven-plugin?tab=readme-ov-file#why-do-we-need-another-plugin
There was a problem hiding this comment.
With this plugin we do not need to have os-plugin
There was a problem hiding this comment.
I would update the Maven. I see no reason to keep older version without a reason
|
Maybe we can put the location of generated code to |
|
Why it would raise compile error if not delete the generated code? |
With modifications, the code well generated at |
|
Guys, why do we need both, buf-java plugin and maven-protobuf plugin? For me, if we do not want to store the code in the repository, let's remove java-generation from buf and leave only the maven plugin. Or did I miss something? |
hi, Sem, you are not miss anything. We do need leave only the maven plugin. @Thespica, could you delete the java-generation from buf if we use maven plugin? |
Sorry for spell the path wrong, I suggest we can put the generated code to |
I think it's okay to naming module as |
acezen
left a comment
There was a problem hiding this comment.
I have checked the compilation. LGTM, can you add compile process to format CI?
|
I have transfered to the newer plugin, could you review again? |
|
It looks cool. Thank you! I still have some concerns. It seems to me that we should use a maven-shade plugin to shade protobuf and rename generated classes... Otherwise, users may face dependency hell. But it is out of scoop for the current PR. Let's go step by step. |
.github/workflows/format.yml
Outdated
| - name: Java Code Generate | ||
| run: | | ||
| pushd maven-projects/proto | ||
| mvn clean compile |
There was a problem hiding this comment.
[Minor] why compile, not generate-sources?
…ojects (apache#535) * Add proto-maven-plugin for java-info * upgrade proto version adn patched optinal * split proto into a single package * modify proto java package name * use ascopes maven plugin and delete java code gen in buf.gen.yaml * Add ci for Java code-gen * modify code-gen command


Reason for this PR
See #522
What changes are included in this PR?
Add maven-proto-plugin into pom.xml of java-info.
When the maven project is built, this plugin will compile protobuf into java source code into
java-info/src/main/java/org/apache/graphar/proto.Potential problem:
java-info/src/main/java/org/apache/graphar/protosuitable?Are these changes tested?
No
Are there any user-facing changes?