Spring Boot未嵌入自定义脚本



我试图使一个可执行的jar与春季启动。它将在FreeBSD上运行,所以我需要添加一个自定义的embeddedLaunchScript,但是没有能够这样做。

在项目的pom.xml文件中,我添加了可执行文件和embeddedLaunchScript标签,但当我打开我在运行maven安装后生成的jar时,我找不到脚本,当我尝试在服务器上运行应用程序时,它会给出以下错误:

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

如果你能告诉我我错过了什么,我将不胜感激。

下面是我的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>

最后这个错误是由于我的脚本有windows行结尾,而不是脚本丢失。

删除行尾解决了这个问题。

最新更新