Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied of shell script #50

Closed
Lhfcws opened this issue Jul 6, 2016 · 2 comments
Closed

Permission denied of shell script #50

Lhfcws opened this issue Jul 6, 2016 · 2 comments

Comments

@Lhfcws
Copy link

Lhfcws commented Jul 6, 2016

[Problem Description]
I've written a deploy.sh for deploying projects.
Our deploy platform checked out the project from SVN, and executed "mvn clean package -U" to try packaging. Then maven showed me the error code=13 with permission denied, for that it could not directly execute the shell script due to no enough filesystem permission.

But it works fine and doesn't need permission if running "sh deploy.sh" instead of only "deploy.sh". And absolutely it also works fine if I chmod the shell script.

[Proposal]
My question/issue is :

  1. Did I do something wrong so that I failed in this kind of using case?
  2. If not, could it be an issue that running "sh xx.sh" instead of only "xx.sh" in case of these permission problems? Or just support executing a command instead of a file.
  <plugin>  
            <artifactId>exec-maven-plugin</artifactId>  
            <groupId>org.codehaus.mojo</groupId>  
            <version>1.5.0</version>  
            <executions>
                <execution>  
                    <id>deploy</id>  
                    <phase>package</phase>
                    <goals>  
                        <goal>exec</goal>  
                    </goals>  
                    <configuration>  
                        <executable>${project.basedir}/deploy.sh</executable>
                    </configuration>
                </execution>
            </executions>
        </plugin>

the trace stack is as follow (the chinese mean "Permission denied"):

java.io.IOException: Cannot run program "/data/dota/deploy/yz-deploy-serv-tag/target/deploy/tag/tag/yz-hornbill-analyz2/deploy.sh" (in directory "/data/dota/deploy/yz-deploy-serv-tag/target/deploy/tag/tag/yz-hornbill-analyz2"): error=13, 权限不够
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
        at java.lang.Runtime.exec(Runtime.java:617)
        at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
        at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
        at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: java.io.IOException: error=13, 权限不够
        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.(UNIXProcess.java:186)
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
        ... 30 more
@khmarbaise
Copy link
Member

Have you set the svn:executable property in SVN for the deploy.sh script?

@Lhfcws
Copy link
Author

Lhfcws commented Dec 23, 2016

I did not test this in Windows, but I've executed chmod 755 and it worked both in svn and git. And also for convenience I've developed a execute *nix commands plugin by myself , so I guessed this issue should be closed.

Sorry for the delayed response and thanks for the help!

@Lhfcws Lhfcws closed this as completed Dec 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants