2016-08-30 66 views
0

我遇到了使用Maven exec插件执行Java工具javah的问题。我想指定输出目录javah其中标头文件将被存放,但我得到的错误:当通过Maven exec插件执行时,javah失败

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

这是POM的相关章节:

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>exec-maven-plugin</artifactId> 
    <executions> 
     <execution> 
      <id>create-jni-headers</id> 
      <goals> 
       <goal>exec</goal> 
      </goals> 
      <phase>compile</phase> 
      <configuration> 
       <executable>javah</executable> 
       <workingDirectory>${project.build.outputDirectory}</workingDirectory> 
       <arguments> 
        <argument>-d /home/kerry</argument> 
        <argument>com.javatechnics.jni.test.osgi.HelloWorld</argument> 
       </arguments> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

如果我执行javah -d /home/kerry com.javatechnics.jni.test.osgi.HelloWorld从命令行然后没有问题。

我做错了什么或者Maven exec插件有问题吗?

回答

0

每一个“说法”必须有自己的行:

<argument>-d</argument> 
<argument>/home/kerry</argument> 
<argument>com.javatechnics.jni.test.osgi.HelloWorld</argument> 

否则,它将会通过为

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

其中“-d /家/克里”是未知的一个参数命令javah。因此错误。

+0

我以为我曾试过,但显然不是!非常感谢。 – Kerry

相关问题