Reputation: 342
I want to modify application.properties of a jar file after build a spring boot application.
I had used jar xf
to extract the jar file then modified the properties file but after jar-ed ( jar -0cf
), it had not been working with printout:
no main manifest attribute, in < filename >.jar
So is there anyway to do it and how?
Upvotes: 5
Views: 5254
Reputation: 1854
Another Solution:
You can override the application.properties by the --spring.config.location
as the below:
java -jar /path-to-jar-file/jarFileName.jar --spring.config.location=/path-to-propertiesFile/application.properties
This way you can easily update the application.properties.
It is useful when you want to run your jar file with java -jar command line (for example run jar file as a service in the Linux).
Upvotes: 0
Reputation: 1238
Jar file is just an zip file. You can open it and add file using any of tools that manipulate zip files.
Or if you want to update using jar command line you can do it using this syntax.
jar uf jar-file input-file(s)
Like described here:
https://docs.oracle.com/javase/tutorial/deployment/jar/update.html
Upvotes: 1