1

In my pom.xml, I have a property for protocPath:

    <properties>
        <protobuf.version>3.6.1</protobuf.version>
        <build.root.dir>${project.basedir}/..</build.root.dir>
        <build.output.dir>${build.root.dir}/build</build.output.dir>
        <protocPath>/usr/local/bin/protoc</protocPath>
    </properties>

I run this command make mvn-build where I have CMakeLists.txt

add_custom_target(
  mvn-build
  COMMAND mvn -s
            -DPROTOC_PATH=$ENV{PROTOC}
            verify
)

$ENV{PROTOC} resolves to some mounted path, i.e. not /usr/local/bin/protoc.

I am getting this error. Why is it trying to use protoc in /usr/local/bin/protoc, and not the one in $ENV{PROTOC}?

[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (default) on project ntnxdb-client-proto: An error occurred while invoking protoc: Error while executing process. Cannot run program "/usr/local/bin/protoc": error=2, No such file or directory -> [Help 1]

EDIT I've changed to the below and still same error:

add_custom_target(
  mvn-opt ALL
  WORKING_DIRECTORY ${NTNX_TOP_SOURCE_DIR}
  COMMAND mvn
            -DPROTOCPATH=$ENV{PROTOC}
            verify
)
ealeon
  • 12,074
  • 24
  • 92
  • 173

1 Answers1

1

Maven properties are indeed case sensitive, so you'll have to use -DprotocPath=... in order to override the value.

There is a clear hint about this in the Properties section of the Pom reference in the Maven doc:

Note: While environment variables themselves are case-insensitive on Windows, lookup of properties is case-sensitive.

(Bolding is mine).

You can also easily verify this by using e.g. the verbose setting for the maven-compiler-plugin:

mvn clean compile -Dmaven.compiler.verbose=true

vs.

mvn clean compile -Dmaven.compiler.VERBOSE=true

Only the former works.

gjoranv
  • 4,376
  • 3
  • 21
  • 37