2017-02-07 81 views
0

這裏是如何我試圖執行一個shell腳本Maven的:不能執行shell腳本

  <plugin> 
       <artifactId>exec-maven-plugin</artifactId> 
       <groupId>org.codehaus.mojo</groupId> 
       <executions> 
        <execution><!-- Build Python Executable --> 
         <id>Build Python</id> 
         <phase>generate-sources</phase> 
         <goals> 
          <goal>exec</goal> 
         </goals> 
         <configuration> 
          <executable>${basedir}/scripts/buildPython.sh</executable> 
         </configuration> 
        </execution> 
       </executions> 
       <configuration> 
        <executable>chmod</executable> 
        <arguments> 
         <argument>+x</argument> 
         <argument>${basedir}/scripts/buildPython.sh</argument> 
        </arguments> 
       </configuration> 
      </plugin> 

,但我得到

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (Build Python) on project packaging: Command execution failed. Cannot run program "/ajbfiausbf/scripts/buildPython.sh" (in directory "/ajbfiausbf`"): error=13, Permission denied -> [Help 1] 

我到底做錯了什麼?

回答

1

從你的錯誤,我可以看到

錯誤= 13,拒絕權限

嘗試使用螞蟻插件文件模式的任務,看它是否解決了問題給予許可的buildPython.sh。見下文,

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.8</version> 
      <executions> 
       <execution> 
        <id>build</id> 
        <phase>compile</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <target> 
          <echo>run chmod in ${basedir}</echo> 
          <chmod file="${basedir}/scripts/buildPython.sh" perm="ugo+rx"/> 
         </target> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

永久性地,爲git或svn:subversion使用.gitattributes提供權限。

謝謝

+0

我想授予使用maven的權限。我怎樣才能做到這一點?我認爲''標籤會照顧到 – AbtPst

+0

我修改了我的答案。 – GauravJ