bashmavenexec-maven-plugin

exec-maven-plugin cannot execute .sh script: permission denied


I have a bash script which I want maven to run after the compilation phase, since the script is supposed to deploy bundles. Here is the plugin I am trying to utilize in my release module:

<plugin>
          <artifactId>exec-maven-plugin</artifactId>
          <groupId>org.codehaus.mojo</groupId>
          <executions>
            <execution>
              <id>deploy-bundles</id>
              <phase>install</phase>
              <goals>
                <goal>exec</goal>
              </goals>
              <configuration>
                <executable>${basedir}/deploy.sh</executable>
              </configuration>
            </execution>
          </executions>
        </plugin>

I have the deploy.sh in the correct path, so that's verified. Now when I do mvn install I get the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (deploy-bundles) on project module.release: Command execution failed. Cannot run program "/bla/bla/module.release/deploy.sh" (in directory "/bla/bla/module.release"): error=13, Permission denied -> [Help 1]

First, I thought it was about the bash script I wrote. So I changed it to a simple bash script like this:

#!/bin/bash          
STR="Hello World!"
echo $STR    

however, I got the same error. So it is not about the code. Should I given maven special rights? Should use the sudo command?


Solution

  • You need to set the appropriate permissions to the script and put the permission also into your version control either git (.gitattributes) or in Subversion (svn:executable property).