'Spring Boot not embedding custom script

I am trying to make a executable jar with spring boot. It will be run on FreeBSD so I need to add a custom embeddedLaunchScript, but have not been able to do so.

In the projects pom.xml file I have added the executable and embeddedLaunchScript tags but when I open the jar I generate after doing run as maven install, I cannot find the script and when I try to run the application on my server it give the following error:

./MyApplication-0.0.1-SNAPSHOT.jar
-bash: ./MyApplication-0.0.1-SNAPSHOT.jar: /bin/bash^M: bad interpreter: No such file or directory

Any insight into what I am missing would be most appreciated.

Below is the relevant portion of my pom.xml:

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <mainClass>com.company.project.MyApplication</mainClass>
          <executable>true</executable>
          <embeddedLaunchScript>myApp-launch-script.sh</embeddedLaunchScript>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source