Kerry Kerry - 1 month ago 5x
Java Question

javah fails when executed via Maven exec plugin

I'm having an issue using the Maven exec plugin to execute the Java tool

. I am trying to specify the output directory to
where headers files are to be placed but I get the error:

[INFO] --- exec-maven-plugin:1.5.0:exec (create-jni-headers) @ jni-test-osgi ---
Error: unknown option: -d /home/kerry
[ERROR] Command execution failed.

This is the relevant section of the POM:

<argument>-d /home/kerry</argument>

If I execute
javah -d /home/kerry com.javatechnics.jni.test.osgi.HelloWorld
from a command line then there is no problem.

Am I doing something wrong or is there a problem with the Maven exec plugin?


Each "argument" must have its own line:


Otherwise it comes through as

javah "-d /home/kerry" com.javatechnics.jni.test.osgi.HelloWorld

where "-d /home/kerry" is a single argument that is unknown to the javah command. Hence the error.