Maven:无法执行 shell 脚本
Maven: Cannot execute shell script
这是我尝试执行 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]
我做错了什么?
从你的错误中,我可以看出
error=13, Permission denied
尝试授予 buildPython.sh 使用 ant 插件 chmod 任务的权限,看看是否可以解决问题。见下文,
<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 属性授予 git 或 svn:executable 属性 颠覆权限。
谢谢
这是我尝试执行 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]
我做错了什么?
从你的错误中,我可以看出
error=13, Permission denied
尝试授予 buildPython.sh 使用 ant 插件 chmod 任务的权限,看看是否可以解决问题。见下文,
<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 属性授予 git 或 svn:executable 属性 颠覆权限。
谢谢