Issue
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>
Solution
In the end this error was due to the fact that my script had windows line endings, not that the script was missing.
Removing the line endings solved the issue.
Answered By - RichardFeynman
Answer Checked By - Gilberto Lyons (JavaFixing Admin)