Spring Boot requiresUnpack 在运行时不打包
Spring Boot requiresUnpack is not upacking at runtime
我正在通过 spring-boot maven 插件构建一个可执行 jar。我需要解压其中一个依赖 jar,以便 xml 文件可以在 运行 时正确读取。我遵循了有关解包库的文档。我的插件配置如下:
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<requiresUnpack>
<dependency>
<groupId>com.deep6analytics.pipeline</groupId>
<artifactId>pipeline-services-ctakes</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>
</plugins>
我检查了jar的内容,确认了解包信息是编码在jar中的:
$ zipnote target/pipeline-apps-annotation-server-1.0-SNAPSHOT.jar | grep -C 1 UNPACK
@ BOOT-INF/lib/pipeline-services-ctakes-1.0-SNAPSHOT.jar
UNPACK:1e6eda0ca9f1b740c4aba6058cac74a5084f1706
@ (comment above this line)
根据文档,在 运行 时,我希望在我的 $TMPDIR:
中看到一个 "spring-boot-libs" 目录
Specify each library as a <dependency> with a <groupId> and a <artifactId> and they will be unpacked at runtime in $TMPDIR/spring-boot-libs.
但是,当我 运行 应用程序时,我检查了 $TMPDIR 并且没有看到解压缩的目录。因此,我的应用程序无法启动:
ls -la $TMPDIR
drwxr-xr-x 3 staff 102 Aug 10 23:40 pipeline-apps-annotation-server-1.0-SNAPSHOT.jar-spring-boot-libs-96fe7360-b23b-4caa-a2ce-75aa0300a417
drwxr-xr-x 3 staff 102 Aug 10 23:27 pipeline-apps-annotation-server-1.0-SNAPSHOT.jar-spring-boot-libs-a06a2373-0694-42e9-bee1-29191b3b764a
drwxr-xr-x 4 staff 136 Aug 10 20:54 sp_update
drwx------ 2 staff 68 Aug 10 11:30 ssh-azEJDYkZH6ho
drwxr-xr-x 3 staff 102 Aug 10 15:05 tomcat.104726406473930572.8085
drwxr-xr-x 3 staff 102 Aug 10 23:38 tomcat.1527552147767629466.8080
drwxr-xr-x 3 staff 102 Aug 10 23:13 tomcat.1546871599966723864.8080
有没有人看出我做错了什么,或者我误解了什么?
文档有点误导。解压目录在那里:
drwxr-xr-x 3 staff 102 Aug 10 23:40 pipeline-apps-annotation-server-1.0-SNAPSHOT.jar-spring-boot-libs-96fe7360-b23b-4caa-a2ce-75aa0300a417
drwxr-xr-x 3 staff 102 Aug 10 23:27 pipeline-apps-annotation-server-1.0-SNAPSHOT.jar-spring-boot-libs-a06a2373-0694-42e9-bee1-29191b3b764a
这些目录应该包含您标记为需要从可执行 jar 中解压缩的 jars 文件。
我已经打开 an issue 来更正文档。
在 linux 上它只是 /tmp 文件夹。这个变量:$TMPDIR 对我不起作用
我正在通过 spring-boot maven 插件构建一个可执行 jar。我需要解压其中一个依赖 jar,以便 xml 文件可以在 运行 时正确读取。我遵循了有关解包库的文档。我的插件配置如下:
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<requiresUnpack>
<dependency>
<groupId>com.deep6analytics.pipeline</groupId>
<artifactId>pipeline-services-ctakes</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>
</plugins>
我检查了jar的内容,确认了解包信息是编码在jar中的:
$ zipnote target/pipeline-apps-annotation-server-1.0-SNAPSHOT.jar | grep -C 1 UNPACK
@ BOOT-INF/lib/pipeline-services-ctakes-1.0-SNAPSHOT.jar
UNPACK:1e6eda0ca9f1b740c4aba6058cac74a5084f1706
@ (comment above this line)
根据文档,在 运行 时,我希望在我的 $TMPDIR:
中看到一个 "spring-boot-libs" 目录Specify each library as a <dependency> with a <groupId> and a <artifactId> and they will be unpacked at runtime in $TMPDIR/spring-boot-libs.
但是,当我 运行 应用程序时,我检查了 $TMPDIR 并且没有看到解压缩的目录。因此,我的应用程序无法启动:
ls -la $TMPDIR
drwxr-xr-x 3 staff 102 Aug 10 23:40 pipeline-apps-annotation-server-1.0-SNAPSHOT.jar-spring-boot-libs-96fe7360-b23b-4caa-a2ce-75aa0300a417
drwxr-xr-x 3 staff 102 Aug 10 23:27 pipeline-apps-annotation-server-1.0-SNAPSHOT.jar-spring-boot-libs-a06a2373-0694-42e9-bee1-29191b3b764a
drwxr-xr-x 4 staff 136 Aug 10 20:54 sp_update
drwx------ 2 staff 68 Aug 10 11:30 ssh-azEJDYkZH6ho
drwxr-xr-x 3 staff 102 Aug 10 15:05 tomcat.104726406473930572.8085
drwxr-xr-x 3 staff 102 Aug 10 23:38 tomcat.1527552147767629466.8080
drwxr-xr-x 3 staff 102 Aug 10 23:13 tomcat.1546871599966723864.8080
有没有人看出我做错了什么,或者我误解了什么?
文档有点误导。解压目录在那里:
drwxr-xr-x 3 staff 102 Aug 10 23:40 pipeline-apps-annotation-server-1.0-SNAPSHOT.jar-spring-boot-libs-96fe7360-b23b-4caa-a2ce-75aa0300a417
drwxr-xr-x 3 staff 102 Aug 10 23:27 pipeline-apps-annotation-server-1.0-SNAPSHOT.jar-spring-boot-libs-a06a2373-0694-42e9-bee1-29191b3b764a
这些目录应该包含您标记为需要从可执行 jar 中解压缩的 jars 文件。
我已经打开 an issue 来更正文档。
在 linux 上它只是 /tmp 文件夹。这个变量:$TMPDIR 对我不起作用