I made a web service with spring boot and gradle. My project is using gradle. I have to make dynamic web project and integrate UI and web service. How can I update my web service so that it will generate WAR file instead of JAR file??
Asked
Active
Viewed 7,632 times
-1
-
1packaging "war" instead of "jar" does not help? – spi Jan 17 '18 at 09:58
-
@spi I have to integrate it with a dynamic web project(UI) so I need a WAR file instead of jar. – Puneet Dewan Jan 17 '18 at 10:01
-
yes I've understand... Then you declare your packaging (in your gradle file) as "war" instead of the (default) value "jar": https://docs.gradle.org/current/userguide/war_plugin.html – spi Jan 17 '18 at 10:04
-
Possible duplicate of [Spring Boot War deployed to Tomcat](https://stackoverflow.com/questions/27904594/spring-boot-war-deployed-to-tomcat) – g00glen00b Jan 17 '18 at 10:08
1 Answers
9
Please check these guides here:
Spring-boot Gradle Plugin War Packaging OR Create Deployable War on Application Server More specifically: you will need to change the type of packaging in the build.gradle file to "war".
Quoting from the second link:
Note :- If you’re using Gradle, you need to modify
build.gradle
to apply the war plugin to the project:
apply plugin: 'war' // add this plugin to build.gradle.

Vikrant Kashyap
- 6,398
- 3
- 32
- 52

gil.fernandes
- 12,978
- 5
- 63
- 76
-
Downvoter: could you please explain, so that I can improve the answer? – gil.fernandes Jan 17 '18 at 10:24
-
I don't know why the downvote. It worked for me. I was struggling to find this. An upvote for you – GabrielBB Jun 10 '18 at 17:41
-