2012-03-22 73 views
1

我在Ubuntu中運行我的Eclipse(Helios)。我已經添加了exec Maven Plug in。當我嘗試運行Maven構建時,我得到了IO Exception。Ubuntu exce Maven插件

它嘗試在我的項目目錄中執行Java,因此獲得IO異常。 我已經設置了我的JAVA_HOME,MAVEN_HOME,但它仍嘗試從我的項目目錄運行Java。

我添加了我的pom文件&這個例外。

<plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 

      <version>1.2</version> 
      <executions> 
       <execution> 
        <id>kilim-weave</id> 
        <phase>process-classes</phase> 

        <goals> 
         <goal>exec</goal> 
        </goals> 
       </execution> 
      </executions> 

      <configuration> 
       <executable>java</executable> 

       <arguments> 
        <argument>-Dmyproperty=myvalue</argument> 
        <argument>-classpath</argument> 
        <classpath/> 
        <argument>kilim.tools.Weaver</argument> 
        <argument>-d</argument> 
        <argument>${project.build.outputDirectory}</argument> 
        <argument>${project.build.outputDirectory}/com/contivo/smf</argument> 
       </arguments> 
      </configuration> 
     </plugin> 

產生的原因:產生java.io.IOException:不能運行程序的 「Java」(目錄 「我的項目目錄」):java.io.IOException異常:錯誤= 2,在Java中沒有這樣的文件或目錄 .lang.ProcessBuilder.start(ProcessBuilder.java:460) at java.lang.Runtime.exec(Runtime.java:593) at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58 ) at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:246) at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:302) at org.apache.commons.exec .DefaultExecutor.execute(DefaultExecutor.java:14 9) 在org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:589) 在org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:335) ...... 21更

是否有我缺少的配置。

在此先感謝

Sathish。

+1

在你的PATH中是java嗎? – 2012-03-22 15:17:18

+0

java是在我的路徑 – 2012-03-23 06:42:17

回答

0

可執行命令可以是完整路徑或可執行文件的名稱。在後一種情況下,可執行文件必須位於PATH中才能執行。

該插件將搜索按以下順序可執行文件:

relative to the root of the project 
as toolchain executable 
relative to the working directory (Windows only) 
relative to the directories specified in the system property PATH (Windows Only) 

我和完整路徑嘗試,它的作品。

1

Put it in the PATH - 如果java和javac在你的PATH中,Maven會表現得更好。

+0

你有任何例子如何做這個具體的信息? – streetlight 2014-01-28 20:39:40