2016-08-30 44 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

相關問題