1

My project pom contains gmaven-plugin plugin in which under configuaration->properties->script tag, sh script location is defined and when I am executing mvn install, I am getting below error on my windows machine.

java.io.IOException: 
Cannot run program ": CreateProcess error=193, %1 is not a valid Win32 application

Please find below relevant plugin.

        <plugin>
            <groupId>org.codehaus.gmaven</groupId>
            <artifactId>gmaven-plugin</artifactId>
            <version>1.4</version>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <goals>
                        <goal>execute</goal>
                    </goals>
                    <configuration>
                        <properties>
                            <script>${basedir}/../tools/testfile.sh</script>
                        </properties>
                        <source>
                            //some code for execution
                        </source>
                    </configuration>
                </execution>
            </executions>
        </plugin>
2
  • 1
    Please provide whole configuration for gmaven-plugin Commented Mar 9, 2018 at 18:59
  • possible typo based error, you should share the part of your pom that is relevant . Commented Mar 9, 2018 at 19:07

1 Answer 1

1

You are trying to execute a shell script on windows machine. The window command does not know how to do that. this is probably creating the issue.

If you would like to test this, just replace shell with a simple .bat file (Window executable).

You can add below into the .bat file and try mvn install

echo Test file executed.
echo I am too lazy to write commands again and again.

EDIT: As OP informed via comment

.bat file is executing successfully from when executing mvn install command but what if you want to execute only .sh file only. Is there any way for it.

Now the option is to execute the .sh on windows. Few option are to install GIT client, which by default installs GIT BASH which is a unix like command prompt.

Once install, just open any .sh file from windows and say open with.. and choose GIT BASH. Click on Always use this program. This step would associate .sh to the git bash program.

Git Bash

Another usual solution to that is use Cygwin

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

4 Comments

.bat file is executing successfully from when executing mvn install command but what if you want to execute only .sh file only. Is there any way for it.
Great! it means its windows specific issue. The problem is that you need to have an associated program to execute a .sh script. Updated the post with some options. since you would actually build and deploy on actual unix environment, I would also suggest to ignore this window specific issue and test on an unix machine.
mostly i am using Jenkins for building my project. Since in my windows machine i am facing this issue. Anyway, thnx for the explanation.
@MilanRathod you could have separate .sh file and .bat file and Maven profiles activated based on OS on the server. Profile for Linux/Unix should execute .sh and profile for Windows should execute .bat. The only issue with that is duplicate work to support both .sh and .bat files

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.