Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Spring boot 2.5.0 generated *jar and *-plain.jar?

I upgraded my spring boot app to 2.5.0, then is app.jar and app-plain.jar is created by gradle.

I would like to the difference between these jars.

thanks

like image 310
Nidhin Dev Avatar asked Jun 11 '21 10:06

Nidhin Dev


People also ask

What is plain jar in spring boot?

app-plain. jar is the archive produced by the jar task. This is a plain or standard jar file that contains only the module's classes and resources. You can learn a bit more about this in the documentation for Spring Boot's Gradle plugin. Follow this answer to receive notifications.

What is a plain JAR file?

as per the link, "simple" JAR is one that ain't any of: standalone EJB module, standalone Web application module, multiple EJB modules packaged in an Enterprise Application, multiple Web application modules package in an Enterprise Application; if the app is not packaged as any of those, then the JAR is "plain".

What is difference between spring boot jar and WAR?

JAR files allow us to package multiple files in order to use it as a library, plugin, or any kind of application. On the other hand, WAR files are used only for web applications.

What is the difference between jar and package?

A package is a mechanism in Java for organizing classes into namespaces. A jar is a Java ARchive, a file that aggregates multiple Java classes into one.

How do I run a JAR file in Spring Boot?

It can be run using java -jar. app-plain.jar is the archive produced by the jar task. This is a plain or standard jar file that contains only the module's classes and resources. You can learn a bit more about this in the documentation for Spring Boot's Gradle plugin.

What's the difference between Java-jar demo and Spring Boot?

demo-0.0.1-SNAPSHOT-plain.jar Spring Boot fat jarで、全てのモジュールのdependenciesを含んでいるため、 java -jar demo-0.0.1-SNAPSHOT.jar で実行できる。 plain jarファイルで、このモジュールのclassとresourceのみを含んでいる。

What is app-plain in Spring Boot?

This is a Spring Boot fat jar that contains all of the module's dependencies as well as its classes and resources. It can be run using java -jar. app-plain.jar is the archive produced by the jar task. This is a plain or standard jar file that contains only the module's classes and resources.

How does Maven Spring Boot work with Java?

Inside the War Manifest As mentioned before, the Maven Spring Boot plugin finds the main class and generates the configuration needed for running the java command. The resulting MANIFEST.MF has some additional lines: In particular, we can observe that the last one specifies the Spring Boot class loader launcher to use. 4.5. Inside a Jar File


Video Answer


1 Answers

app.jar is the archive produced by the bootJar task. This is a Spring Boot fat jar that contains all of the module's dependencies as well as its classes and resources. It can be run using java -jar.

app-plain.jar is the archive produced by the jar task. This is a plain or standard jar file that contains only the module's classes and resources.

You can learn a bit more about this in the documentation for Spring Boot's Gradle plugin.

like image 143
Andy Wilkinson Avatar answered Oct 29 '22 00:10

Andy Wilkinson