0

here is how i am trying to execute a shell script

          <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>

but i get

[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]

what am i doing wrong?

1 Answer 1

1

From your errors, I can see

error=13, Permission denied

Try giving permission to the buildPython.sh using ant plugin chmod task to see if it solves the problem. See below,

<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>

Permanently, give permission using .gitattributes for git or svn:executable property for subversion.

Thanks

Sign up to request clarification or add additional context in comments.

2 Comments

i would like to give permissions using maven. how can i do that? i thought that the <configuration> tag would take care of that
I have modified my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.