pradeep
pradeep

Reputation: 29

cloud foundry dependency jars for spring boot

Suppose when I make a java spring boot application, it needs jars .

But when I deploy my app to cloud foundry will all the jars get build with my app and then go to cloud foundry or cloud foundry provides the jars dependency by seeing pom etc. I have seen build folder but the jars are not there so how does it work. I am new to cloud foundry so if someone can clear my doubt.

Upvotes: 0

Views: 1947

Answers (2)

Scott Frederick
Scott Frederick

Reputation: 5155

Spring Boot apps are typically packaged as "fat jars" using the Spring Boot maven or gradle plugin. The application code and all dependent jars are packaged into a single jar file.

Cloud Foundry will not download dependent jars when a Java application is deployed. It is the app's responsibility to bring all dependencies with it.

Upvotes: 1

Daniel Mikusa
Daniel Mikusa

Reputation: 15071

For most application types and build packs, when you push an application to Cloud Foundry you are pushing source code, and, if necessary, that source codes gets compiled during the staging process by the build pack. For example, with the Golang build pack you push your Go source code and it's compiled in staging and then run.

The two exceptions to this rule are the Java build pack and the binary build pack. These two build packs assume that you are pushing compiled bits and do not compile anything for you.

In the case of Java, this means that you're going to run Maven, Gradle or some other build system locally or on your CI system to produce a deployable artifact. This could be a WAR file or a JAR file, or a few other things (see "Standard Containers" on the Java build pack docs for other supported formats). Regardless of the format, it needs to be a complete and deployable unit, so it will need to include all dependent libraries.

As a side note, the cf cli has a nice feature that helps to speed up the cf push process and save bandwidth. It matches any files being uploaded and over 65k in size (default, operators can change this) to files cached on the Cloud Controller. If a local file already exists in the cache, it is not uploaded again. This works great for dependent JAR files which don't often change between pushes.

Upvotes: 2

Related Questions