user1578872
user1578872

Reputation: 9028

Gradle multi module - Spring app as a normal jar for the common module

I have a Gradle multi module project and have a common module for invoking 3rd party service. Using Webclient in the common module and hence included starter in the webflux.

implementation 'org.springframework.boot:spring-boot-starter-webflux'

Since I have included spring-boot-starter-webflux, it is trying to build as a bootJar and expecting the main application. It builds fine if I incldue a main application. But, this is just a common module and I would like to build this as a jar to be included in the main module.

Tried jar in the gradle and still it is not working. Is there any other way?

jar {
  enabled = true
}

Upvotes: 0

Views: 190

Answers (1)

aksappy
aksappy

Reputation: 3400

This section in the spring documentation says how to do it.

And I tried this in one of my pet project. I was able to get a library (132k) instead of a spring boot app jar (50m)

bootJar {
  enabled = false
}

jar {
  enabled = true
}

Upvotes: 1

Related Questions