HADOOP-9845 bumped up protoc from 2.4.1 to 2.5.0, but we run into a few quirks:
- 'protoc --version' in 2.4.1 exits with 1
- 'protoc --version' in 2.5.0 exits with 0
- if you have multiple protoc in your environment, you have to the the one you want to use in the PATH before building hadoop
- build documentation and requirements of protoc are outdated
This patch does:
- handles protoc version correctly independently of the exit code
- if HADOOP_PROTOC_PATH env var is defined, it uses it as the protoc executable * if HADOOP_PROTOC_PATH is not defined, it picks protoc from the PATH
- documentation updated to reflect 2.5.0 is required
- enforces the version of protoc and protobuf JAR are the same
- Added to VersionInfo the protoc version used (sooner or later this will be useful for in a troubleshooting situation).
Luke Lu suggested to make the version check for protoc lax (i.e. 2.5.*). While working on the patch I've thought about that. But that would introduce a potential mismatch between protoc and protobuff JAR.
Still If you want to use different version of protoc/protobuff from the one defined in the POM, you can use the -Dprotobuf.version=#### to specify your alternate version. But I would recommend not to do this, because if you publish the artifacts to a Maven repo, the fact you used -Dprotobuf.version=#### will be lost and the version defined in the POM properties will be used (IMO Maven should use the effective POM on deploy, but they don't).