0

这是我尝试执行 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]

我究竟做错了什么?

4

1 回答 1

1

从你的错误中,我可以看到

错误=13,权限被拒绝

尝试使用 ant plugin chmod 任务授予 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>

永久地,使用 .gitattributes 为 git 或 svn:executable 属性为 subversion 授予权限。

谢谢

于 2017-02-07T17:10:38.417 回答