[英]Spring Boot not embedding custom script
我正在嘗試使用 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 行結尾,而不是腳本丟失。
刪除行尾解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.