Reputation: 2363
I have a case where I need to unpack the library using the:
spring-boot:repackage:requiresUnpack
Otherwise, the other library from the project is not able to work properly. As stated in the link, the selected libraries are unpacked and copied over to the temporary directory. Unpacking the libraries to the temp directory isn't great idea if I would like to keep the application running longer that the temp files expiration time. The files would be removed and application will just stop working properly.
So far, I was able to change the location target location via overwriting the TMP and TEMP environment variables but that sounds like terrible idea in the long run.
Appriciate any help here.
Upvotes: 2
Views: 2329
Reputation: 3313
This problem is not specific to "requiresUnpack" only, this is how spring-boot/tomcat handles its temporary files. So it might also surprise you in other areas.
There is an issue describing that behavior: https://github.com/spring-projects/spring-boot/issues/5009
Workarounds:
server.tomcat.basedir
to define Tomcat base directory. If not specified, a temporary directory is used. -Djava.io.tmpdir=/var/tmp
to start the app with different temporary directory.Another solution would be to NOT unpack your library. Don't store it in your fat jar, but store it somewhere on the classpath.
Upvotes: 2